2 * Copyright (C) 2004, 2006, 2007, 2008, 2009 Free Software Foundation
3 * Copyright (C) 2002 Fabio Fiorina
5 * This file is part of LIBTASN1.
7 * The LIBTASN1 library is free software; you can redistribute it
8 * and/or modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 /*****************************************************/
25 /* File: structure.c */
26 /* Description: Functions to create and delete an */
28 /*****************************************************/
32 #include <structure.h>
33 #include "parser_aux.h"
37 extern char _asn1_identifierMissing
[];
40 /******************************************************/
41 /* Function : _asn1_add_node_only */
42 /* Description: creates a new NODE_ASN element. */
44 /* type: type of the new element (see TYPE_ */
45 /* and CONST_ constants). */
46 /* Return: pointer to the new element. */
47 /******************************************************/
49 _asn1_add_node_only (unsigned int type
)
53 punt
= (ASN1_TYPE
) _asn1_calloc (1, sizeof (struct node_asn_struct
));
63 /******************************************************************/
64 /* Function : _asn1_find_left */
65 /* Description: returns the NODE_ASN element with RIGHT field that*/
66 /* points the element NODE. */
68 /* node: NODE_ASN element pointer. */
69 /* Return: NULL if not found. */
70 /******************************************************************/
72 _asn1_find_left (ASN1_TYPE node
)
74 if ((node
== NULL
) || (node
->left
== NULL
) || (node
->left
->down
== node
))
82 _asn1_create_static_structure (ASN1_TYPE pointer
, char *output_file_name
,
89 file
= fopen (output_file_name
, "w");
92 return ASN1_FILE_NOT_FOUND
;
94 fprintf (file
, "#if HAVE_CONFIG_H\n");
95 fprintf (file
, "# include \"config.h\"\n");
96 fprintf (file
, "#endif\n\n");
98 fprintf (file
, "#include <libtasn1.h>\n\n");
100 fprintf (file
, "const ASN1_ARRAY_TYPE %s[] = {\n", vector_name
);
106 fprintf (file
, " { ");
109 fprintf (file
, "\"%s\", ", p
->name
);
111 fprintf (file
, "NULL, ");
119 fprintf (file
, "%lu, ", t
);
122 fprintf (file
, "\"%s\"},\n", p
->value
);
124 fprintf (file
, "NULL },\n");
138 p
= _asn1_find_up (p
);
153 fprintf (file
, " { NULL, 0, NULL }\n};\n");
162 * asn1_array2tree - Creates the structures needed to manage the ASN1 definitions.
163 * @array: specify the array that contains ASN.1 declarations
164 * @definitions: return the pointer to the structure created by
165 * *ARRAY ASN.1 declarations
166 * @errorDescription: return the error description.
168 * Creates the structures needed to manage the ASN.1 definitions.
169 * @array is a vector created by asn1_parser2array().
173 * ASN1_SUCCESS: Structure created correctly.
175 * ASN1_ELEMENT_NOT_EMPTY: *@definitions not ASN1_TYPE_EMPTY.
177 * ASN1_IDENTIFIER_NOT_FOUND: In the file there is an identifier that
178 * is not defined (see @errorDescription for more information).
180 * ASN1_ARRAY_ERROR: The array pointed by @array is wrong.
183 asn1_array2tree (const ASN1_ARRAY_TYPE
* array
, ASN1_TYPE
* definitions
,
184 char *errorDescription
)
186 ASN1_TYPE p
, p_last
= NULL
;
192 if (*definitions
!= ASN1_TYPE_EMPTY
)
193 return ASN1_ELEMENT_NOT_EMPTY
;
198 while (array
[k
].value
|| array
[k
].type
|| array
[k
].name
)
200 p
= _asn1_add_node (array
[k
].type
& (~CONST_DOWN
));
202 _asn1_set_name (p
, array
[k
].name
);
204 _asn1_set_value (p
, array
[k
].value
, strlen (array
[k
].value
) + 1);
206 if (*definitions
== NULL
)
210 _asn1_set_down (p_last
, p
);
211 else if (move
== RIGHT
)
212 _asn1_set_right (p_last
, p
);
216 if (array
[k
].type
& CONST_DOWN
)
218 else if (array
[k
].type
& CONST_RIGHT
)
224 if (p_last
== *definitions
)
227 p_last
= _asn1_find_up (p_last
);
232 if (p_last
->type
& CONST_RIGHT
)
234 p_last
->type
&= ~CONST_RIGHT
;
243 if (p_last
== *definitions
)
245 result
= _asn1_check_identifier (*definitions
);
246 if (result
== ASN1_SUCCESS
)
248 _asn1_change_integer_value (*definitions
);
249 _asn1_expand_object_id (*definitions
);
254 result
= ASN1_ARRAY_ERROR
;
257 if (errorDescription
!= NULL
)
259 if (result
== ASN1_IDENTIFIER_NOT_FOUND
)
261 Estrcpy (errorDescription
, ":: identifier '");
262 Estrcat (errorDescription
, _asn1_identifierMissing
);
263 Estrcat (errorDescription
, "' not found");
266 errorDescription
[0] = 0;
269 if (result
!= ASN1_SUCCESS
)
271 _asn1_delete_list_and_nodes ();
272 *definitions
= ASN1_TYPE_EMPTY
;
275 _asn1_delete_list ();
281 * asn1_delete_structure - Deletes the structure pointed by *ROOT.
282 * @structure: pointer to the structure that you want to delete.
284 * Deletes the structure *@structure. At the end, *@structure is set
285 * to ASN1_TYPE_EMPTY.
289 * ASN1_SUCCESS: Everything OK.
291 * ASN1_ELEMENT_NOT_FOUND: *@structure was ASN1_TYPE_EMPTY.
295 asn1_delete_structure (ASN1_TYPE
* structure
)
299 if (*structure
== ASN1_TYPE_EMPTY
)
300 return ASN1_ELEMENT_NOT_FOUND
;
314 p3
= _asn1_find_up (p
);
315 _asn1_set_down (p3
, p2
);
316 _asn1_remove_node (p
);
321 p3
= _asn1_find_left (p
);
324 p3
= _asn1_find_up (p
);
326 _asn1_set_down (p3
, p2
);
330 p
->right
->left
= NULL
;
334 _asn1_set_right (p3
, p2
);
335 _asn1_remove_node (p
);
341 *structure
= ASN1_TYPE_EMPTY
;
348 * asn1_delete_element - Deletes the element of a structure.
349 * @structure: pointer to the structure that contains the element you
351 * @element_name: element's name you want to delete.
353 * Deletes the element named *@element_name inside *@structure.
357 * ASN1_SUCCESS: Everything OK.
359 * ASN1_ELEMENT_NOT_FOUND: The name element was not found.
363 asn1_delete_element (ASN1_TYPE structure
, const char *element_name
)
365 ASN1_TYPE p2
, p3
, source_node
;
367 source_node
= asn1_find_node (structure
, element_name
);
369 if (source_node
== ASN1_TYPE_EMPTY
)
370 return ASN1_ELEMENT_NOT_FOUND
;
372 p2
= source_node
->right
;
373 p3
= _asn1_find_left (source_node
);
376 p3
= _asn1_find_up (source_node
);
378 _asn1_set_down (p3
, p2
);
379 else if (source_node
->right
)
380 source_node
->right
->left
= NULL
;
383 _asn1_set_right (p3
, p2
);
385 return asn1_delete_structure (&source_node
);
389 _asn1_copy_structure3 (ASN1_TYPE source_node
)
391 ASN1_TYPE dest_node
, p_s
, p_d
, p_d_prev
;
394 if (source_node
== NULL
)
397 dest_node
= _asn1_add_node_only (source_node
->type
);
409 _asn1_set_name (p_d
, p_s
->name
);
411 _asn1_set_value (p_d
, p_s
->value
, p_s
->value_len
);
423 p_d
= _asn1_add_node_only (p_s
->type
);
424 _asn1_set_down (p_d_prev
, p_d
);
430 if (p_s
== source_node
)
439 p_d
= _asn1_add_node_only (p_s
->type
);
440 _asn1_set_right (p_d_prev
, p_d
);
447 p_s
= _asn1_find_up (p_s
);
448 p_d
= _asn1_find_up (p_d
);
451 while (p_s
!= source_node
);
458 _asn1_copy_structure2 (ASN1_TYPE root
, const char *source_name
)
460 ASN1_TYPE source_node
;
462 source_node
= asn1_find_node (root
, source_name
);
464 return _asn1_copy_structure3 (source_node
);
470 _asn1_type_choice_config (ASN1_TYPE node
)
472 ASN1_TYPE p
, p2
, p3
, p4
;
476 return ASN1_ELEMENT_NOT_FOUND
;
481 while (!((p
== node
) && (move
== UP
)))
485 if ((type_field (p
->type
) == TYPE_CHOICE
) && (p
->type
& CONST_TAG
))
490 if (type_field (p2
->type
) != TYPE_TAG
)
492 p2
->type
|= CONST_TAG
;
493 p3
= _asn1_find_left (p2
);
496 if (type_field (p3
->type
) == TYPE_TAG
)
498 p4
= _asn1_add_node_only (p3
->type
);
499 tlen
= strlen (p3
->value
);
501 _asn1_set_value (p4
, p3
->value
, tlen
+ 1);
502 _asn1_set_right (p4
, p2
->down
);
503 _asn1_set_down (p2
, p4
);
505 p3
= _asn1_find_left (p3
);
510 p
->type
&= ~(CONST_TAG
);
515 if (type_field (p2
->type
) == TYPE_TAG
)
516 asn1_delete_structure (&p2
);
547 p
= _asn1_find_up (p
);
555 _asn1_expand_identifier (ASN1_TYPE
* node
, ASN1_TYPE root
)
558 char name2
[ASN1_MAX_NAME_SIZE
+ 2];
562 return ASN1_ELEMENT_NOT_FOUND
;
567 while (!((p
== *node
) && (move
== UP
)))
571 if (type_field (p
->type
) == TYPE_IDENTIFIER
)
573 _asn1_str_cpy (name2
, sizeof (name2
), root
->name
);
574 _asn1_str_cat (name2
, sizeof (name2
), ".");
575 _asn1_str_cat (name2
, sizeof (name2
), p
->value
);
576 p2
= _asn1_copy_structure2 (root
, name2
);
579 return ASN1_IDENTIFIER_NOT_FOUND
;
581 _asn1_set_name (p2
, p
->name
);
582 p2
->right
= p
->right
;
591 _asn1_set_right (p3
, p2
->down
);
592 _asn1_set_down (p2
, p
->down
);
595 p3
= _asn1_find_left (p
);
597 _asn1_set_right (p3
, p2
);
600 p3
= _asn1_find_up (p
);
602 _asn1_set_down (p3
, p2
);
609 if (p
->type
& CONST_SIZE
)
610 p2
->type
|= CONST_SIZE
;
611 if (p
->type
& CONST_TAG
)
612 p2
->type
|= CONST_TAG
;
613 if (p
->type
& CONST_OPTION
)
614 p2
->type
|= CONST_OPTION
;
615 if (p
->type
& CONST_DEFAULT
)
616 p2
->type
|= CONST_DEFAULT
;
617 if (p
->type
& CONST_SET
)
618 p2
->type
|= CONST_SET
;
619 if (p
->type
& CONST_NOT_USED
)
620 p2
->type
|= CONST_NOT_USED
;
624 _asn1_remove_node (p
);
656 p
= _asn1_find_up (p
);
664 * asn1_create_element - Creates a structure of type SOURCE_NAME.
665 * @definitions: pointer to the structure returned by "parser_asn1" function
666 * @source_name: the name of the type of the new structure (must be
667 * inside p_structure).
668 * @element: pointer to the structure created.
670 * Creates a structure of type @source_name. Example using
673 * rc = asn1_create_structure(cert_def, "PKIX1.Certificate",
678 * ASN1_SUCCESS: Creation OK.
680 * ASN1_ELEMENT_NOT_FOUND: SOURCE_NAME isn't known
683 asn1_create_element (ASN1_TYPE definitions
, const char *source_name
,
689 dest_node
= _asn1_copy_structure2 (definitions
, source_name
);
691 if (dest_node
== NULL
)
692 return ASN1_ELEMENT_NOT_FOUND
;
694 _asn1_set_name (dest_node
, "");
696 res
= _asn1_expand_identifier (&dest_node
, definitions
);
697 _asn1_type_choice_config (dest_node
);
699 *element
= dest_node
;
706 * asn1_print_structure - Prints on the standard output the structure's tree
707 * @out: pointer to the output file (e.g. stdout).
708 * @structure: pointer to the structure that you want to visit.
709 * @name: an element of the structure
710 * @mode: specify how much of the structure to print, can be
711 * %ASN1_PRINT_NAME, %ASN1_PRINT_NAME_TYPE,
712 * %ASN1_PRINT_NAME_TYPE_VALUE, or %ASN1_PRINT_ALL.
714 * Prints on the @out file descriptor the structure's tree starting
715 * from the @name element inside the structure @structure.
718 asn1_print_structure (FILE * out
, ASN1_TYPE structure
, const char *name
,
722 int k
, indent
= 0, len
, len2
, len3
;
727 root
= asn1_find_node (structure
, name
);
735 if (mode
== ASN1_PRINT_ALL
)
737 for (k
= 0; k
< indent
; k
++)
739 fprintf (out
, "name:");
741 fprintf (out
, "%s ", p
->name
);
743 fprintf (out
, "NULL ");
747 switch (type_field (p
->type
))
754 for (k
= 0; k
< indent
; k
++)
756 fprintf (out
, "name:");
758 fprintf (out
, "%s ", p
->name
);
760 fprintf (out
, "NULL ");
764 if (mode
!= ASN1_PRINT_NAME
)
766 switch (type_field (p
->type
))
769 if (mode
== ASN1_PRINT_ALL
)
770 fprintf (out
, "type:CONST");
773 if (mode
== ASN1_PRINT_ALL
)
774 fprintf (out
, "type:TAG");
777 if (mode
== ASN1_PRINT_ALL
)
778 fprintf (out
, "type:SIZE");
781 fprintf (out
, "type:DEFAULT");
784 fprintf (out
, "type:NULL");
786 case TYPE_IDENTIFIER
:
787 fprintf (out
, "type:IDENTIFIER");
790 fprintf (out
, "type:INTEGER");
792 case TYPE_ENUMERATED
:
793 fprintf (out
, "type:ENUMERATED");
796 fprintf (out
, "type:TIME");
799 fprintf (out
, "type:BOOLEAN");
802 fprintf (out
, "type:SEQUENCE");
804 case TYPE_BIT_STRING
:
805 fprintf (out
, "type:BIT_STR");
807 case TYPE_OCTET_STRING
:
808 fprintf (out
, "type:OCT_STR");
810 case TYPE_GENERALSTRING
:
811 fprintf (out
, "type:GENERALSTRING");
813 case TYPE_SEQUENCE_OF
:
814 fprintf (out
, "type:SEQ_OF");
817 fprintf (out
, "type:OBJ_ID");
820 fprintf (out
, "type:ANY");
823 fprintf (out
, "type:SET");
826 fprintf (out
, "type:SET_OF");
829 fprintf (out
, "type:CHOICE");
831 case TYPE_DEFINITIONS
:
832 fprintf (out
, "type:DEFINITIONS");
839 if ((mode
== ASN1_PRINT_NAME_TYPE_VALUE
) || (mode
== ASN1_PRINT_ALL
))
841 switch (type_field (p
->type
))
844 if (mode
== ASN1_PRINT_ALL
)
846 fprintf (out
, " value:%s", p
->value
);
849 if (mode
== ASN1_PRINT_ALL
)
851 fprintf (out
, " value:%s", p
->value
);
854 if (mode
== ASN1_PRINT_ALL
)
856 fprintf (out
, " value:%s", p
->value
);
860 fprintf (out
, " value:%s", p
->value
);
861 else if (p
->type
& CONST_TRUE
)
862 fprintf (out
, " value:TRUE");
863 else if (p
->type
& CONST_FALSE
)
864 fprintf (out
, " value:FALSE");
866 case TYPE_IDENTIFIER
:
868 fprintf (out
, " value:%s", p
->value
);
874 len
= asn1_get_length_der (p
->value
, p
->value_len
, &len2
);
875 fprintf (out
, " value:0x");
877 for (k
= 0; k
< len
; k
++)
878 fprintf (out
, "%02x", (p
->value
)[k
+ len2
]);
881 case TYPE_ENUMERATED
:
885 len
= asn1_get_length_der (p
->value
, p
->value_len
, &len2
);
886 fprintf (out
, " value:0x");
888 for (k
= 0; k
< len
; k
++)
889 fprintf (out
, "%02x", (p
->value
)[k
+ len2
]);
894 fprintf (out
, " value:%s", p
->value
);
899 if (p
->value
[0] == 'T')
900 fprintf (out
, " value:TRUE");
901 else if (p
->value
[0] == 'F')
902 fprintf (out
, " value:FALSE");
905 case TYPE_BIT_STRING
:
909 len
= asn1_get_length_der (p
->value
, p
->value_len
, &len2
);
912 fprintf (out
, " value(%i):",
913 (len
- 1) * 8 - (p
->value
[len2
]));
914 for (k
= 1; k
< len
; k
++)
915 fprintf (out
, "%02x", (p
->value
)[k
+ len2
]);
919 case TYPE_OCTET_STRING
:
923 len
= asn1_get_length_der (p
->value
, p
->value_len
, &len2
);
924 fprintf (out
, " value:");
926 for (k
= 0; k
< len
; k
++)
927 fprintf (out
, "%02x", (p
->value
)[k
+ len2
]);
930 case TYPE_GENERALSTRING
:
934 len
= asn1_get_length_der (p
->value
, p
->value_len
, &len2
);
935 fprintf (out
, " value:");
937 for (k
= 0; k
< len
; k
++)
938 fprintf (out
, "%02x", (p
->value
)[k
+ len2
]);
943 fprintf (out
, " value:%s", p
->value
);
949 len2
= asn1_get_length_der (p
->value
, p
->value_len
, &len3
);
950 fprintf (out
, " value:");
952 for (k
= 0; k
< len2
; k
++)
953 fprintf (out
, "%02x", (p
->value
)[k
+ len3
]);
959 case TYPE_DEFINITIONS
:
960 case TYPE_SEQUENCE_OF
:
969 if (mode
== ASN1_PRINT_ALL
)
971 if (p
->type
& 0x1FFFFF00)
973 fprintf (out
, " attr:");
974 if (p
->type
& CONST_UNIVERSAL
)
975 fprintf (out
, "UNIVERSAL,");
976 if (p
->type
& CONST_PRIVATE
)
977 fprintf (out
, "PRIVATE,");
978 if (p
->type
& CONST_APPLICATION
)
979 fprintf (out
, "APPLICATION,");
980 if (p
->type
& CONST_EXPLICIT
)
981 fprintf (out
, "EXPLICIT,");
982 if (p
->type
& CONST_IMPLICIT
)
983 fprintf (out
, "IMPLICIT,");
984 if (p
->type
& CONST_TAG
)
985 fprintf (out
, "TAG,");
986 if (p
->type
& CONST_DEFAULT
)
987 fprintf (out
, "DEFAULT,");
988 if (p
->type
& CONST_TRUE
)
989 fprintf (out
, "TRUE,");
990 if (p
->type
& CONST_FALSE
)
991 fprintf (out
, "FALSE,");
992 if (p
->type
& CONST_LIST
)
993 fprintf (out
, "LIST,");
994 if (p
->type
& CONST_MIN_MAX
)
995 fprintf (out
, "MIN_MAX,");
996 if (p
->type
& CONST_OPTION
)
997 fprintf (out
, "OPTION,");
998 if (p
->type
& CONST_1_PARAM
)
999 fprintf (out
, "1_PARAM,");
1000 if (p
->type
& CONST_SIZE
)
1001 fprintf (out
, "SIZE,");
1002 if (p
->type
& CONST_DEFINED_BY
)
1003 fprintf (out
, "DEF_BY,");
1004 if (p
->type
& CONST_GENERALIZED
)
1005 fprintf (out
, "GENERALIZED,");
1006 if (p
->type
& CONST_UTC
)
1007 fprintf (out
, "UTC,");
1008 if (p
->type
& CONST_SET
)
1009 fprintf (out
, "SET,");
1010 if (p
->type
& CONST_NOT_USED
)
1011 fprintf (out
, "NOT_USED,");
1012 if (p
->type
& CONST_ASSIGN
)
1013 fprintf (out
, "ASSIGNMENT,");
1017 if (mode
== ASN1_PRINT_ALL
)
1019 fprintf (out
, "\n");
1023 switch (type_field (p
->type
))
1030 fprintf (out
, "\n");
1050 p
= _asn1_find_up (p
);
1070 * asn1_number_of_elements - Counts the number of elements of a structure.
1071 * @element: pointer to the root of an ASN1 structure.
1072 * @name: the name of a sub-structure of ROOT.
1073 * @num: pointer to an integer where the result will be stored
1075 * Counts the number of elements of a sub-structure called NAME with
1076 * names equal to "?1","?2", ...
1080 * ASN1_SUCCESS: Creation OK.
1082 * ASN1_ELEMENT_NOT_FOUND: NAME isn't known.
1084 * ASN1_GENERIC_ERROR: Pointer num equal to NULL.
1088 asn1_number_of_elements (ASN1_TYPE element
, const char *name
, int *num
)
1093 return ASN1_GENERIC_ERROR
;
1097 node
= asn1_find_node (element
, name
);
1099 return ASN1_ELEMENT_NOT_FOUND
;
1105 if ((p
->name
) && (p
->name
[0] == '?'))
1110 return ASN1_SUCCESS
;
1115 * asn1_find_structure_from_oid - Locate structure defined by a specific OID.
1116 * @definitions: ASN1 definitions
1117 * @oidValue: value of the OID to search (e.g. "1.2.3.4").
1119 * Search the structure that is defined just after an OID definition.
1121 * Returns: NULL when OIDVALUE not found, otherwise the pointer to a
1122 * constant string that contains the element name defined just
1127 asn1_find_structure_from_oid (ASN1_TYPE definitions
, const char *oidValue
)
1129 char definitionsName
[ASN1_MAX_NAME_SIZE
], name
[2 * ASN1_MAX_NAME_SIZE
+ 1];
1130 char value
[ASN1_MAX_NAME_SIZE
];
1133 asn1_retCode result
;
1135 if ((definitions
== ASN1_TYPE_EMPTY
) || (oidValue
== NULL
))
1136 return NULL
; /* ASN1_ELEMENT_NOT_FOUND; */
1139 strcpy (definitionsName
, definitions
->name
);
1140 strcat (definitionsName
, ".");
1142 /* search the OBJECT_ID into definitions */
1143 p
= definitions
->down
;
1146 if ((type_field (p
->type
) == TYPE_OBJECT_ID
) &&
1147 (p
->type
& CONST_ASSIGN
))
1149 strcpy (name
, definitionsName
);
1150 strcat (name
, p
->name
);
1152 len
= ASN1_MAX_NAME_SIZE
;
1153 result
= asn1_read_value (definitions
, name
, value
, &len
);
1155 if ((result
== ASN1_SUCCESS
) && (!strcmp (oidValue
, value
)))
1158 if (p
== NULL
) /* reach the end of ASN1 definitions */
1159 return NULL
; /* ASN1_ELEMENT_NOT_FOUND; */
1167 return NULL
; /* ASN1_ELEMENT_NOT_FOUND; */
1172 * @dst: Destination ASN1_TYPE node.
1173 * @dst_name: Field name in destination node.
1174 * @src: Source ASN1_TYPE node.
1175 * @src_name: Field name in source node.
1177 * Create a deep copy of a ASN1_TYPE variable.
1179 * Return value: Return ASN1_SUCCESS on success.
1182 asn1_copy_node (ASN1_TYPE dst
, const char *dst_name
,
1183 ASN1_TYPE src
, const char *src_name
)
1185 /* FIXME: rewrite using copy_structure().
1186 * It seems quite hard to do.
1193 result
= asn1_der_coding (src
, src_name
, NULL
, &size
, NULL
);
1194 if (result
!= ASN1_MEM_ERROR
)
1197 data
= _asn1_malloc (size
);
1199 return ASN1_MEM_ERROR
;
1201 result
= asn1_der_coding (src
, src_name
, data
, &size
, NULL
);
1202 if (result
!= ASN1_SUCCESS
)
1208 dst_node
= asn1_find_node (dst
, dst_name
);
1209 if (dst_node
== NULL
)
1212 return ASN1_ELEMENT_NOT_FOUND
;
1215 result
= asn1_der_decoding (&dst_node
, data
, size
, NULL
);