libksba
1.6.0
About: KSBA is a library to make the tasks of working with X.509 certificates, CMS data and related objects more easy.
![]() ![]() |
#include <config.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include "util.h"
#include "ksba.h"
#include "asn1-func.h"
#include <stddef.h>
Go to the source code of this file.
Data Structures | |
struct | parser_control_s |
union | YYSTYPE |
union | yyalloc |
Macros | |
#define | YYBISON 1 |
#define | YYBISON_VERSION "3.3.2" |
#define | YYSKELETON_NAME "yacc.c" |
#define | YYPURE 2 |
#define | YYPUSH 0 |
#define | YYPULL 1 |
#define | yyparse _ksba_asn1_yyparse |
#define | MAX_STRING_LENGTH 129 |
#define | YYPRINT(F, N, L) do { } while (0); |
#define | PARSECTL ((struct parser_control_s *)parm) |
#define | YY_NULLPTR ((void*)0) |
#define | YYERROR_VERBOSE 1 |
#define | YYDEBUG 0 |
#define | YYTOKENTYPE |
#define | YYSTYPE_IS_TRIVIAL 1 |
#define | YYSTYPE_IS_DECLARED 1 |
#define | NEW_NODE(a) (new_node (PARSECTL, (a))) |
#define | YYSIZE_T size_t |
#define | YYSIZE_MAXIMUM ((YYSIZE_T) -1) |
#define | YY_(Msgid) Msgid |
#define | YY_ATTRIBUTE(Spec) /* empty */ |
#define | YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) |
#define | YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) |
#define | YYUSE(E) ((void) (E)) |
#define | YY_INITIAL_VALUE(Value) Value |
#define | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
#define | YY_IGNORE_MAYBE_UNINITIALIZED_END |
#define | YYSTACK_ALLOC YYMALLOC |
#define | YYSTACK_FREE YYFREE |
#define | YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
#define | YYMALLOC malloc |
#define | YYFREE free |
#define | YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
#define | YYSTACK_BYTES(N) |
#define | YYCOPY_NEEDED 1 |
#define | YYSTACK_RELOCATE(Stack_alloc, Stack) |
#define | YYCOPY(Dst, Src, Count) |
#define | YYFINAL 2 |
#define | YYLAST 195 |
#define | YYNTOKENS 57 |
#define | YYNNTS 51 |
#define | YYNRULES 116 |
#define | YYNSTATES 203 |
#define | YYUNDEFTOK 2 |
#define | YYMAXUTOK 301 |
#define | YYTRANSLATE(YYX) ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
#define | YYPACT_NINF -137 |
#define | yypact_value_is_default(Yystate) (!!((Yystate) == (-137))) |
#define | YYTABLE_NINF -1 |
#define | yytable_value_is_error(Yytable_value) 0 |
#define | yyerrok (yyerrstatus = 0) |
#define | yyclearin (yychar = YYEMPTY) |
#define | YYEMPTY (-2) |
#define | YYEOF 0 |
#define | YYACCEPT goto yyacceptlab |
#define | YYABORT goto yyabortlab |
#define | YYERROR goto yyerrorlab |
#define | YYRECOVERING() (!!yyerrstatus) |
#define | YYBACKUP(Token, Value) |
#define | YYTERROR 1 |
#define | YYERRCODE 256 |
#define | YYDPRINTF(Args) |
#define | YY_SYMBOL_PRINT(Title, Type, Value, Location) |
#define | YY_STACK_PRINT(Bottom, Top) |
#define | YY_REDUCE_PRINT(Rule) |
#define | YYINITDEPTH 200 |
#define | YYMAXDEPTH 10000 |
#define | YYCASE_(N, S) |
#define | YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) |
#define | YYSYNTAX_ERROR |
Typedefs | |
typedef union YYSTYPE | YYSTYPE |
typedef unsigned char | yytype_uint8 |
typedef signed char | yytype_int8 |
typedef unsigned short | yytype_uint16 |
typedef short | yytype_int16 |
Enumerations | |
enum | { CONST_EXPLICIT = 1 , CONST_IMPLICIT } |
enum | yytokentype { ASSIG = 258 , NUM = 259 , IDENTIFIER = 260 , OPTIONAL = 261 , INTEGER = 262 , SIZE = 263 , OCTET = 264 , STRING = 265 , SEQUENCE = 266 , BIT = 267 , UNIVERSAL = 268 , PRIVATE = 269 , DEFAULT = 270 , CHOICE = 271 , OF = 272 , OBJECT = 273 , STR_IDENTIFIER = 274 , ksba_BOOLEAN = 275 , ksba_TRUE = 276 , ksba_FALSE = 277 , APPLICATION = 278 , ANY = 279 , DEFINED = 280 , SET = 281 , BY = 282 , EXPLICIT = 283 , IMPLICIT = 284 , DEFINITIONS = 285 , TAGS = 286 , ksba_BEGIN = 287 , ksba_END = 288 , UTCTime = 289 , GeneralizedTime = 290 , FROM = 291 , IMPORTS = 292 , TOKEN_NULL = 293 , ENUMERATED = 294 , UTF8STRING = 295 , NUMERICSTRING = 296 , PRINTABLESTRING = 297 , TELETEXSTRING = 298 , IA5STRING = 299 , UNIVERSALSTRING = 300 , BMPSTRING = 301 } |
Functions | |
int | _ksba_asn1_yyparse (void *parm) |
static AsnNode | new_node (struct parser_control_s *parsectl, node_type_t type) |
static void | set_name (AsnNode node, const char *name) |
static void | set_str_value (AsnNode node, const char *text) |
static void | set_ulong_value (AsnNode node, const char *text) |
static void | set_right (AsnNode node, AsnNode right) |
static void | append_right (AsnNode node, AsnNode right) |
static void | set_down (AsnNode node, AsnNode down) |
static int | yylex (YYSTYPE *lvalp, void *parm) |
static void | yyerror (void *parm, const char *s) |
void * | malloc (size_t) |
void | free (void *) |
static size_t | yystrlen (const char *yystr) |
static char * | yystpcpy (char *yydest, const char *yysrc) |
static size_t | yytnamerr (char *yyres, const char *yystr) |
static int | yysyntax_error (size_t *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) |
static void | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, void *parm) |
static void | release_all_nodes (AsnNode node) |
int | _ksba_asn_parse_file (const char *file_name, ksba_asn_tree_t *result, int debug) |
void | _ksba_asn_tree_release (ksba_asn_tree_t tree) |
void | _ksba_asn_release_nodes (AsnNode node) |
Variables | |
static const yytype_uint8 | yytranslate [] |
static const char *const | yytname [] |
static const yytype_uint16 | yytoknum [] |
static const yytype_int16 | yypact [] |
static const yytype_uint8 | yydefact [] |
static const yytype_int16 | yypgoto [] |
static const yytype_int16 | yydefgoto [] |
static const yytype_uint8 | yytable [] |
static const yytype_int16 | yycheck [] |
static const yytype_uint8 | yystos [] |
static const yytype_uint8 | yyr1 [] |
static const yytype_uint8 | yyr2 [] |
#define MAX_STRING_LENGTH 129 |
Definition at line 95 of file asn1-parse.c.
Definition at line 229 of file asn1-parse.c.
#define PARSECTL ((struct parser_control_s *)parm) |
Definition at line 115 of file asn1-parse.c.
#define YY_ | ( | Msgid | ) | Msgid |
Definition at line 294 of file asn1-parse.c.
#define YY_ATTRIBUTE | ( | Spec | ) | /* empty */ |
Definition at line 304 of file asn1-parse.c.
#define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) |
Definition at line 309 of file asn1-parse.c.
#define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) |
Definition at line 313 of file asn1-parse.c.
#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
Definition at line 335 of file asn1-parse.c.
#define YY_IGNORE_MAYBE_UNINITIALIZED_END |
Definition at line 336 of file asn1-parse.c.
#define YY_INITIAL_VALUE | ( | Value | ) | Value |
Definition at line 332 of file asn1-parse.c.
#define YY_NULLPTR ((void*)0) |
Definition at line 127 of file asn1-parse.c.
#define YY_REDUCE_PRINT | ( | Rule | ) |
Definition at line 957 of file asn1-parse.c.
#define YY_STACK_PRINT | ( | Bottom, | |
Top | |||
) |
Definition at line 956 of file asn1-parse.c.
#define YY_SYMBOL_PRINT | ( | Title, | |
Type, | |||
Value, | |||
Location | |||
) |
Definition at line 955 of file asn1-parse.c.
#define YYABORT goto yyabortlab |
Definition at line 801 of file asn1-parse.c.
#define YYACCEPT goto yyacceptlab |
Definition at line 800 of file asn1-parse.c.
#define YYBACKUP | ( | Token, | |
Value | |||
) |
Definition at line 807 of file asn1-parse.c.
#define YYBISON 1 |
Definition at line 48 of file asn1-parse.c.
#define YYBISON_VERSION "3.3.2" |
Definition at line 51 of file asn1-parse.c.
#define yyclearin (yychar = YYEMPTY) |
Definition at line 796 of file asn1-parse.c.
#define YYCOPY | ( | Dst, | |
Src, | |||
Count | |||
) |
Definition at line 459 of file asn1-parse.c.
#define YYCOPY_NEEDED 1 |
Definition at line 431 of file asn1-parse.c.
#define YYDEBUG 0 |
Definition at line 142 of file asn1-parse.c.
#define YYDPRINTF | ( | Args | ) |
Definition at line 954 of file asn1-parse.c.
#define YYEMPTY (-2) |
Definition at line 797 of file asn1-parse.c.
#define YYEOF 0 |
Definition at line 798 of file asn1-parse.c.
#define YYERRCODE 256 |
Definition at line 826 of file asn1-parse.c.
#define yyerrok (yyerrstatus = 0) |
Definition at line 795 of file asn1-parse.c.
#define YYERROR goto yyerrorlab |
Definition at line 802 of file asn1-parse.c.
#define YYERROR_VERBOSE 1 |
Definition at line 136 of file asn1-parse.c.
#define YYFINAL 2 |
Definition at line 472 of file asn1-parse.c.
#define YYFREE free |
Definition at line 402 of file asn1-parse.c.
#define YYINITDEPTH 200 |
Definition at line 963 of file asn1-parse.c.
#define YYLAST 195 |
Definition at line 474 of file asn1-parse.c.
#define YYMALLOC malloc |
Definition at line 396 of file asn1-parse.c.
#define YYMAXDEPTH 10000 |
Definition at line 974 of file asn1-parse.c.
#define YYMAXUTOK 301 |
Definition at line 486 of file asn1-parse.c.
#define YYNNTS 51 |
Definition at line 479 of file asn1-parse.c.
#define YYNRULES 116 |
Definition at line 481 of file asn1-parse.c.
#define YYNSTATES 203 |
Definition at line 483 of file asn1-parse.c.
#define YYNTOKENS 57 |
Definition at line 477 of file asn1-parse.c.
#define YYPACT_NINF -137 |
Definition at line 595 of file asn1-parse.c.
#define yypact_value_is_default | ( | Yystate | ) | (!!((Yystate) == (-137))) |
Definition at line 597 of file asn1-parse.c.
#define yyparse _ksba_asn1_yyparse |
Definition at line 92 of file asn1-parse.c.
#define YYPRINT | ( | F, | |
N, | |||
L | |||
) | do { } while (0); |
Definition at line 98 of file asn1-parse.c.
#define YYPULL 1 |
Definition at line 63 of file asn1-parse.c.
#define YYPURE 2 |
Definition at line 57 of file asn1-parse.c.
#define YYPUSH 0 |
Definition at line 60 of file asn1-parse.c.
#define YYRECOVERING | ( | ) | (!!yyerrstatus) |
Definition at line 805 of file asn1-parse.c.
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) |
Definition at line 284 of file asn1-parse.c.
#define YYSIZE_T size_t |
Definition at line 278 of file asn1-parse.c.
#define YYSKELETON_NAME "yacc.c" |
Definition at line 54 of file asn1-parse.c.
#define YYSTACK_ALLOC YYMALLOC |
Definition at line 382 of file asn1-parse.c.
#define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
Definition at line 385 of file asn1-parse.c.
#define YYSTACK_BYTES | ( | N | ) |
Definition at line 427 of file asn1-parse.c.
#define YYSTACK_FREE YYFREE |
Definition at line 383 of file asn1-parse.c.
#define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
Definition at line 423 of file asn1-parse.c.
#define YYSTACK_RELOCATE | ( | Stack_alloc, | |
Stack | |||
) |
Definition at line 438 of file asn1-parse.c.
#define YYSTYPE_IS_DECLARED 1 |
Definition at line 216 of file asn1-parse.c.
#define YYSTYPE_IS_TRIVIAL 1 |
Definition at line 215 of file asn1-parse.c.
#define YYSYNTAX_ERROR |
#define YYTABLE_NINF -1 |
Definition at line 600 of file asn1-parse.c.
#define yytable_value_is_error | ( | Yytable_value | ) | 0 |
Definition at line 602 of file asn1-parse.c.
#define YYTERROR 1 |
Definition at line 825 of file asn1-parse.c.
#define YYTOKENTYPE |
Definition at line 150 of file asn1-parse.c.
#define YYTRANSLATE | ( | YYX | ) | ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
Definition at line 490 of file asn1-parse.c.
#define YYUNDEFTOK 2 |
Definition at line 485 of file asn1-parse.c.
#define YYUSE | ( | E | ) | ((void) (E)) |
Definition at line 318 of file asn1-parse.c.
Definition at line 1 of file asn1-parse.c.
typedef short yytype_int16 |
Definition at line 268 of file asn1-parse.c.
typedef signed char yytype_int8 |
Definition at line 256 of file asn1-parse.c.
typedef unsigned short yytype_uint16 |
Definition at line 262 of file asn1-parse.c.
typedef unsigned char yytype_uint8 |
Definition at line 250 of file asn1-parse.c.
anonymous enum |
Enumerator | |
---|---|
CONST_EXPLICIT | |
CONST_IMPLICIT |
Definition at line 102 of file asn1-parse.c.
enum yytokentype |
Definition at line 151 of file asn1-parse.c.
int _ksba_asn1_yyparse | ( | void * | parm | ) |
Definition at line 1231 of file asn1-parse.c.
References _ksba_asn_check_identifier(), _ksba_asn_set_default_tag(), _ksba_asn_type_set_config(), append_right(), CLASS_APPLICATION, CLASS_CONTEXT, CLASS_PRIVATE, CLASS_UNIVERSAL, CONST_EXPLICIT, CONST_IMPLICIT, YYSTYPE::constant, node_flag_s::explicit, asn_node_struct::flags, node_flag_s::has_imports, node_flag_s::implicit, name, NEW_NODE, YYSTYPE::node, PARSECTL, set_down(), set_name(), set_right(), set_str_value(), set_ulong_value(), YYSTYPE::str, TYPE_ANY, TYPE_BIT_STRING, TYPE_BMP_STRING, TYPE_BOOLEAN, TYPE_CHOICE, TYPE_CONSTANT, TYPE_DEFAULT, TYPE_DEFINITIONS, TYPE_ENUMERATED, TYPE_GENERALIZED_TIME, TYPE_IA5_STRING, TYPE_IDENTIFIER, TYPE_INTEGER, TYPE_NULL, TYPE_NUMERIC_STRING, TYPE_OBJECT_ID, TYPE_OCTET_STRING, TYPE_PRINTABLE_STRING, TYPE_SEQUENCE, TYPE_SEQUENCE_OF, TYPE_SET, TYPE_SET_OF, TYPE_SIZE, TYPE_TAG, TYPE_TELETEX_STRING, TYPE_UNIVERSAL_STRING, TYPE_UTC_TIME, TYPE_UTF8_STRING, YY_, YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN, YY_IGNORE_MAYBE_UNINITIALIZED_END, YY_INITIAL_VALUE, YY_REDUCE_PRINT, YY_STACK_PRINT, YY_SYMBOL_PRINT, YYABORT, YYACCEPT, yycheck, yydefact, yydefgoto, yydestruct(), YYDPRINTF, YYEMPTY, YYEOF, YYERROR, yyerror(), YYFINAL, YYINITDEPTH, YYLAST, yylex(), YYMAXDEPTH, YYNTOKENS, yypact, yypact_value_is_default, yypgoto, YYPOPSTACK, yyr1, yyr2, YYSIZE_T, yyalloc::yyss_alloc, YYSTACK_ALLOC, YYSTACK_BYTES, YYSTACK_FREE, YYSTACK_RELOCATE, yystos, YYSYNTAX_ERROR, yytable, yytable_value_is_error, YYTERROR, YYTRANSLATE, and yyalloc::yyvs_alloc.
int _ksba_asn_parse_file | ( | const char * | file_name, |
ksba_asn_tree_t * | result, | ||
int | debug | ||
) |
ksba_asn_parse_file: @file_name: Filename with the ASN module @pointer: Returns the syntax tree @debug: Enable debug output
Parse an ASN.1 file and return an syntax tree.
Return value: 0 for okay or an ASN_xx error code
Definition at line 2833 of file asn1-parse.c.
References _ksba_asn_change_integer_value(), _ksba_asn_expand_object_id(), parser_control_s::all_nodes, parser_control_s::debug, ksba_asn_tree_s::filename, parser_control_s::fp, GPG_ERR_SYNTAX, gpg_error, gpg_error_from_syserror, parser_control_s::lineno, ksba_asn_tree_s::node_list, ksba_asn_tree_s::parse_tree, parser_control_s::parse_tree, release_all_nodes(), parser_control_s::result_parse, xmalloc, and yyparse.
void _ksba_asn_release_nodes | ( | AsnNode | node | ) |
Definition at line 2886 of file asn1-parse.c.
References release_all_nodes().
Referenced by _ksba_asn_tree_dump(), _ksba_ber_decoder_decode(), _ksba_cert_read_der(), _ksba_cert_release(), _ksba_cms_release(), _ksba_crl_release(), _ksba_derdn_to_str(), build_signed_data_attributes(), build_signed_data_rest(), and release_value_tree().
void _ksba_asn_tree_release | ( | ksba_asn_tree_t | tree | ) |
Definition at line 2875 of file asn1-parse.c.
References ksba_asn_tree_s::node_list, release_all_nodes(), and xfree.
Definition at line 2798 of file asn1-parse.c.
References asn_node_struct::left, return_if_fail, and asn_node_struct::right.
Referenced by _ksba_asn1_yyparse().
void free | ( | void * | ) |
Referenced by alloca(), build_signed_data_attributes(), and xfree().
|
static |
Definition at line 2728 of file asn1-parse.c.
References parser_control_s::all_nodes, asn_node_struct::link_next, asn_node_struct::off, asn_node_struct::type, and xcalloc.
|
static |
Definition at line 2742 of file asn1-parse.c.
References asn_value_u::buf, asn_node_struct::link_next, asn_node_struct::name, asn_value_u::v_cstr, asn_value_u::v_mem, VALTYPE_CSTR, VALTYPE_MEM, asn_node_struct::value, asn_node_struct::valuetype, and xfree.
Referenced by _ksba_asn_parse_file(), _ksba_asn_release_nodes(), and _ksba_asn_tree_release().
Definition at line 2812 of file asn1-parse.c.
References asn_node_struct::down, asn_node_struct::left, and return_if_fail.
Referenced by _ksba_asn1_yyparse().
|
static |
Definition at line 2761 of file asn1-parse.c.
References _ksba_asn_set_name(), and name.
Referenced by _ksba_asn1_yyparse().
Definition at line 2788 of file asn1-parse.c.
References asn_node_struct::left, return_if_fail, and asn_node_struct::right.
Referenced by _ksba_asn1_yyparse().
|
static |
Definition at line 2767 of file asn1-parse.c.
References _ksba_asn_set_value(), VALTYPE_CSTR, and VALTYPE_NULL.
Referenced by _ksba_asn1_yyparse().
|
static |
Definition at line 2776 of file asn1-parse.c.
References _ksba_asn_set_value(), and VALTYPE_ULONG.
Referenced by _ksba_asn1_yyparse().
|
static |
Definition at line 1210 of file asn1-parse.c.
References YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN, YY_IGNORE_MAYBE_UNINITIALIZED_END, YY_SYMBOL_PRINT, and YYUSE.
Referenced by _ksba_asn1_yyparse().
|
static |
Definition at line 2715 of file asn1-parse.c.
Referenced by _ksba_asn1_yyparse().
|
static |
Definition at line 2615 of file asn1-parse.c.
References DIM, IDENTIFIER, MAX_STRING_LENGTH, NUM, PARSECTL, YYSTYPE::str, YYNTOKENS, yytname, and yytoknum.
Referenced by _ksba_asn1_yyparse().
|
static |
Definition at line 1003 of file asn1-parse.c.
Referenced by yytnamerr().
|
static |
Definition at line 986 of file asn1-parse.c.
References YYSIZE_T.
Referenced by yysyntax_error(), and yytnamerr().
|
static |
Definition at line 1076 of file asn1-parse.c.
References YY_, YY_NULLPTR, YYCASE_, yycheck, YYEMPTY, YYLAST, YYNTOKENS, yypact, yypact_value_is_default, YYSIZE_T, YYSTACK_ALLOC_MAXIMUM, yystrlen(), yytable, yytable_value_is_error, YYTERROR, yytname, and yytnamerr().
|
static |
Definition at line 1025 of file asn1-parse.c.
References YYSIZE_T, yystpcpy(), and yystrlen().
Referenced by yysyntax_error().
|
static |
Definition at line 709 of file asn1-parse.c.
Referenced by _ksba_asn1_yyparse(), and yysyntax_error().
|
static |
Definition at line 635 of file asn1-parse.c.
Referenced by _ksba_asn1_yyparse().
|
static |
Definition at line 672 of file asn1-parse.c.
Referenced by _ksba_asn1_yyparse().
|
static |
Definition at line 607 of file asn1-parse.c.
Referenced by _ksba_asn1_yyparse(), and yysyntax_error().
|
static |
Definition at line 661 of file asn1-parse.c.
Referenced by _ksba_asn1_yyparse().
|
static |
Definition at line 761 of file asn1-parse.c.
Referenced by _ksba_asn1_yyparse().
|
static |
Definition at line 778 of file asn1-parse.c.
Referenced by _ksba_asn1_yyparse().
|
static |
Definition at line 735 of file asn1-parse.c.
Referenced by _ksba_asn1_yyparse().
|
static |
Definition at line 685 of file asn1-parse.c.
Referenced by _ksba_asn1_yyparse(), and yysyntax_error().
|
static |
Definition at line 552 of file asn1-parse.c.
Referenced by yylex(), and yysyntax_error().
|
static |
Definition at line 584 of file asn1-parse.c.
Referenced by yylex().
|
static |
Definition at line 495 of file asn1-parse.c.