File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / ipsec-tools / src / racoon / prsa_par.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 22:39:10 2012 UTC (12 years, 4 months ago) by misho
Branches: ipsec-tools, MAIN
CVS tags: v0_8_0p0, v0_8_0, HEAD
ipsec-tools

    1: 
    2: /* A Bison parser, made by GNU Bison 2.4.1.  */
    3: 
    4: /* Skeleton implementation for Bison's Yacc-like parsers in C
    5:    
    6:       Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
    7:    Free Software Foundation, Inc.
    8:    
    9:    This program is free software: you can redistribute it and/or modify
   10:    it under the terms of the GNU General Public License as published by
   11:    the Free Software Foundation, either version 3 of the License, or
   12:    (at your option) any later version.
   13:    
   14:    This program is distributed in the hope that it will be useful,
   15:    but WITHOUT ANY WARRANTY; without even the implied warranty of
   16:    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   17:    GNU General Public License for more details.
   18:    
   19:    You should have received a copy of the GNU General Public License
   20:    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
   21: 
   22: /* As a special exception, you may create a larger work that contains
   23:    part or all of the Bison parser skeleton and distribute that work
   24:    under terms of your choice, so long as that work isn't itself a
   25:    parser generator using the skeleton or a modified version thereof
   26:    as a parser skeleton.  Alternatively, if you modify or redistribute
   27:    the parser skeleton itself, you may (at your option) remove this
   28:    special exception, which will cause the skeleton and the resulting
   29:    Bison output files to be licensed under the GNU General Public
   30:    License without this special exception.
   31:    
   32:    This special exception was added by the Free Software Foundation in
   33:    version 2.2 of Bison.  */
   34: 
   35: /* C LALR(1) parser skeleton written by Richard Stallman, by
   36:    simplifying the original so-called "semantic" parser.  */
   37: 
   38: /* All symbols defined below should begin with yy or YY, to avoid
   39:    infringing on user name space.  This should be done even for local
   40:    variables, as they might otherwise be expanded by user macros.
   41:    There are some unavoidable exceptions within include files to
   42:    define necessary library symbols; they are noted "INFRINGES ON
   43:    USER NAME SPACE" below.  */
   44: 
   45: /* Identify Bison output.  */
   46: #define YYBISON 1
   47: 
   48: /* Bison version.  */
   49: #define YYBISON_VERSION "2.4.1"
   50: 
   51: /* Skeleton name.  */
   52: #define YYSKELETON_NAME "yacc.c"
   53: 
   54: /* Pure parsers.  */
   55: #define YYPURE 0
   56: 
   57: /* Push parsers.  */
   58: #define YYPUSH 0
   59: 
   60: /* Pull parsers.  */
   61: #define YYPULL 1
   62: 
   63: /* Using locations.  */
   64: #define YYLSP_NEEDED 0
   65: 
   66: /* Substitute the variable and function names.  */
   67: #define yyparse         prsaparse
   68: #define yylex           prsalex
   69: #define yyerror         prsaerror
   70: #define yylval          prsalval
   71: #define yychar          prsachar
   72: #define yydebug         prsadebug
   73: #define yynerrs         prsanerrs
   74: 
   75: 
   76: /* Copy the first part of user declarations.  */
   77: 
   78: /* Line 189 of yacc.c  */
   79: #line 5 "prsa_par.y"
   80: 
   81: /*
   82:  * Copyright (C) 2004 SuSE Linux AG, Nuernberg, Germany.
   83:  * Contributed by: Michal Ludvig <mludvig@suse.cz>, SUSE Labs
   84:  * All rights reserved.
   85:  *
   86:  * Redistribution and use in source and binary forms, with or without
   87:  * modification, are permitted provided that the following conditions
   88:  * are met:
   89:  * 1. Redistributions of source code must retain the above copyright
   90:  *    notice, this list of conditions and the following disclaimer.
   91:  * 2. Redistributions in binary form must reproduce the above copyright
   92:  *    notice, this list of conditions and the following disclaimer in the
   93:  *    documentation and/or other materials provided with the distribution.
   94:  * 3. Neither the name of the project nor the names of its contributors
   95:  *    may be used to endorse or promote products derived from this software
   96:  *    without specific prior written permission.
   97:  *
   98:  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
   99:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  100:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  101:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
  102:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  103:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  104:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  105:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  106:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  107:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  108:  * SUCH DAMAGE.
  109:  */
  110: 
  111: /* This file contains a parser for FreeS/WAN-style ipsec.secrets RSA keys. */
  112: 
  113: #include "config.h"
  114: 
  115: #include <stdio.h>
  116: #include <stdarg.h>
  117: #include <string.h>
  118: #include <errno.h>
  119: #include <unistd.h>
  120: 
  121: #ifdef HAVE_STDARG_H
  122: #include <stdarg.h>
  123: #else
  124: #include <varargs.h>
  125: #endif
  126: 
  127: #include <netdb.h>
  128: #include <netinet/in.h>
  129: #include <sys/socket.h>
  130: #include <arpa/inet.h>
  131: #include <sys/types.h>
  132: 
  133: #include <sys/stat.h>
  134: #include <unistd.h>
  135: 
  136: #include <openssl/bn.h>
  137: #include <openssl/rsa.h>
  138: 
  139: #include "misc.h"
  140: #include "vmbuf.h"
  141: #include "plog.h"
  142: #include "oakley.h"
  143: #include "isakmp_var.h"
  144: #include "handler.h"
  145: #include "crypto_openssl.h"
  146: #include "sockmisc.h"
  147: #include "rsalist.h"
  148: 
  149: extern void prsaerror(const char *str, ...);
  150: extern int prsawrap (void);
  151: extern int prsalex (void);
  152: 
  153: extern char *prsatext;
  154: extern int prsa_cur_lineno;
  155: extern char *prsa_cur_fname;
  156: extern FILE *prsain;
  157: 
  158: int prsa_cur_lineno = 0;
  159: char *prsa_cur_fname = NULL;
  160: struct genlist *prsa_cur_list = NULL;
  161: enum rsa_key_type prsa_cur_type = RSA_TYPE_ANY;
  162: 
  163: static RSA *rsa_cur;
  164: 
  165: void
  166: prsaerror(const char *s, ...)
  167: {
  168: 	char fmt[512];
  169: 
  170: 	va_list ap;
  171: #ifdef HAVE_STDARG_H
  172: 	va_start(ap, s);
  173: #else
  174: 	va_start(ap);
  175: #endif
  176: 	snprintf(fmt, sizeof(fmt), "%s:%d: %s",
  177: 		prsa_cur_fname, prsa_cur_lineno, s);
  178: 	plogv(LLV_ERROR, LOCATION, NULL, fmt, ap);
  179: 	va_end(ap);
  180: }
  181: 
  182: void
  183: prsawarning(const char *s, ...)
  184: {
  185: 	char fmt[512];
  186: 
  187: 	va_list ap;
  188: #ifdef HAVE_STDARG_H
  189: 	va_start(ap, s);
  190: #else
  191: 	va_start(ap);
  192: #endif
  193: 	snprintf(fmt, sizeof(fmt), "%s:%d: %s",
  194: 		prsa_cur_fname, prsa_cur_lineno, s);
  195: 	plogv(LLV_WARNING, LOCATION, NULL, fmt, ap);
  196: 	va_end(ap);
  197: }
  198: 
  199: int
  200: prsawrap()
  201: {
  202: 	return 1;
  203: } 
  204: 
  205: 
  206: /* Line 189 of yacc.c  */
  207: #line 208 "prsa_par.c"
  208: 
  209: /* Enabling traces.  */
  210: #ifndef YYDEBUG
  211: # define YYDEBUG 0
  212: #endif
  213: 
  214: /* Enabling verbose error messages.  */
  215: #ifdef YYERROR_VERBOSE
  216: # undef YYERROR_VERBOSE
  217: # define YYERROR_VERBOSE 1
  218: #else
  219: # define YYERROR_VERBOSE 0
  220: #endif
  221: 
  222: /* Enabling the token table.  */
  223: #ifndef YYTOKEN_TABLE
  224: # define YYTOKEN_TABLE 0
  225: #endif
  226: 
  227: 
  228: /* Tokens.  */
  229: #ifndef YYTOKENTYPE
  230: # define YYTOKENTYPE
  231:    /* Put the tokens into the symbol table, so that GDB and other debuggers
  232:       know about them.  */
  233:    enum yytokentype {
  234:      COLON = 258,
  235:      HEX = 259,
  236:      OBRACE = 260,
  237:      EBRACE = 261,
  238:      TAG_RSA = 262,
  239:      TAG_PUB = 263,
  240:      TAG_PSK = 264,
  241:      MODULUS = 265,
  242:      PUBLIC_EXPONENT = 266,
  243:      PRIVATE_EXPONENT = 267,
  244:      PRIME1 = 268,
  245:      PRIME2 = 269,
  246:      EXPONENT1 = 270,
  247:      EXPONENT2 = 271,
  248:      COEFFICIENT = 272,
  249:      ADDR4 = 273,
  250:      ADDR6 = 274,
  251:      ADDRANY = 275,
  252:      SLASH = 276,
  253:      NUMBER = 277,
  254:      BASE64 = 278
  255:    };
  256: #endif
  257: /* Tokens.  */
  258: #define COLON 258
  259: #define HEX 259
  260: #define OBRACE 260
  261: #define EBRACE 261
  262: #define TAG_RSA 262
  263: #define TAG_PUB 263
  264: #define TAG_PSK 264
  265: #define MODULUS 265
  266: #define PUBLIC_EXPONENT 266
  267: #define PRIVATE_EXPONENT 267
  268: #define PRIME1 268
  269: #define PRIME2 269
  270: #define EXPONENT1 270
  271: #define EXPONENT2 271
  272: #define COEFFICIENT 272
  273: #define ADDR4 273
  274: #define ADDR6 274
  275: #define ADDRANY 275
  276: #define SLASH 276
  277: #define NUMBER 277
  278: #define BASE64 278
  279: 
  280: 
  281: 
  282: 
  283: #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
  284: typedef union YYSTYPE
  285: {
  286: 
  287: /* Line 214 of yacc.c  */
  288: #line 130 "prsa_par.y"
  289: 
  290: 	BIGNUM *bn;
  291: 	RSA *rsa;
  292: 	char *chr;
  293: 	long num;
  294: 	struct netaddr *naddr;
  295: 
  296: 
  297: 
  298: /* Line 214 of yacc.c  */
  299: #line 300 "prsa_par.c"
  300: } YYSTYPE;
  301: # define YYSTYPE_IS_TRIVIAL 1
  302: # define yystype YYSTYPE /* obsolescent; will be withdrawn */
  303: # define YYSTYPE_IS_DECLARED 1
  304: #endif
  305: 
  306: 
  307: /* Copy the second part of user declarations.  */
  308: 
  309: 
  310: /* Line 264 of yacc.c  */
  311: #line 312 "prsa_par.c"
  312: 
  313: #ifdef short
  314: # undef short
  315: #endif
  316: 
  317: #ifdef YYTYPE_UINT8
  318: typedef YYTYPE_UINT8 yytype_uint8;
  319: #else
  320: typedef unsigned char yytype_uint8;
  321: #endif
  322: 
  323: #ifdef YYTYPE_INT8
  324: typedef YYTYPE_INT8 yytype_int8;
  325: #elif (defined __STDC__ || defined __C99__FUNC__ \
  326:      || defined __cplusplus || defined _MSC_VER)
  327: typedef signed char yytype_int8;
  328: #else
  329: typedef short int yytype_int8;
  330: #endif
  331: 
  332: #ifdef YYTYPE_UINT16
  333: typedef YYTYPE_UINT16 yytype_uint16;
  334: #else
  335: typedef unsigned short int yytype_uint16;
  336: #endif
  337: 
  338: #ifdef YYTYPE_INT16
  339: typedef YYTYPE_INT16 yytype_int16;
  340: #else
  341: typedef short int yytype_int16;
  342: #endif
  343: 
  344: #ifndef YYSIZE_T
  345: # ifdef __SIZE_TYPE__
  346: #  define YYSIZE_T __SIZE_TYPE__
  347: # elif defined size_t
  348: #  define YYSIZE_T size_t
  349: # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
  350:      || defined __cplusplus || defined _MSC_VER)
  351: #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  352: #  define YYSIZE_T size_t
  353: # else
  354: #  define YYSIZE_T unsigned int
  355: # endif
  356: #endif
  357: 
  358: #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
  359: 
  360: #ifndef YY_
  361: # if YYENABLE_NLS
  362: #  if ENABLE_NLS
  363: #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
  364: #   define YY_(msgid) dgettext ("bison-runtime", msgid)
  365: #  endif
  366: # endif
  367: # ifndef YY_
  368: #  define YY_(msgid) msgid
  369: # endif
  370: #endif
  371: 
  372: /* Suppress unused-variable warnings by "using" E.  */
  373: #if ! defined lint || defined __GNUC__
  374: # define YYUSE(e) ((void) (e))
  375: #else
  376: # define YYUSE(e) /* empty */
  377: #endif
  378: 
  379: /* Identity function, used to suppress warnings about constant conditions.  */
  380: #ifndef lint
  381: # define YYID(n) (n)
  382: #else
  383: #if (defined __STDC__ || defined __C99__FUNC__ \
  384:      || defined __cplusplus || defined _MSC_VER)
  385: static int
  386: YYID (int yyi)
  387: #else
  388: static int
  389: YYID (yyi)
  390:     int yyi;
  391: #endif
  392: {
  393:   return yyi;
  394: }
  395: #endif
  396: 
  397: #if ! defined yyoverflow || YYERROR_VERBOSE
  398: 
  399: /* The parser invokes alloca or malloc; define the necessary symbols.  */
  400: 
  401: # ifdef YYSTACK_USE_ALLOCA
  402: #  if YYSTACK_USE_ALLOCA
  403: #   ifdef __GNUC__
  404: #    define YYSTACK_ALLOC __builtin_alloca
  405: #   elif defined __BUILTIN_VA_ARG_INCR
  406: #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
  407: #   elif defined _AIX
  408: #    define YYSTACK_ALLOC __alloca
  409: #   elif defined _MSC_VER
  410: #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
  411: #    define alloca _alloca
  412: #   else
  413: #    define YYSTACK_ALLOC alloca
  414: #    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
  415:      || defined __cplusplus || defined _MSC_VER)
  416: #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  417: #     ifndef _STDLIB_H
  418: #      define _STDLIB_H 1
  419: #     endif
  420: #    endif
  421: #   endif
  422: #  endif
  423: # endif
  424: 
  425: # ifdef YYSTACK_ALLOC
  426:    /* Pacify GCC's `empty if-body' warning.  */
  427: #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
  428: #  ifndef YYSTACK_ALLOC_MAXIMUM
  429:     /* The OS might guarantee only one guard page at the bottom of the stack,
  430:        and a page size can be as small as 4096 bytes.  So we cannot safely
  431:        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
  432:        to allow for a few compiler-allocated temporary stack slots.  */
  433: #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
  434: #  endif
  435: # else
  436: #  define YYSTACK_ALLOC YYMALLOC
  437: #  define YYSTACK_FREE YYFREE
  438: #  ifndef YYSTACK_ALLOC_MAXIMUM
  439: #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
  440: #  endif
  441: #  if (defined __cplusplus && ! defined _STDLIB_H \
  442:        && ! ((defined YYMALLOC || defined malloc) \
  443: 	     && (defined YYFREE || defined free)))
  444: #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  445: #   ifndef _STDLIB_H
  446: #    define _STDLIB_H 1
  447: #   endif
  448: #  endif
  449: #  ifndef YYMALLOC
  450: #   define YYMALLOC malloc
  451: #   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
  452:      || defined __cplusplus || defined _MSC_VER)
  453: void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
  454: #   endif
  455: #  endif
  456: #  ifndef YYFREE
  457: #   define YYFREE free
  458: #   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
  459:      || defined __cplusplus || defined _MSC_VER)
  460: void free (void *); /* INFRINGES ON USER NAME SPACE */
  461: #   endif
  462: #  endif
  463: # endif
  464: #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
  465: 
  466: 
  467: #if (! defined yyoverflow \
  468:      && (! defined __cplusplus \
  469: 	 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
  470: 
  471: /* A type that is properly aligned for any stack member.  */
  472: union yyalloc
  473: {
  474:   yytype_int16 yyss_alloc;
  475:   YYSTYPE yyvs_alloc;
  476: };
  477: 
  478: /* The size of the maximum gap between one aligned stack and the next.  */
  479: # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
  480: 
  481: /* The size of an array large to enough to hold all stacks, each with
  482:    N elements.  */
  483: # define YYSTACK_BYTES(N) \
  484:      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
  485:       + YYSTACK_GAP_MAXIMUM)
  486: 
  487: /* Copy COUNT objects from FROM to TO.  The source and destination do
  488:    not overlap.  */
  489: # ifndef YYCOPY
  490: #  if defined __GNUC__ && 1 < __GNUC__
  491: #   define YYCOPY(To, From, Count) \
  492:       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
  493: #  else
  494: #   define YYCOPY(To, From, Count)		\
  495:       do					\
  496: 	{					\
  497: 	  YYSIZE_T yyi;				\
  498: 	  for (yyi = 0; yyi < (Count); yyi++)	\
  499: 	    (To)[yyi] = (From)[yyi];		\
  500: 	}					\
  501:       while (YYID (0))
  502: #  endif
  503: # endif
  504: 
  505: /* Relocate STACK from its old location to the new one.  The
  506:    local variables YYSIZE and YYSTACKSIZE give the old and new number of
  507:    elements in the stack, and YYPTR gives the new location of the
  508:    stack.  Advance YYPTR to a properly aligned location for the next
  509:    stack.  */
  510: # define YYSTACK_RELOCATE(Stack_alloc, Stack)				\
  511:     do									\
  512:       {									\
  513: 	YYSIZE_T yynewbytes;						\
  514: 	YYCOPY (&yyptr->Stack_alloc, Stack, yysize);			\
  515: 	Stack = &yyptr->Stack_alloc;					\
  516: 	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
  517: 	yyptr += yynewbytes / sizeof (*yyptr);				\
  518:       }									\
  519:     while (YYID (0))
  520: 
  521: #endif
  522: 
  523: /* YYFINAL -- State number of the termination state.  */
  524: #define YYFINAL  16
  525: /* YYLAST -- Last index in YYTABLE.  */
  526: #define YYLAST   60
  527: 
  528: /* YYNTOKENS -- Number of terminals.  */
  529: #define YYNTOKENS  24
  530: /* YYNNTS -- Number of nonterminals.  */
  531: #define YYNNTS  10
  532: /* YYNRULES -- Number of rules.  */
  533: #define YYNRULES  26
  534: /* YYNRULES -- Number of states.  */
  535: #define YYNSTATES  55
  536: 
  537: /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
  538: #define YYUNDEFTOK  2
  539: #define YYMAXUTOK   278
  540: 
  541: #define YYTRANSLATE(YYX)						\
  542:   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
  543: 
  544: /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
  545: static const yytype_uint8 yytranslate[] =
  546: {
  547:        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  548:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  549:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  550:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  551:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  552:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  553:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  554:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  555:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  556:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  557:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  558:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  559:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  560:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  561:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  562:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  563:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  564:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  565:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  566:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  567:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  568:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  569:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  570:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  571:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  572:        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
  573:        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
  574:       15,    16,    17,    18,    19,    20,    21,    22,    23
  575: };
  576: 
  577: #if YYDEBUG
  578: /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
  579:    YYRHS.  */
  580: static const yytype_uint8 yyprhs[] =
  581: {
  582:        0,     0,     3,     6,     8,    13,    17,    20,    25,    28,
  583:       31,    33,    35,    37,    40,    43,    44,    47,    50,    52,
  584:       56,    60,    64,    68,    72,    76,    80
  585: };
  586: 
  587: /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
  588: static const yytype_int8 yyrhs[] =
  589: {
  590:       25,     0,    -1,    25,    26,    -1,    26,    -1,    28,    28,
  591:        3,    27,    -1,    28,     3,    27,    -1,     3,    27,    -1,
  592:        7,     5,    32,     6,    -1,     8,    23,    -1,     8,     4,
  593:       -1,    29,    -1,    30,    -1,    20,    -1,    18,    31,    -1,
  594:       19,    31,    -1,    -1,    21,    22,    -1,    32,    33,    -1,
  595:       33,    -1,    10,     3,     4,    -1,    11,     3,     4,    -1,
  596:       12,     3,     4,    -1,    13,     3,     4,    -1,    14,     3,
  597:        4,    -1,    15,     3,     4,    -1,    16,     3,     4,    -1,
  598:       17,     3,     4,    -1
  599: };
  600: 
  601: /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
  602: static const yytype_uint16 yyrline[] =
  603: {
  604:        0,   155,   155,   156,   160,   164,   168,   175,   207,   216,
  605:      227,   228,   229,   236,   265,   294,   295,   298,   299,   303,
  606:      305,   307,   309,   311,   313,   315,   317
  607: };
  608: #endif
  609: 
  610: #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
  611: /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
  612:    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
  613: static const char *const yytname[] =
  614: {
  615:   "$end", "error", "$undefined", "COLON", "HEX", "OBRACE", "EBRACE",
  616:   "TAG_RSA", "TAG_PUB", "TAG_PSK", "MODULUS", "PUBLIC_EXPONENT",
  617:   "PRIVATE_EXPONENT", "PRIME1", "PRIME2", "EXPONENT1", "EXPONENT2",
  618:   "COEFFICIENT", "ADDR4", "ADDR6", "ADDRANY", "SLASH", "NUMBER", "BASE64",
  619:   "$accept", "statements", "statement", "rsa_statement", "addr", "addr4",
  620:   "addr6", "prefix", "params", "param", 0
  621: };
  622: #endif
  623: 
  624: # ifdef YYPRINT
  625: /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
  626:    token YYLEX-NUM.  */
  627: static const yytype_uint16 yytoknum[] =
  628: {
  629:        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
  630:      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
  631:      275,   276,   277,   278
  632: };
  633: # endif
  634: 
  635: /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
  636: static const yytype_uint8 yyr1[] =
  637: {
  638:        0,    24,    25,    25,    26,    26,    26,    27,    27,    27,
  639:       28,    28,    28,    29,    30,    31,    31,    32,    32,    33,
  640:       33,    33,    33,    33,    33,    33,    33
  641: };
  642: 
  643: /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
  644: static const yytype_uint8 yyr2[] =
  645: {
  646:        0,     2,     2,     1,     4,     3,     2,     4,     2,     2,
  647:        1,     1,     1,     2,     2,     0,     2,     2,     1,     3,
  648:        3,     3,     3,     3,     3,     3,     3
  649: };
  650: 
  651: /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
  652:    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
  653:    means the default is an error.  */
  654: static const yytype_uint8 yydefact[] =
  655: {
  656:        0,     0,    15,    15,    12,     0,     3,     0,    10,    11,
  657:        0,     0,     6,     0,    13,    14,     1,     2,     0,     0,
  658:        0,     9,     8,    16,     5,     0,     0,     0,     0,     0,
  659:        0,     0,     0,     0,     0,    18,     4,     0,     0,     0,
  660:        0,     0,     0,     0,     0,     7,    17,    19,    20,    21,
  661:       22,    23,    24,    25,    26
  662: };
  663: 
  664: /* YYDEFGOTO[NTERM-NUM].  */
  665: static const yytype_int8 yydefgoto[] =
  666: {
  667:       -1,     5,     6,    12,     7,     8,     9,    14,    34,    35
  668: };
  669: 
  670: /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
  671:    STATE-NUM.  */
  672: #define YYPACT_NINF -18
  673: static const yytype_int8 yypact[] =
  674: {
  675:        4,    -3,   -15,   -15,   -18,     0,   -18,     7,   -18,   -18,
  676:        6,    -2,   -18,   -13,   -18,   -18,   -18,   -18,    -3,     9,
  677:       30,   -18,   -18,   -18,   -18,    -3,    10,    11,    12,    13,
  678:       14,    26,    27,    28,    22,   -18,   -18,    44,    45,    46,
  679:       47,    48,    49,    50,    51,   -18,   -18,   -18,   -18,   -18,
  680:      -18,   -18,   -18,   -18,   -18
  681: };
  682: 
  683: /* YYPGOTO[NTERM-NUM].  */
  684: static const yytype_int8 yypgoto[] =
  685: {
  686:      -18,   -18,    52,   -17,    53,   -18,   -18,    55,   -18,    25
  687: };
  688: 
  689: /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
  690:    positive, shift that token.  If negative, reduce the rule which
  691:    number is the opposite.  If zero, do what YYDEFACT says.
  692:    If YYTABLE_NINF, syntax error.  */
  693: #define YYTABLE_NINF -1
  694: static const yytype_uint8 yytable[] =
  695: {
  696:       16,    24,    21,     1,    10,    11,    13,     1,    36,    23,
  697:       18,    20,    25,    37,    38,    39,    40,    41,     2,     3,
  698:        4,    22,     2,     3,     4,     2,     3,     4,    45,    42,
  699:       43,    44,    26,    27,    28,    29,    30,    31,    32,    33,
  700:       26,    27,    28,    29,    30,    31,    32,    33,    47,    48,
  701:       49,    50,    51,    52,    53,    54,     0,    17,    15,    46,
  702:       19
  703: };
  704: 
  705: static const yytype_int8 yycheck[] =
  706: {
  707:        0,    18,     4,     3,     7,     8,    21,     3,    25,    22,
  708:        3,     5,     3,     3,     3,     3,     3,     3,    18,    19,
  709:       20,    23,    18,    19,    20,    18,    19,    20,     6,     3,
  710:        3,     3,    10,    11,    12,    13,    14,    15,    16,    17,
  711:       10,    11,    12,    13,    14,    15,    16,    17,     4,     4,
  712:        4,     4,     4,     4,     4,     4,    -1,     5,     3,    34,
  713:        7
  714: };
  715: 
  716: /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
  717:    symbol of state STATE-NUM.  */
  718: static const yytype_uint8 yystos[] =
  719: {
  720:        0,     3,    18,    19,    20,    25,    26,    28,    29,    30,
  721:        7,     8,    27,    21,    31,    31,     0,    26,     3,    28,
  722:        5,     4,    23,    22,    27,     3,    10,    11,    12,    13,
  723:       14,    15,    16,    17,    32,    33,    27,     3,     3,     3,
  724:        3,     3,     3,     3,     3,     6,    33,     4,     4,     4,
  725:        4,     4,     4,     4,     4
  726: };
  727: 
  728: #define yyerrok		(yyerrstatus = 0)
  729: #define yyclearin	(yychar = YYEMPTY)
  730: #define YYEMPTY		(-2)
  731: #define YYEOF		0
  732: 
  733: #define YYACCEPT	goto yyacceptlab
  734: #define YYABORT		goto yyabortlab
  735: #define YYERROR		goto yyerrorlab
  736: 
  737: 
  738: /* Like YYERROR except do call yyerror.  This remains here temporarily
  739:    to ease the transition to the new meaning of YYERROR, for GCC.
  740:    Once GCC version 2 has supplanted version 1, this can go.  */
  741: 
  742: #define YYFAIL		goto yyerrlab
  743: 
  744: #define YYRECOVERING()  (!!yyerrstatus)
  745: 
  746: #define YYBACKUP(Token, Value)					\
  747: do								\
  748:   if (yychar == YYEMPTY && yylen == 1)				\
  749:     {								\
  750:       yychar = (Token);						\
  751:       yylval = (Value);						\
  752:       yytoken = YYTRANSLATE (yychar);				\
  753:       YYPOPSTACK (1);						\
  754:       goto yybackup;						\
  755:     }								\
  756:   else								\
  757:     {								\
  758:       yyerror (YY_("syntax error: cannot back up")); \
  759:       YYERROR;							\
  760:     }								\
  761: while (YYID (0))
  762: 
  763: 
  764: #define YYTERROR	1
  765: #define YYERRCODE	256
  766: 
  767: 
  768: /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
  769:    If N is 0, then set CURRENT to the empty location which ends
  770:    the previous symbol: RHS[0] (always defined).  */
  771: 
  772: #define YYRHSLOC(Rhs, K) ((Rhs)[K])
  773: #ifndef YYLLOC_DEFAULT
  774: # define YYLLOC_DEFAULT(Current, Rhs, N)				\
  775:     do									\
  776:       if (YYID (N))                                                    \
  777: 	{								\
  778: 	  (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;	\
  779: 	  (Current).first_column = YYRHSLOC (Rhs, 1).first_column;	\
  780: 	  (Current).last_line    = YYRHSLOC (Rhs, N).last_line;		\
  781: 	  (Current).last_column  = YYRHSLOC (Rhs, N).last_column;	\
  782: 	}								\
  783:       else								\
  784: 	{								\
  785: 	  (Current).first_line   = (Current).last_line   =		\
  786: 	    YYRHSLOC (Rhs, 0).last_line;				\
  787: 	  (Current).first_column = (Current).last_column =		\
  788: 	    YYRHSLOC (Rhs, 0).last_column;				\
  789: 	}								\
  790:     while (YYID (0))
  791: #endif
  792: 
  793: 
  794: /* YY_LOCATION_PRINT -- Print the location on the stream.
  795:    This macro was not mandated originally: define only if we know
  796:    we won't break user code: when these are the locations we know.  */
  797: 
  798: #ifndef YY_LOCATION_PRINT
  799: # if YYLTYPE_IS_TRIVIAL
  800: #  define YY_LOCATION_PRINT(File, Loc)			\
  801:      fprintf (File, "%d.%d-%d.%d",			\
  802: 	      (Loc).first_line, (Loc).first_column,	\
  803: 	      (Loc).last_line,  (Loc).last_column)
  804: # else
  805: #  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
  806: # endif
  807: #endif
  808: 
  809: 
  810: /* YYLEX -- calling `yylex' with the right arguments.  */
  811: 
  812: #ifdef YYLEX_PARAM
  813: # define YYLEX yylex (YYLEX_PARAM)
  814: #else
  815: # define YYLEX yylex ()
  816: #endif
  817: 
  818: /* Enable debugging if requested.  */
  819: #if YYDEBUG
  820: 
  821: # ifndef YYFPRINTF
  822: #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
  823: #  define YYFPRINTF fprintf
  824: # endif
  825: 
  826: # define YYDPRINTF(Args)			\
  827: do {						\
  828:   if (yydebug)					\
  829:     YYFPRINTF Args;				\
  830: } while (YYID (0))
  831: 
  832: # define YY_SYMBOL_PRINT(Title, Type, Value, Location)			  \
  833: do {									  \
  834:   if (yydebug)								  \
  835:     {									  \
  836:       YYFPRINTF (stderr, "%s ", Title);					  \
  837:       yy_symbol_print (stderr,						  \
  838: 		  Type, Value); \
  839:       YYFPRINTF (stderr, "\n");						  \
  840:     }									  \
  841: } while (YYID (0))
  842: 
  843: 
  844: /*--------------------------------.
  845: | Print this symbol on YYOUTPUT.  |
  846: `--------------------------------*/
  847: 
  848: /*ARGSUSED*/
  849: #if (defined __STDC__ || defined __C99__FUNC__ \
  850:      || defined __cplusplus || defined _MSC_VER)
  851: static void
  852: yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
  853: #else
  854: static void
  855: yy_symbol_value_print (yyoutput, yytype, yyvaluep)
  856:     FILE *yyoutput;
  857:     int yytype;
  858:     YYSTYPE const * const yyvaluep;
  859: #endif
  860: {
  861:   if (!yyvaluep)
  862:     return;
  863: # ifdef YYPRINT
  864:   if (yytype < YYNTOKENS)
  865:     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
  866: # else
  867:   YYUSE (yyoutput);
  868: # endif
  869:   switch (yytype)
  870:     {
  871:       default:
  872: 	break;
  873:     }
  874: }
  875: 
  876: 
  877: /*--------------------------------.
  878: | Print this symbol on YYOUTPUT.  |
  879: `--------------------------------*/
  880: 
  881: #if (defined __STDC__ || defined __C99__FUNC__ \
  882:      || defined __cplusplus || defined _MSC_VER)
  883: static void
  884: yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
  885: #else
  886: static void
  887: yy_symbol_print (yyoutput, yytype, yyvaluep)
  888:     FILE *yyoutput;
  889:     int yytype;
  890:     YYSTYPE const * const yyvaluep;
  891: #endif
  892: {
  893:   if (yytype < YYNTOKENS)
  894:     YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
  895:   else
  896:     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
  897: 
  898:   yy_symbol_value_print (yyoutput, yytype, yyvaluep);
  899:   YYFPRINTF (yyoutput, ")");
  900: }
  901: 
  902: /*------------------------------------------------------------------.
  903: | yy_stack_print -- Print the state stack from its BOTTOM up to its |
  904: | TOP (included).                                                   |
  905: `------------------------------------------------------------------*/
  906: 
  907: #if (defined __STDC__ || defined __C99__FUNC__ \
  908:      || defined __cplusplus || defined _MSC_VER)
  909: static void
  910: yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
  911: #else
  912: static void
  913: yy_stack_print (yybottom, yytop)
  914:     yytype_int16 *yybottom;
  915:     yytype_int16 *yytop;
  916: #endif
  917: {
  918:   YYFPRINTF (stderr, "Stack now");
  919:   for (; yybottom <= yytop; yybottom++)
  920:     {
  921:       int yybot = *yybottom;
  922:       YYFPRINTF (stderr, " %d", yybot);
  923:     }
  924:   YYFPRINTF (stderr, "\n");
  925: }
  926: 
  927: # define YY_STACK_PRINT(Bottom, Top)				\
  928: do {								\
  929:   if (yydebug)							\
  930:     yy_stack_print ((Bottom), (Top));				\
  931: } while (YYID (0))
  932: 
  933: 
  934: /*------------------------------------------------.
  935: | Report that the YYRULE is going to be reduced.  |
  936: `------------------------------------------------*/
  937: 
  938: #if (defined __STDC__ || defined __C99__FUNC__ \
  939:      || defined __cplusplus || defined _MSC_VER)
  940: static void
  941: yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
  942: #else
  943: static void
  944: yy_reduce_print (yyvsp, yyrule)
  945:     YYSTYPE *yyvsp;
  946:     int yyrule;
  947: #endif
  948: {
  949:   int yynrhs = yyr2[yyrule];
  950:   int yyi;
  951:   unsigned long int yylno = yyrline[yyrule];
  952:   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
  953: 	     yyrule - 1, yylno);
  954:   /* The symbols being reduced.  */
  955:   for (yyi = 0; yyi < yynrhs; yyi++)
  956:     {
  957:       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
  958:       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
  959: 		       &(yyvsp[(yyi + 1) - (yynrhs)])
  960: 		       		       );
  961:       YYFPRINTF (stderr, "\n");
  962:     }
  963: }
  964: 
  965: # define YY_REDUCE_PRINT(Rule)		\
  966: do {					\
  967:   if (yydebug)				\
  968:     yy_reduce_print (yyvsp, Rule); \
  969: } while (YYID (0))
  970: 
  971: /* Nonzero means print parse trace.  It is left uninitialized so that
  972:    multiple parsers can coexist.  */
  973: int yydebug;
  974: #else /* !YYDEBUG */
  975: # define YYDPRINTF(Args)
  976: # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
  977: # define YY_STACK_PRINT(Bottom, Top)
  978: # define YY_REDUCE_PRINT(Rule)
  979: #endif /* !YYDEBUG */
  980: 
  981: 
  982: /* YYINITDEPTH -- initial size of the parser's stacks.  */
  983: #ifndef	YYINITDEPTH
  984: # define YYINITDEPTH 200
  985: #endif
  986: 
  987: /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
  988:    if the built-in stack extension method is used).
  989: 
  990:    Do not make this value too large; the results are undefined if
  991:    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
  992:    evaluated with infinite-precision integer arithmetic.  */
  993: 
  994: #ifndef YYMAXDEPTH
  995: # define YYMAXDEPTH 10000
  996: #endif
  997: 
  998: 
  999: 
 1000: #if YYERROR_VERBOSE
 1001: 
 1002: # ifndef yystrlen
 1003: #  if defined __GLIBC__ && defined _STRING_H
 1004: #   define yystrlen strlen
 1005: #  else
 1006: /* Return the length of YYSTR.  */
 1007: #if (defined __STDC__ || defined __C99__FUNC__ \
 1008:      || defined __cplusplus || defined _MSC_VER)
 1009: static YYSIZE_T
 1010: yystrlen (const char *yystr)
 1011: #else
 1012: static YYSIZE_T
 1013: yystrlen (yystr)
 1014:     const char *yystr;
 1015: #endif
 1016: {
 1017:   YYSIZE_T yylen;
 1018:   for (yylen = 0; yystr[yylen]; yylen++)
 1019:     continue;
 1020:   return yylen;
 1021: }
 1022: #  endif
 1023: # endif
 1024: 
 1025: # ifndef yystpcpy
 1026: #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
 1027: #   define yystpcpy stpcpy
 1028: #  else
 1029: /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
 1030:    YYDEST.  */
 1031: #if (defined __STDC__ || defined __C99__FUNC__ \
 1032:      || defined __cplusplus || defined _MSC_VER)
 1033: static char *
 1034: yystpcpy (char *yydest, const char *yysrc)
 1035: #else
 1036: static char *
 1037: yystpcpy (yydest, yysrc)
 1038:     char *yydest;
 1039:     const char *yysrc;
 1040: #endif
 1041: {
 1042:   char *yyd = yydest;
 1043:   const char *yys = yysrc;
 1044: 
 1045:   while ((*yyd++ = *yys++) != '\0')
 1046:     continue;
 1047: 
 1048:   return yyd - 1;
 1049: }
 1050: #  endif
 1051: # endif
 1052: 
 1053: # ifndef yytnamerr
 1054: /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
 1055:    quotes and backslashes, so that it's suitable for yyerror.  The
 1056:    heuristic is that double-quoting is unnecessary unless the string
 1057:    contains an apostrophe, a comma, or backslash (other than
 1058:    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
 1059:    null, do not copy; instead, return the length of what the result
 1060:    would have been.  */
 1061: static YYSIZE_T
 1062: yytnamerr (char *yyres, const char *yystr)
 1063: {
 1064:   if (*yystr == '"')
 1065:     {
 1066:       YYSIZE_T yyn = 0;
 1067:       char const *yyp = yystr;
 1068: 
 1069:       for (;;)
 1070: 	switch (*++yyp)
 1071: 	  {
 1072: 	  case '\'':
 1073: 	  case ',':
 1074: 	    goto do_not_strip_quotes;
 1075: 
 1076: 	  case '\\':
 1077: 	    if (*++yyp != '\\')
 1078: 	      goto do_not_strip_quotes;
 1079: 	    /* Fall through.  */
 1080: 	  default:
 1081: 	    if (yyres)
 1082: 	      yyres[yyn] = *yyp;
 1083: 	    yyn++;
 1084: 	    break;
 1085: 
 1086: 	  case '"':
 1087: 	    if (yyres)
 1088: 	      yyres[yyn] = '\0';
 1089: 	    return yyn;
 1090: 	  }
 1091:     do_not_strip_quotes: ;
 1092:     }
 1093: 
 1094:   if (! yyres)
 1095:     return yystrlen (yystr);
 1096: 
 1097:   return yystpcpy (yyres, yystr) - yyres;
 1098: }
 1099: # endif
 1100: 
 1101: /* Copy into YYRESULT an error message about the unexpected token
 1102:    YYCHAR while in state YYSTATE.  Return the number of bytes copied,
 1103:    including the terminating null byte.  If YYRESULT is null, do not
 1104:    copy anything; just return the number of bytes that would be
 1105:    copied.  As a special case, return 0 if an ordinary "syntax error"
 1106:    message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
 1107:    size calculation.  */
 1108: static YYSIZE_T
 1109: yysyntax_error (char *yyresult, int yystate, int yychar)
 1110: {
 1111:   int yyn = yypact[yystate];
 1112: 
 1113:   if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
 1114:     return 0;
 1115:   else
 1116:     {
 1117:       int yytype = YYTRANSLATE (yychar);
 1118:       YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
 1119:       YYSIZE_T yysize = yysize0;
 1120:       YYSIZE_T yysize1;
 1121:       int yysize_overflow = 0;
 1122:       enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
 1123:       char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
 1124:       int yyx;
 1125: 
 1126: # if 0
 1127:       /* This is so xgettext sees the translatable formats that are
 1128: 	 constructed on the fly.  */
 1129:       YY_("syntax error, unexpected %s");
 1130:       YY_("syntax error, unexpected %s, expecting %s");
 1131:       YY_("syntax error, unexpected %s, expecting %s or %s");
 1132:       YY_("syntax error, unexpected %s, expecting %s or %s or %s");
 1133:       YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
 1134: # endif
 1135:       char *yyfmt;
 1136:       char const *yyf;
 1137:       static char const yyunexpected[] = "syntax error, unexpected %s";
 1138:       static char const yyexpecting[] = ", expecting %s";
 1139:       static char const yyor[] = " or %s";
 1140:       char yyformat[sizeof yyunexpected
 1141: 		    + sizeof yyexpecting - 1
 1142: 		    + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
 1143: 		       * (sizeof yyor - 1))];
 1144:       char const *yyprefix = yyexpecting;
 1145: 
 1146:       /* Start YYX at -YYN if negative to avoid negative indexes in
 1147: 	 YYCHECK.  */
 1148:       int yyxbegin = yyn < 0 ? -yyn : 0;
 1149: 
 1150:       /* Stay within bounds of both yycheck and yytname.  */
 1151:       int yychecklim = YYLAST - yyn + 1;
 1152:       int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
 1153:       int yycount = 1;
 1154: 
 1155:       yyarg[0] = yytname[yytype];
 1156:       yyfmt = yystpcpy (yyformat, yyunexpected);
 1157: 
 1158:       for (yyx = yyxbegin; yyx < yyxend; ++yyx)
 1159: 	if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
 1160: 	  {
 1161: 	    if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
 1162: 	      {
 1163: 		yycount = 1;
 1164: 		yysize = yysize0;
 1165: 		yyformat[sizeof yyunexpected - 1] = '\0';
 1166: 		break;
 1167: 	      }
 1168: 	    yyarg[yycount++] = yytname[yyx];
 1169: 	    yysize1 = yysize + yytnamerr (0, yytname[yyx]);
 1170: 	    yysize_overflow |= (yysize1 < yysize);
 1171: 	    yysize = yysize1;
 1172: 	    yyfmt = yystpcpy (yyfmt, yyprefix);
 1173: 	    yyprefix = yyor;
 1174: 	  }
 1175: 
 1176:       yyf = YY_(yyformat);
 1177:       yysize1 = yysize + yystrlen (yyf);
 1178:       yysize_overflow |= (yysize1 < yysize);
 1179:       yysize = yysize1;
 1180: 
 1181:       if (yysize_overflow)
 1182: 	return YYSIZE_MAXIMUM;
 1183: 
 1184:       if (yyresult)
 1185: 	{
 1186: 	  /* Avoid sprintf, as that infringes on the user's name space.
 1187: 	     Don't have undefined behavior even if the translation
 1188: 	     produced a string with the wrong number of "%s"s.  */
 1189: 	  char *yyp = yyresult;
 1190: 	  int yyi = 0;
 1191: 	  while ((*yyp = *yyf) != '\0')
 1192: 	    {
 1193: 	      if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
 1194: 		{
 1195: 		  yyp += yytnamerr (yyp, yyarg[yyi++]);
 1196: 		  yyf += 2;
 1197: 		}
 1198: 	      else
 1199: 		{
 1200: 		  yyp++;
 1201: 		  yyf++;
 1202: 		}
 1203: 	    }
 1204: 	}
 1205:       return yysize;
 1206:     }
 1207: }
 1208: #endif /* YYERROR_VERBOSE */
 1209: 
 1210: 
 1211: /*-----------------------------------------------.
 1212: | Release the memory associated to this symbol.  |
 1213: `-----------------------------------------------*/
 1214: 
 1215: /*ARGSUSED*/
 1216: #if (defined __STDC__ || defined __C99__FUNC__ \
 1217:      || defined __cplusplus || defined _MSC_VER)
 1218: static void
 1219: yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
 1220: #else
 1221: static void
 1222: yydestruct (yymsg, yytype, yyvaluep)
 1223:     const char *yymsg;
 1224:     int yytype;
 1225:     YYSTYPE *yyvaluep;
 1226: #endif
 1227: {
 1228:   YYUSE (yyvaluep);
 1229: 
 1230:   if (!yymsg)
 1231:     yymsg = "Deleting";
 1232:   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
 1233: 
 1234:   switch (yytype)
 1235:     {
 1236: 
 1237:       default:
 1238: 	break;
 1239:     }
 1240: }
 1241: 
 1242: /* Prevent warnings from -Wmissing-prototypes.  */
 1243: #ifdef YYPARSE_PARAM
 1244: #if defined __STDC__ || defined __cplusplus
 1245: int yyparse (void *YYPARSE_PARAM);
 1246: #else
 1247: int yyparse ();
 1248: #endif
 1249: #else /* ! YYPARSE_PARAM */
 1250: #if defined __STDC__ || defined __cplusplus
 1251: int yyparse (void);
 1252: #else
 1253: int yyparse ();
 1254: #endif
 1255: #endif /* ! YYPARSE_PARAM */
 1256: 
 1257: 
 1258: /* The lookahead symbol.  */
 1259: int yychar;
 1260: 
 1261: /* The semantic value of the lookahead symbol.  */
 1262: YYSTYPE yylval;
 1263: 
 1264: /* Number of syntax errors so far.  */
 1265: int yynerrs;
 1266: 
 1267: 
 1268: 
 1269: /*-------------------------.
 1270: | yyparse or yypush_parse.  |
 1271: `-------------------------*/
 1272: 
 1273: #ifdef YYPARSE_PARAM
 1274: #if (defined __STDC__ || defined __C99__FUNC__ \
 1275:      || defined __cplusplus || defined _MSC_VER)
 1276: int
 1277: yyparse (void *YYPARSE_PARAM)
 1278: #else
 1279: int
 1280: yyparse (YYPARSE_PARAM)
 1281:     void *YYPARSE_PARAM;
 1282: #endif
 1283: #else /* ! YYPARSE_PARAM */
 1284: #if (defined __STDC__ || defined __C99__FUNC__ \
 1285:      || defined __cplusplus || defined _MSC_VER)
 1286: int
 1287: yyparse (void)
 1288: #else
 1289: int
 1290: yyparse ()
 1291: 
 1292: #endif
 1293: #endif
 1294: {
 1295: 
 1296: 
 1297:     int yystate;
 1298:     /* Number of tokens to shift before error messages enabled.  */
 1299:     int yyerrstatus;
 1300: 
 1301:     /* The stacks and their tools:
 1302:        `yyss': related to states.
 1303:        `yyvs': related to semantic values.
 1304: 
 1305:        Refer to the stacks thru separate pointers, to allow yyoverflow
 1306:        to reallocate them elsewhere.  */
 1307: 
 1308:     /* The state stack.  */
 1309:     yytype_int16 yyssa[YYINITDEPTH];
 1310:     yytype_int16 *yyss;
 1311:     yytype_int16 *yyssp;
 1312: 
 1313:     /* The semantic value stack.  */
 1314:     YYSTYPE yyvsa[YYINITDEPTH];
 1315:     YYSTYPE *yyvs;
 1316:     YYSTYPE *yyvsp;
 1317: 
 1318:     YYSIZE_T yystacksize;
 1319: 
 1320:   int yyn;
 1321:   int yyresult;
 1322:   /* Lookahead token as an internal (translated) token number.  */
 1323:   int yytoken;
 1324:   /* The variables used to return semantic value and location from the
 1325:      action routines.  */
 1326:   YYSTYPE yyval;
 1327: 
 1328: #if YYERROR_VERBOSE
 1329:   /* Buffer for error messages, and its allocated size.  */
 1330:   char yymsgbuf[128];
 1331:   char *yymsg = yymsgbuf;
 1332:   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
 1333: #endif
 1334: 
 1335: #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
 1336: 
 1337:   /* The number of symbols on the RHS of the reduced rule.
 1338:      Keep to zero when no symbol should be popped.  */
 1339:   int yylen = 0;
 1340: 
 1341:   yytoken = 0;
 1342:   yyss = yyssa;
 1343:   yyvs = yyvsa;
 1344:   yystacksize = YYINITDEPTH;
 1345: 
 1346:   YYDPRINTF ((stderr, "Starting parse\n"));
 1347: 
 1348:   yystate = 0;
 1349:   yyerrstatus = 0;
 1350:   yynerrs = 0;
 1351:   yychar = YYEMPTY; /* Cause a token to be read.  */
 1352: 
 1353:   /* Initialize stack pointers.
 1354:      Waste one element of value and location stack
 1355:      so that they stay on the same level as the state stack.
 1356:      The wasted elements are never initialized.  */
 1357:   yyssp = yyss;
 1358:   yyvsp = yyvs;
 1359: 
 1360:   goto yysetstate;
 1361: 
 1362: /*------------------------------------------------------------.
 1363: | yynewstate -- Push a new state, which is found in yystate.  |
 1364: `------------------------------------------------------------*/
 1365:  yynewstate:
 1366:   /* In all cases, when you get here, the value and location stacks
 1367:      have just been pushed.  So pushing a state here evens the stacks.  */
 1368:   yyssp++;
 1369: 
 1370:  yysetstate:
 1371:   *yyssp = yystate;
 1372: 
 1373:   if (yyss + yystacksize - 1 <= yyssp)
 1374:     {
 1375:       /* Get the current used size of the three stacks, in elements.  */
 1376:       YYSIZE_T yysize = yyssp - yyss + 1;
 1377: 
 1378: #ifdef yyoverflow
 1379:       {
 1380: 	/* Give user a chance to reallocate the stack.  Use copies of
 1381: 	   these so that the &'s don't force the real ones into
 1382: 	   memory.  */
 1383: 	YYSTYPE *yyvs1 = yyvs;
 1384: 	yytype_int16 *yyss1 = yyss;
 1385: 
 1386: 	/* Each stack pointer address is followed by the size of the
 1387: 	   data in use in that stack, in bytes.  This used to be a
 1388: 	   conditional around just the two extra args, but that might
 1389: 	   be undefined if yyoverflow is a macro.  */
 1390: 	yyoverflow (YY_("memory exhausted"),
 1391: 		    &yyss1, yysize * sizeof (*yyssp),
 1392: 		    &yyvs1, yysize * sizeof (*yyvsp),
 1393: 		    &yystacksize);
 1394: 
 1395: 	yyss = yyss1;
 1396: 	yyvs = yyvs1;
 1397:       }
 1398: #else /* no yyoverflow */
 1399: # ifndef YYSTACK_RELOCATE
 1400:       goto yyexhaustedlab;
 1401: # else
 1402:       /* Extend the stack our own way.  */
 1403:       if (YYMAXDEPTH <= yystacksize)
 1404: 	goto yyexhaustedlab;
 1405:       yystacksize *= 2;
 1406:       if (YYMAXDEPTH < yystacksize)
 1407: 	yystacksize = YYMAXDEPTH;
 1408: 
 1409:       {
 1410: 	yytype_int16 *yyss1 = yyss;
 1411: 	union yyalloc *yyptr =
 1412: 	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
 1413: 	if (! yyptr)
 1414: 	  goto yyexhaustedlab;
 1415: 	YYSTACK_RELOCATE (yyss_alloc, yyss);
 1416: 	YYSTACK_RELOCATE (yyvs_alloc, yyvs);
 1417: #  undef YYSTACK_RELOCATE
 1418: 	if (yyss1 != yyssa)
 1419: 	  YYSTACK_FREE (yyss1);
 1420:       }
 1421: # endif
 1422: #endif /* no yyoverflow */
 1423: 
 1424:       yyssp = yyss + yysize - 1;
 1425:       yyvsp = yyvs + yysize - 1;
 1426: 
 1427:       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
 1428: 		  (unsigned long int) yystacksize));
 1429: 
 1430:       if (yyss + yystacksize - 1 <= yyssp)
 1431: 	YYABORT;
 1432:     }
 1433: 
 1434:   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
 1435: 
 1436:   if (yystate == YYFINAL)
 1437:     YYACCEPT;
 1438: 
 1439:   goto yybackup;
 1440: 
 1441: /*-----------.
 1442: | yybackup.  |
 1443: `-----------*/
 1444: yybackup:
 1445: 
 1446:   /* Do appropriate processing given the current state.  Read a
 1447:      lookahead token if we need one and don't already have one.  */
 1448: 
 1449:   /* First try to decide what to do without reference to lookahead token.  */
 1450:   yyn = yypact[yystate];
 1451:   if (yyn == YYPACT_NINF)
 1452:     goto yydefault;
 1453: 
 1454:   /* Not known => get a lookahead token if don't already have one.  */
 1455: 
 1456:   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
 1457:   if (yychar == YYEMPTY)
 1458:     {
 1459:       YYDPRINTF ((stderr, "Reading a token: "));
 1460:       yychar = YYLEX;
 1461:     }
 1462: 
 1463:   if (yychar <= YYEOF)
 1464:     {
 1465:       yychar = yytoken = YYEOF;
 1466:       YYDPRINTF ((stderr, "Now at end of input.\n"));
 1467:     }
 1468:   else
 1469:     {
 1470:       yytoken = YYTRANSLATE (yychar);
 1471:       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
 1472:     }
 1473: 
 1474:   /* If the proper action on seeing token YYTOKEN is to reduce or to
 1475:      detect an error, take that action.  */
 1476:   yyn += yytoken;
 1477:   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
 1478:     goto yydefault;
 1479:   yyn = yytable[yyn];
 1480:   if (yyn <= 0)
 1481:     {
 1482:       if (yyn == 0 || yyn == YYTABLE_NINF)
 1483: 	goto yyerrlab;
 1484:       yyn = -yyn;
 1485:       goto yyreduce;
 1486:     }
 1487: 
 1488:   /* Count tokens shifted since error; after three, turn off error
 1489:      status.  */
 1490:   if (yyerrstatus)
 1491:     yyerrstatus--;
 1492: 
 1493:   /* Shift the lookahead token.  */
 1494:   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
 1495: 
 1496:   /* Discard the shifted token.  */
 1497:   yychar = YYEMPTY;
 1498: 
 1499:   yystate = yyn;
 1500:   *++yyvsp = yylval;
 1501: 
 1502:   goto yynewstate;
 1503: 
 1504: 
 1505: /*-----------------------------------------------------------.
 1506: | yydefault -- do the default action for the current state.  |
 1507: `-----------------------------------------------------------*/
 1508: yydefault:
 1509:   yyn = yydefact[yystate];
 1510:   if (yyn == 0)
 1511:     goto yyerrlab;
 1512:   goto yyreduce;
 1513: 
 1514: 
 1515: /*-----------------------------.
 1516: | yyreduce -- Do a reduction.  |
 1517: `-----------------------------*/
 1518: yyreduce:
 1519:   /* yyn is the number of a rule to reduce with.  */
 1520:   yylen = yyr2[yyn];
 1521: 
 1522:   /* If YYLEN is nonzero, implement the default value of the action:
 1523:      `$$ = $1'.
 1524: 
 1525:      Otherwise, the following line sets YYVAL to garbage.
 1526:      This behavior is undocumented and Bison
 1527:      users should not rely upon it.  Assigning to YYVAL
 1528:      unconditionally makes the parser a bit smaller, and it avoids a
 1529:      GCC warning that YYVAL may be used uninitialized.  */
 1530:   yyval = yyvsp[1-yylen];
 1531: 
 1532: 
 1533:   YY_REDUCE_PRINT (yyn);
 1534:   switch (yyn)
 1535:     {
 1536:         case 4:
 1537: 
 1538: /* Line 1455 of yacc.c  */
 1539: #line 161 "prsa_par.y"
 1540:     {
 1541: 		rsa_key_insert(prsa_cur_list, (yyvsp[(1) - (4)].naddr), (yyvsp[(2) - (4)].naddr), (yyvsp[(4) - (4)].rsa));
 1542: 	}
 1543:     break;
 1544: 
 1545:   case 5:
 1546: 
 1547: /* Line 1455 of yacc.c  */
 1548: #line 165 "prsa_par.y"
 1549:     {
 1550: 		rsa_key_insert(prsa_cur_list, NULL, (yyvsp[(1) - (3)].naddr), (yyvsp[(3) - (3)].rsa));
 1551: 	}
 1552:     break;
 1553: 
 1554:   case 6:
 1555: 
 1556: /* Line 1455 of yacc.c  */
 1557: #line 169 "prsa_par.y"
 1558:     {
 1559: 		rsa_key_insert(prsa_cur_list, NULL, NULL, (yyvsp[(2) - (2)].rsa));
 1560: 	}
 1561:     break;
 1562: 
 1563:   case 7:
 1564: 
 1565: /* Line 1455 of yacc.c  */
 1566: #line 176 "prsa_par.y"
 1567:     {
 1568: 		if (prsa_cur_type == RSA_TYPE_PUBLIC) {
 1569: 			prsawarning("Using private key for public key purpose.\n");
 1570: 			if (!rsa_cur->n || !rsa_cur->e) {
 1571: 				prsaerror("Incomplete key. Mandatory parameters are missing!\n");
 1572: 				YYABORT;
 1573: 			}
 1574: 		}
 1575: 		else {
 1576: 			if (!rsa_cur->n || !rsa_cur->e || !rsa_cur->d) {
 1577: 				prsaerror("Incomplete key. Mandatory parameters are missing!\n");
 1578: 				YYABORT;
 1579: 			}
 1580: 			if (!rsa_cur->p || !rsa_cur->q || !rsa_cur->dmp1
 1581: 			    || !rsa_cur->dmq1 || !rsa_cur->iqmp) {
 1582: 				if (rsa_cur->p) BN_clear_free(rsa_cur->p);
 1583: 				if (rsa_cur->q) BN_clear_free(rsa_cur->q);
 1584: 				if (rsa_cur->dmp1) BN_clear_free(rsa_cur->dmp1);
 1585: 				if (rsa_cur->dmq1) BN_clear_free(rsa_cur->dmq1);
 1586: 				if (rsa_cur->iqmp) BN_clear_free(rsa_cur->iqmp);
 1587: 
 1588: 				rsa_cur->p = NULL;
 1589: 				rsa_cur->q = NULL;
 1590: 				rsa_cur->dmp1 = NULL;
 1591: 				rsa_cur->dmq1 = NULL;
 1592: 				rsa_cur->iqmp = NULL;
 1593: 			}
 1594: 		}
 1595: 		(yyval.rsa) = rsa_cur;
 1596: 		rsa_cur = RSA_new();
 1597: 	}
 1598:     break;
 1599: 
 1600:   case 8:
 1601: 
 1602: /* Line 1455 of yacc.c  */
 1603: #line 208 "prsa_par.y"
 1604:     {
 1605: 		if (prsa_cur_type == RSA_TYPE_PRIVATE) {
 1606: 			prsaerror("Public key in private-key file!\n");
 1607: 			YYABORT;
 1608: 		}
 1609: 		(yyval.rsa) = base64_pubkey2rsa((yyvsp[(2) - (2)].chr));
 1610: 		free((yyvsp[(2) - (2)].chr));
 1611: 	}
 1612:     break;
 1613: 
 1614:   case 9:
 1615: 
 1616: /* Line 1455 of yacc.c  */
 1617: #line 217 "prsa_par.y"
 1618:     {
 1619: 		if (prsa_cur_type == RSA_TYPE_PRIVATE) {
 1620: 			prsaerror("Public key in private-key file!\n");
 1621: 			YYABORT;
 1622: 		}
 1623: 		(yyval.rsa) = bignum_pubkey2rsa((yyvsp[(2) - (2)].bn));
 1624: 	}
 1625:     break;
 1626: 
 1627:   case 12:
 1628: 
 1629: /* Line 1455 of yacc.c  */
 1630: #line 230 "prsa_par.y"
 1631:     {
 1632: 		(yyval.naddr) = NULL;
 1633: 	}
 1634:     break;
 1635: 
 1636:   case 13:
 1637: 
 1638: /* Line 1455 of yacc.c  */
 1639: #line 237 "prsa_par.y"
 1640:     {
 1641: 		int err;
 1642: 		struct sockaddr_in *sap;
 1643: 		struct addrinfo hints, *res;
 1644: 		
 1645: 		if ((yyvsp[(2) - (2)].num) == -1) (yyvsp[(2) - (2)].num) = 32;
 1646: 		if ((yyvsp[(2) - (2)].num) < 0 || (yyvsp[(2) - (2)].num) > 32) {
 1647: 			prsaerror ("Invalid IPv4 prefix\n");
 1648: 			YYABORT;
 1649: 		}
 1650: 		(yyval.naddr) = calloc (sizeof(struct netaddr), 1);
 1651: 		(yyval.naddr)->prefix = (yyvsp[(2) - (2)].num);
 1652: 		sap = (struct sockaddr_in *)(&(yyval.naddr)->sa);
 1653: 		memset(&hints, 0, sizeof(hints));
 1654: 		hints.ai_family = AF_INET;
 1655: 		hints.ai_flags = AI_NUMERICHOST;
 1656: 		err = getaddrinfo((yyvsp[(1) - (2)].chr), NULL, &hints, &res);
 1657: 		if (err < 0) {
 1658: 			prsaerror("getaddrinfo(%s): %s\n", (yyvsp[(1) - (2)].chr), gai_strerror(err));
 1659: 			YYABORT;
 1660: 		}
 1661: 		memcpy(sap, res->ai_addr, res->ai_addrlen);
 1662: 		freeaddrinfo(res);
 1663: 		free((yyvsp[(1) - (2)].chr));
 1664: 	}
 1665:     break;
 1666: 
 1667:   case 14:
 1668: 
 1669: /* Line 1455 of yacc.c  */
 1670: #line 266 "prsa_par.y"
 1671:     {
 1672: 		int err;
 1673: 		struct sockaddr_in6 *sap;
 1674: 		struct addrinfo hints, *res;
 1675: 		
 1676: 		if ((yyvsp[(2) - (2)].num) == -1) (yyvsp[(2) - (2)].num) = 128;
 1677: 		if ((yyvsp[(2) - (2)].num) < 0 || (yyvsp[(2) - (2)].num) > 128) {
 1678: 			prsaerror ("Invalid IPv6 prefix\n");
 1679: 			YYABORT;
 1680: 		}
 1681: 		(yyval.naddr) = calloc (sizeof(struct netaddr), 1);
 1682: 		(yyval.naddr)->prefix = (yyvsp[(2) - (2)].num);
 1683: 		sap = (struct sockaddr_in6 *)(&(yyval.naddr)->sa);
 1684: 		memset(&hints, 0, sizeof(hints));
 1685: 		hints.ai_family = AF_INET6;
 1686: 		hints.ai_flags = AI_NUMERICHOST;
 1687: 		err = getaddrinfo((yyvsp[(1) - (2)].chr), NULL, &hints, &res);
 1688: 		if (err < 0) {
 1689: 			prsaerror("getaddrinfo(%s): %s\n", (yyvsp[(1) - (2)].chr), gai_strerror(err));
 1690: 			YYABORT;
 1691: 		}
 1692: 		memcpy(sap, res->ai_addr, res->ai_addrlen);
 1693: 		freeaddrinfo(res);
 1694: 		free((yyvsp[(1) - (2)].chr));
 1695: 	}
 1696:     break;
 1697: 
 1698:   case 15:
 1699: 
 1700: /* Line 1455 of yacc.c  */
 1701: #line 294 "prsa_par.y"
 1702:     { (yyval.num) = -1; }
 1703:     break;
 1704: 
 1705:   case 16:
 1706: 
 1707: /* Line 1455 of yacc.c  */
 1708: #line 295 "prsa_par.y"
 1709:     { (yyval.num) = (yyvsp[(2) - (2)].num); }
 1710:     break;
 1711: 
 1712:   case 19:
 1713: 
 1714: /* Line 1455 of yacc.c  */
 1715: #line 304 "prsa_par.y"
 1716:     { if (!rsa_cur->n) rsa_cur->n = (yyvsp[(3) - (3)].bn); else { prsaerror ("Modulus already defined\n"); YYABORT; } }
 1717:     break;
 1718: 
 1719:   case 20:
 1720: 
 1721: /* Line 1455 of yacc.c  */
 1722: #line 306 "prsa_par.y"
 1723:     { if (!rsa_cur->e) rsa_cur->e = (yyvsp[(3) - (3)].bn); else { prsaerror ("PublicExponent already defined\n"); YYABORT; } }
 1724:     break;
 1725: 
 1726:   case 21:
 1727: 
 1728: /* Line 1455 of yacc.c  */
 1729: #line 308 "prsa_par.y"
 1730:     { if (!rsa_cur->d) rsa_cur->d = (yyvsp[(3) - (3)].bn); else { prsaerror ("PrivateExponent already defined\n"); YYABORT; } }
 1731:     break;
 1732: 
 1733:   case 22:
 1734: 
 1735: /* Line 1455 of yacc.c  */
 1736: #line 310 "prsa_par.y"
 1737:     { if (!rsa_cur->p) rsa_cur->p = (yyvsp[(3) - (3)].bn); else { prsaerror ("Prime1 already defined\n"); YYABORT; } }
 1738:     break;
 1739: 
 1740:   case 23:
 1741: 
 1742: /* Line 1455 of yacc.c  */
 1743: #line 312 "prsa_par.y"
 1744:     { if (!rsa_cur->q) rsa_cur->q = (yyvsp[(3) - (3)].bn); else { prsaerror ("Prime2 already defined\n"); YYABORT; } }
 1745:     break;
 1746: 
 1747:   case 24:
 1748: 
 1749: /* Line 1455 of yacc.c  */
 1750: #line 314 "prsa_par.y"
 1751:     { if (!rsa_cur->dmp1) rsa_cur->dmp1 = (yyvsp[(3) - (3)].bn); else { prsaerror ("Exponent1 already defined\n"); YYABORT; } }
 1752:     break;
 1753: 
 1754:   case 25:
 1755: 
 1756: /* Line 1455 of yacc.c  */
 1757: #line 316 "prsa_par.y"
 1758:     { if (!rsa_cur->dmq1) rsa_cur->dmq1 = (yyvsp[(3) - (3)].bn); else { prsaerror ("Exponent2 already defined\n"); YYABORT; } }
 1759:     break;
 1760: 
 1761:   case 26:
 1762: 
 1763: /* Line 1455 of yacc.c  */
 1764: #line 318 "prsa_par.y"
 1765:     { if (!rsa_cur->iqmp) rsa_cur->iqmp = (yyvsp[(3) - (3)].bn); else { prsaerror ("Coefficient already defined\n"); YYABORT; } }
 1766:     break;
 1767: 
 1768: 
 1769: 
 1770: /* Line 1455 of yacc.c  */
 1771: #line 1772 "prsa_par.c"
 1772:       default: break;
 1773:     }
 1774:   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
 1775: 
 1776:   YYPOPSTACK (yylen);
 1777:   yylen = 0;
 1778:   YY_STACK_PRINT (yyss, yyssp);
 1779: 
 1780:   *++yyvsp = yyval;
 1781: 
 1782:   /* Now `shift' the result of the reduction.  Determine what state
 1783:      that goes to, based on the state we popped back to and the rule
 1784:      number reduced by.  */
 1785: 
 1786:   yyn = yyr1[yyn];
 1787: 
 1788:   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
 1789:   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
 1790:     yystate = yytable[yystate];
 1791:   else
 1792:     yystate = yydefgoto[yyn - YYNTOKENS];
 1793: 
 1794:   goto yynewstate;
 1795: 
 1796: 
 1797: /*------------------------------------.
 1798: | yyerrlab -- here on detecting error |
 1799: `------------------------------------*/
 1800: yyerrlab:
 1801:   /* If not already recovering from an error, report this error.  */
 1802:   if (!yyerrstatus)
 1803:     {
 1804:       ++yynerrs;
 1805: #if ! YYERROR_VERBOSE
 1806:       yyerror (YY_("syntax error"));
 1807: #else
 1808:       {
 1809: 	YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
 1810: 	if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
 1811: 	  {
 1812: 	    YYSIZE_T yyalloc = 2 * yysize;
 1813: 	    if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
 1814: 	      yyalloc = YYSTACK_ALLOC_MAXIMUM;
 1815: 	    if (yymsg != yymsgbuf)
 1816: 	      YYSTACK_FREE (yymsg);
 1817: 	    yymsg = (char *) YYSTACK_ALLOC (yyalloc);
 1818: 	    if (yymsg)
 1819: 	      yymsg_alloc = yyalloc;
 1820: 	    else
 1821: 	      {
 1822: 		yymsg = yymsgbuf;
 1823: 		yymsg_alloc = sizeof yymsgbuf;
 1824: 	      }
 1825: 	  }
 1826: 
 1827: 	if (0 < yysize && yysize <= yymsg_alloc)
 1828: 	  {
 1829: 	    (void) yysyntax_error (yymsg, yystate, yychar);
 1830: 	    yyerror (yymsg);
 1831: 	  }
 1832: 	else
 1833: 	  {
 1834: 	    yyerror (YY_("syntax error"));
 1835: 	    if (yysize != 0)
 1836: 	      goto yyexhaustedlab;
 1837: 	  }
 1838:       }
 1839: #endif
 1840:     }
 1841: 
 1842: 
 1843: 
 1844:   if (yyerrstatus == 3)
 1845:     {
 1846:       /* If just tried and failed to reuse lookahead token after an
 1847: 	 error, discard it.  */
 1848: 
 1849:       if (yychar <= YYEOF)
 1850: 	{
 1851: 	  /* Return failure if at end of input.  */
 1852: 	  if (yychar == YYEOF)
 1853: 	    YYABORT;
 1854: 	}
 1855:       else
 1856: 	{
 1857: 	  yydestruct ("Error: discarding",
 1858: 		      yytoken, &yylval);
 1859: 	  yychar = YYEMPTY;
 1860: 	}
 1861:     }
 1862: 
 1863:   /* Else will try to reuse lookahead token after shifting the error
 1864:      token.  */
 1865:   goto yyerrlab1;
 1866: 
 1867: 
 1868: /*---------------------------------------------------.
 1869: | yyerrorlab -- error raised explicitly by YYERROR.  |
 1870: `---------------------------------------------------*/
 1871: yyerrorlab:
 1872: 
 1873:   /* Pacify compilers like GCC when the user code never invokes
 1874:      YYERROR and the label yyerrorlab therefore never appears in user
 1875:      code.  */
 1876:   if (/*CONSTCOND*/ 0)
 1877:      goto yyerrorlab;
 1878: 
 1879:   /* Do not reclaim the symbols of the rule which action triggered
 1880:      this YYERROR.  */
 1881:   YYPOPSTACK (yylen);
 1882:   yylen = 0;
 1883:   YY_STACK_PRINT (yyss, yyssp);
 1884:   yystate = *yyssp;
 1885:   goto yyerrlab1;
 1886: 
 1887: 
 1888: /*-------------------------------------------------------------.
 1889: | yyerrlab1 -- common code for both syntax error and YYERROR.  |
 1890: `-------------------------------------------------------------*/
 1891: yyerrlab1:
 1892:   yyerrstatus = 3;	/* Each real token shifted decrements this.  */
 1893: 
 1894:   for (;;)
 1895:     {
 1896:       yyn = yypact[yystate];
 1897:       if (yyn != YYPACT_NINF)
 1898: 	{
 1899: 	  yyn += YYTERROR;
 1900: 	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
 1901: 	    {
 1902: 	      yyn = yytable[yyn];
 1903: 	      if (0 < yyn)
 1904: 		break;
 1905: 	    }
 1906: 	}
 1907: 
 1908:       /* Pop the current state because it cannot handle the error token.  */
 1909:       if (yyssp == yyss)
 1910: 	YYABORT;
 1911: 
 1912: 
 1913:       yydestruct ("Error: popping",
 1914: 		  yystos[yystate], yyvsp);
 1915:       YYPOPSTACK (1);
 1916:       yystate = *yyssp;
 1917:       YY_STACK_PRINT (yyss, yyssp);
 1918:     }
 1919: 
 1920:   *++yyvsp = yylval;
 1921: 
 1922: 
 1923:   /* Shift the error token.  */
 1924:   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
 1925: 
 1926:   yystate = yyn;
 1927:   goto yynewstate;
 1928: 
 1929: 
 1930: /*-------------------------------------.
 1931: | yyacceptlab -- YYACCEPT comes here.  |
 1932: `-------------------------------------*/
 1933: yyacceptlab:
 1934:   yyresult = 0;
 1935:   goto yyreturn;
 1936: 
 1937: /*-----------------------------------.
 1938: | yyabortlab -- YYABORT comes here.  |
 1939: `-----------------------------------*/
 1940: yyabortlab:
 1941:   yyresult = 1;
 1942:   goto yyreturn;
 1943: 
 1944: #if !defined(yyoverflow) || YYERROR_VERBOSE
 1945: /*-------------------------------------------------.
 1946: | yyexhaustedlab -- memory exhaustion comes here.  |
 1947: `-------------------------------------------------*/
 1948: yyexhaustedlab:
 1949:   yyerror (YY_("memory exhausted"));
 1950:   yyresult = 2;
 1951:   /* Fall through.  */
 1952: #endif
 1953: 
 1954: yyreturn:
 1955:   if (yychar != YYEMPTY)
 1956:      yydestruct ("Cleanup: discarding lookahead",
 1957: 		 yytoken, &yylval);
 1958:   /* Do not reclaim the symbols of the rule which action triggered
 1959:      this YYABORT or YYACCEPT.  */
 1960:   YYPOPSTACK (yylen);
 1961:   YY_STACK_PRINT (yyss, yyssp);
 1962:   while (yyssp != yyss)
 1963:     {
 1964:       yydestruct ("Cleanup: popping",
 1965: 		  yystos[*yyssp], yyvsp);
 1966:       YYPOPSTACK (1);
 1967:     }
 1968: #ifndef yyoverflow
 1969:   if (yyss != yyssa)
 1970:     YYSTACK_FREE (yyss);
 1971: #endif
 1972: #if YYERROR_VERBOSE
 1973:   if (yymsg != yymsgbuf)
 1974:     YYSTACK_FREE (yymsg);
 1975: #endif
 1976:   /* Make sure YYID is used.  */
 1977:   return YYID (yyresult);
 1978: }
 1979: 
 1980: 
 1981: 
 1982: /* Line 1675 of yacc.c  */
 1983: #line 320 "prsa_par.y"
 1984: 
 1985: 
 1986: int prsaparse(void);
 1987: 
 1988: int
 1989: prsa_parse_file(struct genlist *list, char *fname, enum rsa_key_type type)
 1990: {
 1991: 	FILE *fp = NULL;
 1992: 	int ret;
 1993: 	
 1994: 	if (!fname)
 1995: 		return -1;
 1996: 	if (type == RSA_TYPE_PRIVATE) {
 1997: 		struct stat st;
 1998: 		if (stat(fname, &st) < 0)
 1999: 			return -1;
 2000: 		if (st.st_mode & (S_IRWXG | S_IRWXO)) {
 2001: 			plog(LLV_ERROR, LOCATION, NULL,
 2002: 				"Too slack permissions on private key '%s'\n", 
 2003: 				fname);
 2004: 			plog(LLV_ERROR, LOCATION, NULL,
 2005: 				"Should be at most 0600, now is 0%o\n",
 2006: 				st.st_mode & 0777);
 2007: 			return -1;
 2008: 		}
 2009: 	}
 2010: 	fp = fopen(fname, "r");
 2011: 	if (!fp)
 2012: 		return -1;
 2013: 	prsain = fp;
 2014: 	prsa_cur_lineno = 1;
 2015: 	prsa_cur_fname = fname;
 2016: 	prsa_cur_list = list;
 2017: 	prsa_cur_type = type;
 2018: 	rsa_cur = RSA_new();
 2019: 	ret = prsaparse();
 2020: 	if (rsa_cur) {
 2021: 		RSA_free(rsa_cur);
 2022: 		rsa_cur = NULL;
 2023: 	}
 2024: 	fclose (fp);
 2025: 	prsain = NULL;
 2026: 	return ret;
 2027: }
 2028: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>