2 * Copyright (C) 2004, 2006 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 /*****************************************************/
33 #include <structure.h>
34 #include "parser_aux.h"
38 extern char _asn1_identifierMissing
[];
41 /******************************************************/
42 /* Function : _asn1_add_node_only */
43 /* Description: creates a new NODE_ASN element. */
45 /* type: type of the new element (see TYPE_ */
46 /* and CONST_ constants). */
47 /* Return: pointer to the new element. */
48 /******************************************************/
50 _asn1_add_node_only (unsigned int type
)
54 punt
= (node_asn
*) _asn1_calloc (1, sizeof (node_asn
));
64 /******************************************************************/
65 /* Function : _asn1_find_left */
66 /* Description: returns the NODE_ASN element with RIGHT field that*/
67 /* points the element NODE. */
69 /* node: NODE_ASN element pointer. */
70 /* Return: NULL if not found. */
71 /******************************************************************/
73 _asn1_find_left (node_asn
* node
)
75 if ((node
== NULL
) || (node
->left
== NULL
) || (node
->left
->down
== node
))
83 _asn1_create_static_structure (ASN1_TYPE pointer
, char *output_file_name
,
90 file
= fopen (output_file_name
, "w");
93 return ASN1_FILE_NOT_FOUND
;
95 fprintf (file
, "\n#include <libtasn1.h>\n\n");
96 fprintf (file
, "extern const ASN1_ARRAY_TYPE %s[]={\n", vector_name
);
102 fprintf (file
, " {");
105 fprintf (file
, "\"%s\",", p
->name
);
107 fprintf (file
, "0,");
115 fprintf (file
, "%lu,", t
);
118 fprintf (file
, "\"%s\"},\n", p
->value
);
120 fprintf (file
, "0},\n");
134 p
= _asn1_find_up (p
);
149 fprintf (file
, " {0,0,0}\n};\n");
158 * asn1_array2tree - Creates the structures needed to manage the ASN1 definitions.
159 * @array: specify the array that contains ASN.1 declarations
160 * @definitions: return the pointer to the structure created by
161 * *ARRAY ASN.1 declarations
162 * @errorDescription: return the error description.
164 * Creates the structures needed to manage the ASN.1 definitions.
165 * @array is a vector created by asn1_parser2array().
169 * ASN1_SUCCESS: Structure created correctly.
171 * ASN1_ELEMENT_NOT_EMPTY: *@definitions not ASN1_TYPE_EMPTY.
173 * ASN1_IDENTIFIER_NOT_FOUND: In the file there is an identifier that
174 * is not defined (see @errorDescription for more information).
176 * ASN1_ARRAY_ERROR: The array pointed by @array is wrong.
179 asn1_array2tree (const ASN1_ARRAY_TYPE
* array
, ASN1_TYPE
* definitions
,
180 char *errorDescription
)
182 node_asn
*p
, *p_last
= NULL
;
188 if (*definitions
!= ASN1_TYPE_EMPTY
)
189 return ASN1_ELEMENT_NOT_EMPTY
;
194 while (array
[k
].value
|| array
[k
].type
|| array
[k
].name
)
196 p
= _asn1_add_node (array
[k
].type
& (~CONST_DOWN
));
198 _asn1_set_name (p
, array
[k
].name
);
200 _asn1_set_value (p
, array
[k
].value
, strlen (array
[k
].value
) + 1);
202 if (*definitions
== NULL
)
206 _asn1_set_down (p_last
, p
);
207 else if (move
== RIGHT
)
208 _asn1_set_right (p_last
, p
);
212 if (array
[k
].type
& CONST_DOWN
)
214 else if (array
[k
].type
& CONST_RIGHT
)
220 if (p_last
== *definitions
)
223 p_last
= _asn1_find_up (p_last
);
228 if (p_last
->type
& CONST_RIGHT
)
230 p_last
->type
&= ~CONST_RIGHT
;
239 if (p_last
== *definitions
)
241 result
= _asn1_check_identifier (*definitions
);
242 if (result
== ASN1_SUCCESS
)
244 _asn1_change_integer_value (*definitions
);
245 _asn1_expand_object_id (*definitions
);
250 result
= ASN1_ARRAY_ERROR
;
253 if (errorDescription
!= NULL
)
255 if (result
== ASN1_IDENTIFIER_NOT_FOUND
)
257 Estrcpy (errorDescription
, ":: identifier '");
258 Estrcat (errorDescription
, _asn1_identifierMissing
);
259 Estrcat (errorDescription
, "' not found");
262 errorDescription
[0] = 0;
265 if (result
!= ASN1_SUCCESS
)
267 _asn1_delete_list_and_nodes ();
268 *definitions
= ASN1_TYPE_EMPTY
;
271 _asn1_delete_list ();
277 * asn1_delete_structure - Deletes the structure pointed by *ROOT.
278 * @structure: pointer to the structure that you want to delete.
280 * Deletes the structure *@structure. At the end, *@structure is set
281 * to ASN1_TYPE_EMPTY.
285 * ASN1_SUCCESS: Everything OK.
287 * ASN1_ELEMENT_NOT_FOUND: *@structure was ASN1_TYPE_EMPTY.
291 asn1_delete_structure (ASN1_TYPE
* structure
)
293 node_asn
*p
, *p2
, *p3
;
295 if (*structure
== ASN1_TYPE_EMPTY
)
296 return ASN1_ELEMENT_NOT_FOUND
;
310 p3
= _asn1_find_up (p
);
311 _asn1_set_down (p3
, p2
);
312 _asn1_remove_node (p
);
317 p3
= _asn1_find_left (p
);
320 p3
= _asn1_find_up (p
);
322 _asn1_set_down (p3
, p2
);
326 p
->right
->left
= NULL
;
330 _asn1_set_right (p3
, p2
);
331 _asn1_remove_node (p
);
337 *structure
= ASN1_TYPE_EMPTY
;
344 * asn1_delete_element - Deletes the element of a structure.
345 * @structure: pointer to the structure that contains the element you
347 * @element_name: element's name you want to delete.
349 * Deletes the element named *@element_name inside *@structure.
353 * ASN1_SUCCESS: Everything OK.
355 * ASN1_ELEMENT_NOT_FOUND: The name element was not found.
359 asn1_delete_element (ASN1_TYPE structure
, const char *element_name
)
361 node_asn
*p2
, *p3
, *source_node
;
363 source_node
= asn1_find_node (structure
, element_name
);
365 if (source_node
== ASN1_TYPE_EMPTY
)
366 return ASN1_ELEMENT_NOT_FOUND
;
368 p2
= source_node
->right
;
369 p3
= _asn1_find_left (source_node
);
372 p3
= _asn1_find_up (source_node
);
374 _asn1_set_down (p3
, p2
);
375 else if (source_node
->right
)
376 source_node
->right
->left
= NULL
;
379 _asn1_set_right (p3
, p2
);
381 return asn1_delete_structure (&source_node
);
385 _asn1_copy_structure3 (node_asn
* source_node
)
387 node_asn
*dest_node
, *p_s
, *p_d
, *p_d_prev
;
390 if (source_node
== NULL
)
393 dest_node
= _asn1_add_node_only (source_node
->type
);
405 _asn1_set_name (p_d
, p_s
->name
);
407 _asn1_set_value (p_d
, p_s
->value
, p_s
->value_len
);
419 p_d
= _asn1_add_node_only (p_s
->type
);
420 _asn1_set_down (p_d_prev
, p_d
);
426 if (p_s
== source_node
)
435 p_d
= _asn1_add_node_only (p_s
->type
);
436 _asn1_set_right (p_d_prev
, p_d
);
443 p_s
= _asn1_find_up (p_s
);
444 p_d
= _asn1_find_up (p_d
);
447 while (p_s
!= source_node
);
454 _asn1_copy_structure2 (node_asn
* root
, const char *source_name
)
456 node_asn
*source_node
;
458 source_node
= asn1_find_node (root
, source_name
);
460 return _asn1_copy_structure3 (source_node
);
466 _asn1_type_choice_config (node_asn
* node
)
468 node_asn
*p
, *p2
, *p3
, *p4
;
472 return ASN1_ELEMENT_NOT_FOUND
;
477 while (!((p
== node
) && (move
== UP
)))
481 if ((type_field (p
->type
) == TYPE_CHOICE
) && (p
->type
& CONST_TAG
))
486 if (type_field (p2
->type
) != TYPE_TAG
)
488 p2
->type
|= CONST_TAG
;
489 p3
= _asn1_find_left (p2
);
492 if (type_field (p3
->type
) == TYPE_TAG
)
494 p4
= _asn1_add_node_only (p3
->type
);
495 tlen
= strlen (p3
->value
);
497 _asn1_set_value (p4
, p3
->value
, tlen
+ 1);
498 _asn1_set_right (p4
, p2
->down
);
499 _asn1_set_down (p2
, p4
);
501 p3
= _asn1_find_left (p3
);
506 p
->type
&= ~(CONST_TAG
);
511 if (type_field (p2
->type
) == TYPE_TAG
)
512 asn1_delete_structure (&p2
);
543 p
= _asn1_find_up (p
);
551 _asn1_expand_identifier (node_asn
** node
, node_asn
* root
)
553 node_asn
*p
, *p2
, *p3
;
554 char name2
[MAX_NAME_SIZE
+ 2];
558 return ASN1_ELEMENT_NOT_FOUND
;
563 while (!((p
== *node
) && (move
== UP
)))
567 if (type_field (p
->type
) == TYPE_IDENTIFIER
)
569 _asn1_str_cpy (name2
, sizeof (name2
), root
->name
);
570 _asn1_str_cat (name2
, sizeof (name2
), ".");
571 _asn1_str_cat (name2
, sizeof (name2
), p
->value
);
572 p2
= _asn1_copy_structure2 (root
, name2
);
575 return ASN1_IDENTIFIER_NOT_FOUND
;
577 _asn1_set_name (p2
, p
->name
);
578 p2
->right
= p
->right
;
587 _asn1_set_right (p3
, p2
->down
);
588 _asn1_set_down (p2
, p
->down
);
591 p3
= _asn1_find_left (p
);
593 _asn1_set_right (p3
, p2
);
596 p3
= _asn1_find_up (p
);
598 _asn1_set_down (p3
, p2
);
605 if (p
->type
& CONST_SIZE
)
606 p2
->type
|= CONST_SIZE
;
607 if (p
->type
& CONST_TAG
)
608 p2
->type
|= CONST_TAG
;
609 if (p
->type
& CONST_OPTION
)
610 p2
->type
|= CONST_OPTION
;
611 if (p
->type
& CONST_DEFAULT
)
612 p2
->type
|= CONST_DEFAULT
;
613 if (p
->type
& CONST_SET
)
614 p2
->type
|= CONST_SET
;
615 if (p
->type
& CONST_NOT_USED
)
616 p2
->type
|= CONST_NOT_USED
;
620 _asn1_remove_node (p
);
652 p
= _asn1_find_up (p
);
660 * asn1_create_element - Creates a structure of type SOURCE_NAME.
661 * @definitions: pointer to the structure returned by "parser_asn1" function
662 * @source_name: the name of the type of the new structure (must be
663 * inside p_structure).
664 * @element: pointer to the structure created.
666 * Creates a structure of type @source_name. Example using
669 * rc = asn1_create_structure(cert_def, "PKIX1.Certificate",
674 * ASN1_SUCCESS: Creation OK.
676 * ASN1_ELEMENT_NOT_FOUND: SOURCE_NAME isn't known
679 asn1_create_element (ASN1_TYPE definitions
, const char *source_name
,
685 dest_node
= _asn1_copy_structure2 (definitions
, source_name
);
687 if (dest_node
== NULL
)
688 return ASN1_ELEMENT_NOT_FOUND
;
690 _asn1_set_name (dest_node
, "");
692 res
= _asn1_expand_identifier (&dest_node
, definitions
);
693 _asn1_type_choice_config (dest_node
);
695 *element
= dest_node
;
702 * asn1_print_structure - Prints on the standard output the structure's tree
703 * @out: pointer to the output file (e.g. stdout).
704 * @structure: pointer to the structure that you want to visit.
705 * @name: an element of the structure
706 * @mode: specify how much of the structure to print, can be
707 * %ASN1_PRINT_NAME, %ASN1_PRINT_NAME_TYPE,
708 * %ASN1_PRINT_NAME_TYPE_VALUE, or %ASN1_PRINT_ALL.
710 * Prints on the @out file descriptor the structure's tree starting
711 * from the @name element inside the structure @structure.
714 asn1_print_structure (FILE * out
, ASN1_TYPE structure
, const char *name
,
718 int k
, indent
= 0, len
, len2
, len3
;
723 root
= asn1_find_node (structure
, name
);
731 if (mode
== ASN1_PRINT_ALL
)
733 for (k
= 0; k
< indent
; k
++)
735 fprintf (out
, "name:");
737 fprintf (out
, "%s ", p
->name
);
739 fprintf (out
, "NULL ");
743 switch (type_field (p
->type
))
750 for (k
= 0; k
< indent
; k
++)
752 fprintf (out
, "name:");
754 fprintf (out
, "%s ", p
->name
);
756 fprintf (out
, "NULL ");
760 if (mode
!= ASN1_PRINT_NAME
)
762 switch (type_field (p
->type
))
765 if (mode
== ASN1_PRINT_ALL
)
766 fprintf (out
, "type:CONST");
769 if (mode
== ASN1_PRINT_ALL
)
770 fprintf (out
, "type:TAG");
773 if (mode
== ASN1_PRINT_ALL
)
774 fprintf (out
, "type:SIZE");
777 fprintf (out
, "type:DEFAULT");
780 fprintf (out
, "type:NULL");
782 case TYPE_IDENTIFIER
:
783 fprintf (out
, "type:IDENTIFIER");
786 fprintf (out
, "type:INTEGER");
788 case TYPE_ENUMERATED
:
789 fprintf (out
, "type:ENUMERATED");
792 fprintf (out
, "type:TIME");
795 fprintf (out
, "type:BOOLEAN");
798 fprintf (out
, "type:SEQUENCE");
800 case TYPE_BIT_STRING
:
801 fprintf (out
, "type:BIT_STR");
803 case TYPE_OCTET_STRING
:
804 fprintf (out
, "type:OCT_STR");
806 case TYPE_GENERALSTRING
:
807 fprintf (out
, "type:GENERALSTRING");
809 case TYPE_SEQUENCE_OF
:
810 fprintf (out
, "type:SEQ_OF");
813 fprintf (out
, "type:OBJ_ID");
816 fprintf (out
, "type:ANY");
819 fprintf (out
, "type:SET");
822 fprintf (out
, "type:SET_OF");
825 fprintf (out
, "type:CHOICE");
827 case TYPE_DEFINITIONS
:
828 fprintf (out
, "type:DEFINITIONS");
835 if ((mode
== ASN1_PRINT_NAME_TYPE_VALUE
) || (mode
== ASN1_PRINT_ALL
))
837 switch (type_field (p
->type
))
840 if (mode
== ASN1_PRINT_ALL
)
842 fprintf (out
, " value:%s", p
->value
);
845 if (mode
== ASN1_PRINT_ALL
)
847 fprintf (out
, " value:%s", p
->value
);
850 if (mode
== ASN1_PRINT_ALL
)
852 fprintf (out
, " value:%s", p
->value
);
856 fprintf (out
, " value:%s", p
->value
);
857 else if (p
->type
& CONST_TRUE
)
858 fprintf (out
, " value:TRUE");
859 else if (p
->type
& CONST_FALSE
)
860 fprintf (out
, " value:FALSE");
862 case TYPE_IDENTIFIER
:
864 fprintf (out
, " value:%s", p
->value
);
870 len
= asn1_get_length_der (p
->value
, p
->value_len
, &len2
);
871 fprintf (out
, " value:0x");
873 for (k
= 0; k
< len
; k
++)
874 fprintf (out
, "%02x", (p
->value
)[k
+ len2
]);
877 case TYPE_ENUMERATED
:
881 len
= asn1_get_length_der (p
->value
, p
->value_len
, &len2
);
882 fprintf (out
, " value:0x");
884 for (k
= 0; k
< len
; k
++)
885 fprintf (out
, "%02x", (p
->value
)[k
+ len2
]);
890 fprintf (out
, " value:%s", p
->value
);
895 if (p
->value
[0] == 'T')
896 fprintf (out
, " value:TRUE");
897 else if (p
->value
[0] == 'F')
898 fprintf (out
, " value:FALSE");
901 case TYPE_BIT_STRING
:
905 len
= asn1_get_length_der (p
->value
, p
->value_len
, &len2
);
908 fprintf (out
, " value(%i):",
909 (len
- 1) * 8 - (p
->value
[len2
]));
910 for (k
= 1; k
< len
; k
++)
911 fprintf (out
, "%02x", (p
->value
)[k
+ len2
]);
915 case TYPE_OCTET_STRING
:
919 len
= asn1_get_length_der (p
->value
, p
->value_len
, &len2
);
920 fprintf (out
, " value:");
922 for (k
= 0; k
< len
; k
++)
923 fprintf (out
, "%02x", (p
->value
)[k
+ len2
]);
926 case TYPE_GENERALSTRING
:
930 len
= asn1_get_length_der (p
->value
, p
->value_len
, &len2
);
931 fprintf (out
, " value:");
933 for (k
= 0; k
< len
; k
++)
934 fprintf (out
, "%02x", (p
->value
)[k
+ len2
]);
939 fprintf (out
, " value:%s", p
->value
);
945 len2
= asn1_get_length_der (p
->value
, p
->value_len
, &len3
);
946 fprintf (out
, " value:");
948 for (k
= 0; k
< len2
; k
++)
949 fprintf (out
, "%02x", (p
->value
)[k
+ len3
]);
955 case TYPE_DEFINITIONS
:
956 case TYPE_SEQUENCE_OF
:
965 if (mode
== ASN1_PRINT_ALL
)
967 if (p
->type
& 0x1FFFFF00)
969 fprintf (out
, " attr:");
970 if (p
->type
& CONST_UNIVERSAL
)
971 fprintf (out
, "UNIVERSAL,");
972 if (p
->type
& CONST_PRIVATE
)
973 fprintf (out
, "PRIVATE,");
974 if (p
->type
& CONST_APPLICATION
)
975 fprintf (out
, "APPLICATION,");
976 if (p
->type
& CONST_EXPLICIT
)
977 fprintf (out
, "EXPLICIT,");
978 if (p
->type
& CONST_IMPLICIT
)
979 fprintf (out
, "IMPLICIT,");
980 if (p
->type
& CONST_TAG
)
981 fprintf (out
, "TAG,");
982 if (p
->type
& CONST_DEFAULT
)
983 fprintf (out
, "DEFAULT,");
984 if (p
->type
& CONST_TRUE
)
985 fprintf (out
, "TRUE,");
986 if (p
->type
& CONST_FALSE
)
987 fprintf (out
, "FALSE,");
988 if (p
->type
& CONST_LIST
)
989 fprintf (out
, "LIST,");
990 if (p
->type
& CONST_MIN_MAX
)
991 fprintf (out
, "MIN_MAX,");
992 if (p
->type
& CONST_OPTION
)
993 fprintf (out
, "OPTION,");
994 if (p
->type
& CONST_1_PARAM
)
995 fprintf (out
, "1_PARAM,");
996 if (p
->type
& CONST_SIZE
)
997 fprintf (out
, "SIZE,");
998 if (p
->type
& CONST_DEFINED_BY
)
999 fprintf (out
, "DEF_BY,");
1000 if (p
->type
& CONST_GENERALIZED
)
1001 fprintf (out
, "GENERALIZED,");
1002 if (p
->type
& CONST_UTC
)
1003 fprintf (out
, "UTC,");
1004 if (p
->type
& CONST_SET
)
1005 fprintf (out
, "SET,");
1006 if (p
->type
& CONST_NOT_USED
)
1007 fprintf (out
, "NOT_USED,");
1008 if (p
->type
& CONST_ASSIGN
)
1009 fprintf (out
, "ASSIGNMENT,");
1013 if (mode
== ASN1_PRINT_ALL
)
1015 fprintf (out
, "\n");
1019 switch (type_field (p
->type
))
1026 fprintf (out
, "\n");
1046 p
= _asn1_find_up (p
);
1066 * asn1_number_of_elements - Counts the number of elements of a structure.
1067 * @element: pointer to the root of an ASN1 structure.
1068 * @name: the name of a sub-structure of ROOT.
1069 * @num: pointer to an integer where the result will be stored
1071 * Counts the number of elements of a sub-structure called NAME with
1072 * names equal to "?1","?2", ...
1076 * ASN1_SUCCESS: Creation OK.
1078 * ASN1_ELEMENT_NOT_FOUND: NAME isn't known.
1080 * ASN1_GENERIC_ERROR: Pointer num equal to NULL.
1084 asn1_number_of_elements (ASN1_TYPE element
, const char *name
, int *num
)
1089 return ASN1_GENERIC_ERROR
;
1093 node
= asn1_find_node (element
, name
);
1095 return ASN1_ELEMENT_NOT_FOUND
;
1101 if ((p
->name
) && (p
->name
[0] == '?'))
1106 return ASN1_SUCCESS
;
1111 * asn1_find_structure_from_oid - Locate structure defined by a specific OID.
1112 * @definitions: ASN1 definitions
1113 * @oidValue: value of the OID to search (e.g. "1.2.3.4").
1115 * Search the structure that is defined just after an OID definition.
1117 * Returns: NULL when OIDVALUE not found, otherwise the pointer to a
1118 * constant string that contains the element name defined just
1123 asn1_find_structure_from_oid (ASN1_TYPE definitions
, const char *oidValue
)
1125 char definitionsName
[MAX_NAME_SIZE
], name
[2 * MAX_NAME_SIZE
+ 1];
1126 char value
[MAX_NAME_SIZE
];
1129 asn1_retCode result
;
1131 if ((definitions
== ASN1_TYPE_EMPTY
) || (oidValue
== NULL
))
1132 return NULL
; /* ASN1_ELEMENT_NOT_FOUND; */
1135 strcpy (definitionsName
, definitions
->name
);
1136 strcat (definitionsName
, ".");
1138 /* search the OBJECT_ID into definitions */
1139 p
= definitions
->down
;
1142 if ((type_field (p
->type
) == TYPE_OBJECT_ID
) &&
1143 (p
->type
& CONST_ASSIGN
))
1145 strcpy (name
, definitionsName
);
1146 strcat (name
, p
->name
);
1148 len
= MAX_NAME_SIZE
;
1149 result
= asn1_read_value (definitions
, name
, value
, &len
);
1151 if ((result
== ASN1_SUCCESS
) && (!strcmp (oidValue
, value
)))
1154 if (p
== NULL
) /* reach the end of ASN1 definitions */
1155 return NULL
; /* ASN1_ELEMENT_NOT_FOUND; */
1163 return NULL
; /* ASN1_ELEMENT_NOT_FOUND; */
1168 * @dst: Destination ASN1_TYPE node.
1169 * @dst_name: Field name in destination node.
1170 * @src: Source ASN1_TYPE node.
1171 * @src_name: Field name in source node.
1173 * Create a deep copy of a ASN1_TYPE variable.
1175 * Return value: Return ASN1_SUCCESS on success.
1178 asn1_copy_node (ASN1_TYPE dst
, const char *dst_name
,
1179 ASN1_TYPE src
, const char *src_name
)
1181 /* FIXME: rewrite using copy_structure().
1182 * It seems quite hard to do.
1189 result
= asn1_der_coding (src
, src_name
, NULL
, &size
, NULL
);
1190 if (result
!= ASN1_MEM_ERROR
)
1193 data
= _asn1_malloc (size
);
1195 return ASN1_MEM_ERROR
;
1197 result
= asn1_der_coding (src
, src_name
, data
, &size
, NULL
);
1198 if (result
!= ASN1_SUCCESS
)
1204 dst_node
= asn1_find_node (dst
, dst_name
);
1205 if (dst_node
== NULL
)
1208 return ASN1_ELEMENT_NOT_FOUND
;
1211 result
= asn1_der_decoding (&dst_node
, data
, size
, NULL
);