1 /* crypto/asn1/asn1.h */
2 /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
70 #define V_ASN1_UNIVERSAL 0x00
71 #define V_ASN1_APPLICATION 0x40
72 #define V_ASN1_CONTEXT_SPECIFIC 0x80
73 #define V_ASN1_PRIVATE 0xc0
75 #define V_ASN1_CONSTRUCTED 0x20
76 #define V_ASN1_PRIMATIVE_TAG 0x1f
78 #define V_ASN1_APP_CHOOSE -2 /* let the recipent choose */
80 #define V_ASN1_UNDEF -1
82 #define V_ASN1_BOOLEAN 1 /**/
83 #define V_ASN1_INTEGER 2
84 #define V_ASN1_NEG_INTEGER (2+0x100)
85 #define V_ASN1_BIT_STRING 3
86 #define V_ASN1_OCTET_STRING 4
88 #define V_ASN1_OBJECT 6
90 #define V_ASN1_ENUMERATED 10 /* microsoft weirdness */
91 #define V_ASN1_SEQUENCE 16
93 #define V_ASN1_NUMERICSTRING 18 /**/
94 #define V_ASN1_PRINTABLESTRING 19
95 #define V_ASN1_T61STRING 20
96 #define V_ASN1_TELETEXSTRING 20 /* alias */
97 #define V_ASN1_VIDEOTEXSTRING 21 /**/
98 #define V_ASN1_IA5STRING 22
99 #define V_ASN1_UTCTIME 23
100 #define V_ASN1_GENERALIZEDTIME 24 /**/
101 #define V_ASN1_GRAPHICSTRING 25 /**/
102 #define V_ASN1_ISO64STRING 26 /**/
103 #define V_ASN1_VISIBLESTRING 26 /* alias */
104 #define V_ASN1_GENERALSTRING 27 /**/
105 #define V_ASN1_UNIVERSALSTRING 28 /**/
107 /* For use with d2i_ASN1_type_bytes() */
108 #define B_ASN1_NUMERICSTRING 0x0001
109 #define B_ASN1_PRINTABLESTRING 0x0002
110 #define B_ASN1_T61STRING 0x0004
111 #define B_ASN1_VIDEOTEXSTRING 0x0008
112 #define B_ASN1_IA5STRING 0x0010
113 #define B_ASN1_GRAPHICSTRING 0x0020
114 #define B_ASN1_ISO64STRING 0x0040
115 #define B_ASN1_GENERALSTRING 0x0080
116 #define B_ASN1_UNIVERSALSTRING 0x0100
117 #define B_ASN1_OCTET_STRING 0x0200
118 #define B_ASN1_UNKNOWN 0x1000
122 #define ASN1_INTEGER ASN1_STRING
123 #define ASN1_BIT_STRING ASN1_STRING
124 #define ASN1_OCTET_STRING ASN1_STRING
125 #define ASN1_PRINTABLESTRING ASN1_STRING
126 #define ASN1_T61STRING ASN1_STRING
127 #define ASN1_IA5STRING ASN1_STRING
128 #define ASN1_UTCTIME ASN1_STRING
129 #define ASN1_GENERALSTRING ASN1_STRING
130 #define ASN1_UNIVERSALSTRING ASN1_STRING
134 typedef struct asn1_integer_st
141 typedef struct asn1_bit_string_st
148 typedef struct asn1_octet_string_st
155 typedef struct asn1_printablestring_st
160 } ASN1_PRINTABLESTRING;
162 typedef struct asn1_t61string_st
169 typedef struct asn1_ia5string_st
176 typedef struct asn1_generalstring_st
181 } ASN1_GENERALSTRING;
183 typedef struct asn1_universalstring_st
188 } ASN1_UNIVERSALSTRING;
190 typedef struct asn1_utctime_st
199 typedef struct asn1_ctx_st
201 unsigned char *p;/* work char pointer */
202 int eos; /* end of sequence read for indefinite encoding */
203 int error; /* error code to use when returning an error */
204 int inf; /* constructed if 0x20, indefinite is 0x21 */
205 int tag; /* tag from last 'get object' */
206 int xclass; /* class from last 'get object' */
207 long slen; /* length of last 'get object' */
208 unsigned char *max; /* largest value of p alowed */
209 unsigned char *q;/* temporary variable */
210 unsigned char **pp;/* variable */
213 /* These are used internally in the ASN1_OBJECT to keep track of
214 * whether the names and data need to be free()ed */
215 #define ASN1_OBJECT_FLAG_DYNAMIC 0x01 /* internal use */
216 #define ASN1_OBJECT_FLAG_CRITICAL 0x02 /* critical x509v3 object id */
217 #define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04 /* internal use */
218 #define ASN1_OBJECT_FLAG_DYNAMIC_DATA 0x08 /* internal use */
219 typedef struct asn1_object_st
225 int flags; /* Should we free this one */
228 /* This is the base type that holds just about everything :-) */
229 typedef struct asn1_string_st
236 typedef struct asn1_type_st
241 ASN1_STRING * asn1_string;
242 ASN1_OBJECT * object;
243 ASN1_INTEGER * integer;
244 ASN1_BIT_STRING * bit_string;
245 ASN1_OCTET_STRING * octet_string;
246 ASN1_PRINTABLESTRING * printablestring;
247 ASN1_T61STRING * t61string;
248 ASN1_IA5STRING * ia5string;
249 ASN1_GENERALSTRING * generalstring;
250 ASN1_UNIVERSALSTRING * universalstring;
251 ASN1_UTCTIME * utctime;
252 /* set and sequence are left complete and still
253 * contain the set or sequence bytes */
255 ASN1_STRING * sequence;
259 typedef struct asn1_method_st
267 /* This is used when parsing some Netscape objects */
268 typedef struct asn1_header_st
270 ASN1_OCTET_STRING *header;
275 #define ASN1_STRING_type(x) ((x)->type)
276 #define ASN1_STRING_data(x) ((x)->data)
278 /* Macros for string operations */
279 #define ASN1_BIT_STRING_new() (ASN1_BIT_STRING *)\
280 ASN1_STRING_type_new(V_ASN1_BIT_STRING)
281 #define ASN1_BIT_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
282 #define ASN1_BIT_STRING_dup(a) (ASN1_BIT_STRING *)\
283 ASN1_STRING_dup((ASN1_STRING *)a)
284 #define ASN1_BIT_STRING_cmp(a,b) ASN1_STRING_cmp(\
285 (ASN1_STRING *)a,(ASN1_STRING *)b)
286 #define ASN1_BIT_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c)
287 /* i2d_ASN1_BIT_STRING() is a function */
288 /* d2i_ASN1_BIT_STRING() is a function */
290 #define ASN1_INTEGER_new() (ASN1_INTEGER *)\
291 ASN1_STRING_type_new(V_ASN1_INTEGER)
292 #define ASN1_INTEGER_free(a) ASN1_STRING_free((ASN1_STRING *)a)
293 #define ASN1_INTEGER_dup(a) (ASN1_INTEGER *)ASN1_STRING_dup((ASN1_STRING *)a)
294 #define ASN1_INTEGER_cmp(a,b) ASN1_STRING_cmp(\
295 (ASN1_STRING *)a,(ASN1_STRING *)b)
296 /* ASN1_INTEGER_set() is a function, also see BN_to_ASN1_INTEGER() */
297 /* ASN1_INTEGER_get() is a function, also see ASN1_INTEGER_to_BN() */
298 /* i2d_ASN1_INTEGER() is a function */
299 /* d2i_ASN1_INTEGER() is a function */
301 #define ASN1_OCTET_STRING_new() (ASN1_OCTET_STRING *)\
302 ASN1_STRING_type_new(V_ASN1_OCTET_STRING)
303 #define ASN1_OCTET_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
304 #define ASN1_OCTET_STRING_dup(a) (ASN1_OCTET_STRING *)\
305 ASN1_STRING_dup((ASN1_STRING *)a)
306 #define ASN1_OCTET_STRING_cmp(a,b) ASN1_STRING_cmp(\
307 (ASN1_STRING *)a,(ASN1_STRING *)b)
308 #define ASN1_OCTET_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c)
309 #define ASN1_OCTET_STRING_print(a,b) ASN1_STRING_print(a,(ASN1_STRING *)b)
310 #define M_i2d_ASN1_OCTET_STRING(a,pp) \
311 i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_OCTET_STRING,\
313 /* d2i_ASN1_OCTET_STRING() is a function */
315 #define ASN1_PRINTABLE_new() ASN1_STRING_type_new(V_ASN1_T61STRING)
316 #define ASN1_PRINTABLE_free(a) ASN1_STRING_free((ASN1_STRING *)a)
317 #define M_i2d_ASN1_PRINTABLE(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\
318 pp,a->type,V_ASN1_UNIVERSAL)
319 #define M_d2i_ASN1_PRINTABLE(a,pp,l) \
320 d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \
321 B_ASN1_PRINTABLESTRING| \
324 B_ASN1_UNIVERSALSTRING|\
327 #define ASN1_PRINTABLESTRING_new() (ASN1_PRINTABLESTRING_STRING *)\
328 ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING)
329 #define ASN1_PRINTABLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
330 #define M_i2d_ASN1_PRINTABLESTRING(a,pp) \
331 i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_PRINTABLESTRING,\
333 #define M_d2i_ASN1_PRINTABLESTRING(a,pp,l) \
334 (ASN1_PRINTABLESTRING *)d2i_ASN1_type_bytes\
335 ((ASN1_STRING **)a,pp,l,B_ASN1_PRINTABLESTRING)
337 #define ASN1_T61STRING_new() (ASN1_T61STRING_STRING *)\
338 ASN1_STRING_type_new(V_ASN1_T61STRING)
339 #define ASN1_T61STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
340 #define M_i2d_ASN1_T61STRING(a,pp) \
341 i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_T61STRING,\
343 #define M_d2i_ASN1_T61STRING(a,pp,l) \
344 (ASN1_T61STRING *)d2i_ASN1_type_bytes\
345 ((ASN1_STRING **)a,pp,l,B_ASN1_T61STRING)
347 #define ASN1_IA5STRING_new() (ASN1_IA5STRING *)\
348 ASN1_STRING_type_new(V_ASN1_IA5STRING)
349 #define ASN1_IA5STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
350 #define M_i2d_ASN1_IA5STRING(a,pp) \
351 i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_IA5STRING,\
353 #define M_d2i_ASN1_IA5STRING(a,pp,l) \
354 (ASN1_IA5STRING *)d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l,\
357 #define ASN1_UTCTIME_new() (ASN1_UTCTIME *)\
358 ASN1_STRING_type_new(V_ASN1_UTCTIME)
359 #define ASN1_UTCTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a)
360 #define ASN1_UTCTIME_dup(a) (ASN1_UTCTIME *)ASN1_STRING_dup((ASN1_STRING *)a)
361 /* i2d_ASN1_UTCTIME() is a function */
362 /* d2i_ASN1_UTCTIME() is a function */
363 /* ASN1_UTCTIME_set() is a function */
364 /* ASN1_UTCTIME_check() is a function */
365 /* ASN1_UTCTIME_set() is a function */
367 #define ASN1_GENERALSTRING_new() (ASN1_GENERALSTRING *)\
368 ASN1_STRING_type_new(V_ASN1_GENERALSTRING)
369 #define ASN1_GENERALSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
370 #define M_i2d_ASN1_GENERALSTRING(a,pp) \
371 i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_GENERALSTRING,\
373 #define M_d2i_ASN1_GENERALSTRING(a,pp,l) \
374 (ASN1_GENERALSTRING *)d2i_ASN1_type_bytes\
375 ((ASN1_STRING **)a,pp,l,B_ASN1_GENERALSTRING)
377 #define ASN1_UNIVERSALSTRING_new() (ASN1_UNIVERSALSTRING *)\
378 ASN1_STRING_type_new(V_ASN1_UNIVERSALSTRING)
379 #define ASN1_UNIVERSALSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
380 #define M_i2d_ASN1_UNIVERSALSTRING(a,pp) \
381 i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UNIVERSALSTRING,\
383 #define M_d2i_ASN1_UNIVERSALSTRING(a,pp,l) \
384 (ASN1_UNIVERSALSTRING *)d2i_ASN1_type_bytes\
385 ((ASN1_STRING **)a,pp,l,B_ASN1_UNIVERSALSTRING)
388 ASN1_TYPE * ASN1_TYPE_new(void );
389 void ASN1_TYPE_free(ASN1_TYPE *a);
390 int i2d_ASN1_TYPE(ASN1_TYPE *a,unsigned char **pp);
391 ASN1_TYPE * d2i_ASN1_TYPE(ASN1_TYPE **a,unsigned char **pp,long length);
392 int ASN1_TYPE_get(ASN1_TYPE *a);
393 void ASN1_TYPE_set(ASN1_TYPE *a, int type, char *value);
395 ASN1_OBJECT * ASN1_OBJECT_new(void );
396 void ASN1_OBJECT_free(ASN1_OBJECT *a);
397 int i2d_ASN1_OBJECT(ASN1_OBJECT *a,unsigned char **pp);
398 ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,unsigned char **pp,
401 ASN1_STRING * ASN1_STRING_new(void );
402 void ASN1_STRING_free(ASN1_STRING *a);
403 ASN1_STRING * ASN1_STRING_dup(ASN1_STRING *a);
404 ASN1_STRING * ASN1_STRING_type_new(int type );
405 int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b);
406 int ASN1_STRING_set(ASN1_STRING *str,unsigned char *data, int len);
408 int i2d_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp);
409 ASN1_BIT_STRING *d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,unsigned char **pp,
412 int i2d_ASN1_BOOLEAN(int a,unsigned char **pp);
413 int d2i_ASN1_BOOLEAN(int *a,unsigned char **pp,long length);
415 int i2d_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp);
416 ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a,unsigned char **pp,
419 int ASN1_UTCTIME_check(ASN1_UTCTIME *a);
420 ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t);
422 int i2d_ASN1_OCTET_STRING(ASN1_OCTET_STRING *a,unsigned char **pp);
423 ASN1_OCTET_STRING *d2i_ASN1_OCTET_STRING(ASN1_OCTET_STRING **a,
424 unsigned char **pp,long length);
426 int i2d_ASN1_PRINTABLE(ASN1_STRING *a,unsigned char **pp);
427 ASN1_STRING *d2i_ASN1_PRINTABLE(ASN1_STRING **a,
428 unsigned char **pp, long l);
429 ASN1_PRINTABLESTRING *d2i_ASN1_PRINTABLESTRING(ASN1_PRINTABLESTRING **a,
430 unsigned char **pp, long l);
432 ASN1_T61STRING *d2i_ASN1_T61STRING(ASN1_T61STRING **a,
433 unsigned char **pp, long l);
434 int i2d_ASN1_IA5STRING(ASN1_IA5STRING *a,unsigned char **pp);
435 ASN1_IA5STRING *d2i_ASN1_IA5STRING(ASN1_IA5STRING **a,
436 unsigned char **pp, long l);
438 int i2d_ASN1_UTCTIME(ASN1_UTCTIME *a,unsigned char **pp);
439 ASN1_UTCTIME * d2i_ASN1_UTCTIME(ASN1_UTCTIME **a,unsigned char **pp,
442 int i2d_ASN1_SET(STACK *a, unsigned char **pp,
443 int (*func)(), int ex_tag, int ex_class);
444 STACK * d2i_ASN1_SET(STACK **a, unsigned char **pp, long length,
445 char *(*func)(), int ex_tag, int ex_class);
448 int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a);
449 int a2i_ASN1_INTEGER(BIO *bp,ASN1_INTEGER *bs,char *buf,int size);
450 int i2a_ASN1_OBJECT(BIO *bp,ASN1_OBJECT *a);
451 int a2i_ASN1_STRING(BIO *bp,ASN1_STRING *bs,char *buf,int size);
452 int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type);
455 int a2d_ASN1_OBJECT(unsigned char *out,int olen, char *buf, int num);
456 ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len,
459 int ASN1_INTEGER_set(ASN1_INTEGER *a, long v);
460 long ASN1_INTEGER_get(ASN1_INTEGER *a);
461 ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai);
462 BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai,BIGNUM *bn);
465 /* given a string, return the correct type, max is the maximum length */
466 int ASN1_PRINTABLE_type(unsigned char *s, int max);
468 int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass);
469 ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp,
470 long length, int Ptag, int Pclass);
471 /* type is one or more of the B_ASN1_ values. */
472 ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a,unsigned char **pp,
473 long length,int type);
476 int asn1_Finish(ASN1_CTX *c);
479 int ASN1_get_object(unsigned char **pp, long *plength, int *ptag,
480 int *pclass, long omax);
481 int ASN1_check_infinite_end(unsigned char **p,long len);
482 void ASN1_put_object(unsigned char **pp, int constructed, int length,
483 int tag, int xclass);
484 int ASN1_object_size(int constructed, int length, int tag);
486 /* Used to implement other functions */
487 char *ASN1_dup(int (*i2d)(),char *(*d2i)(),char *x);
490 char *ASN1_d2i_fp(char *(*xnew)(),char *(*d2i)(),FILE *fp,unsigned char **x);
491 int ASN1_i2d_fp(int (*i2d)(),FILE *out,unsigned char *x);
495 char *ASN1_d2i_bio(char *(*xnew)(),char *(*d2i)(),BIO *bp,unsigned char **x);
496 int ASN1_i2d_bio(int (*i2d)(),BIO *out,unsigned char *x);
497 int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a);
498 int ASN1_STRING_print(BIO *bp,ASN1_STRING *v);
499 int ASN1_parse(BIO *bp,unsigned char *pp,long len,int indent);
502 /* Used to load and write netscape format cert/key */
503 int i2d_ASN1_HEADER(ASN1_HEADER *a,unsigned char **pp);
504 ASN1_HEADER *d2i_ASN1_HEADER(ASN1_HEADER **a,unsigned char **pp, long length);
505 ASN1_HEADER *ASN1_HEADER_new(void );
506 void ASN1_HEADER_free(ASN1_HEADER *a);
508 int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s);
510 void ERR_load_ASN1_strings(void);
512 /* Not used that much at this point, except for the first two */
513 ASN1_METHOD *X509_asn1_meth(void);
514 ASN1_METHOD *RSAPrivateKey_asn1_meth(void);
515 ASN1_METHOD *ASN1_IA5STRING_asn1_meth(void);
516 ASN1_METHOD *ASN1_BIT_STRING_asn1_meth(void);
520 ASN1_TYPE * ASN1_TYPE_new();
521 void ASN1_TYPE_free();
523 ASN1_TYPE * d2i_ASN1_TYPE();
525 void ASN1_TYPE_set();
527 ASN1_OBJECT * ASN1_OBJECT_new();
528 void ASN1_OBJECT_free();
529 int i2d_ASN1_OBJECT();
530 ASN1_OBJECT * d2i_ASN1_OBJECT();
531 ASN1_STRING * ASN1_STRING_new();
532 void ASN1_STRING_free();
533 ASN1_STRING * ASN1_STRING_dup();
534 ASN1_STRING * ASN1_STRING_type_new();
535 int ASN1_STRING_cmp();
536 int ASN1_STRING_set();
537 int i2d_ASN1_BIT_STRING();
538 ASN1_BIT_STRING *d2i_ASN1_BIT_STRING();
539 int i2d_ASN1_BOOLEAN();
540 int d2i_ASN1_BOOLEAN();
541 int i2d_ASN1_INTEGER();
542 ASN1_INTEGER *d2i_ASN1_INTEGER();
543 int ASN1_UTCTIME_check();
544 ASN1_UTCTIME *ASN1_UTCTIME_set();
545 int i2d_ASN1_OCTET_STRING();
546 ASN1_OCTET_STRING *d2i_ASN1_OCTET_STRING();
547 int i2d_ASN1_PRINTABLE();
548 ASN1_STRING *d2i_ASN1_PRINTABLE();
549 ASN1_PRINTABLESTRING *d2i_ASN1_PRINTABLESTRING();
550 ASN1_T61STRING *d2i_ASN1_T61STRING();
551 int i2d_ASN1_IA5STRING();
552 ASN1_IA5STRING *d2i_ASN1_IA5STRING();
553 int i2d_ASN1_UTCTIME();
554 ASN1_UTCTIME * d2i_ASN1_UTCTIME();
556 STACK * d2i_ASN1_SET();
557 int a2d_ASN1_OBJECT();
558 ASN1_OBJECT *ASN1_OBJECT_create();
559 int ASN1_INTEGER_set();
560 long ASN1_INTEGER_get();
561 ASN1_INTEGER *BN_to_ASN1_INTEGER();
562 BIGNUM *ASN1_INTEGER_to_BN();
563 int ASN1_PRINTABLE_type();
564 int i2d_ASN1_bytes();
565 ASN1_STRING *d2i_ASN1_bytes();
566 ASN1_STRING *d2i_ASN1_type_bytes();
568 int ASN1_get_object();
569 int ASN1_check_infinite_end();
570 void ASN1_put_object();
571 int ASN1_object_size();
578 char *ASN1_d2i_bio();
580 int ASN1_UTCTIME_print();
581 int ASN1_STRING_print();
583 int i2a_ASN1_INTEGER();
584 int a2i_ASN1_INTEGER();
585 int i2a_ASN1_OBJECT();
586 int a2i_ASN1_STRING();
587 int i2a_ASN1_STRING();
589 int i2d_ASN1_HEADER();
590 ASN1_HEADER *d2i_ASN1_HEADER();
591 ASN1_HEADER *ASN1_HEADER_new();
592 void ASN1_HEADER_free();
593 void ERR_load_ASN1_strings();
594 ASN1_METHOD *X509_asn1_meth();
595 ASN1_METHOD *RSAPrivateKey_asn1_meth();
596 ASN1_METHOD *ASN1_IA5STRING_asn1_meth();
597 ASN1_METHOD *ASN1_BIT_STRING_asn1_meth();
599 int ASN1_UNIVERSALSTRING_to_string();
602 /* BEGIN ERROR CODES */
603 /* Error codes for the ASN1 functions. */
605 /* Function codes. */
606 #define ASN1_F_A2D_ASN1_OBJECT 100
607 #define ASN1_F_A2I_ASN1_INTEGER 101
608 #define ASN1_F_A2I_ASN1_STRING 102
609 #define ASN1_F_ASN1_COLLATE_PRIMATIVE 103
610 #define ASN1_F_ASN1_D2I_BIO 104
611 #define ASN1_F_ASN1_D2I_FP 105
612 #define ASN1_F_ASN1_DUP 106
613 #define ASN1_F_ASN1_GET_OBJECT 107
614 #define ASN1_F_ASN1_HEADER_NEW 108
615 #define ASN1_F_ASN1_I2D_BIO 109
616 #define ASN1_F_ASN1_I2D_FP 110
617 #define ASN1_F_ASN1_INTEGER_SET 111
618 #define ASN1_F_ASN1_INTEGER_TO_BN 112
619 #define ASN1_F_ASN1_OBJECT_NEW 113
620 #define ASN1_F_ASN1_SIGN 114
621 #define ASN1_F_ASN1_STRING_NEW 115
622 #define ASN1_F_ASN1_STRING_TYPE_NEW 116
623 #define ASN1_F_ASN1_TYPE_NEW 117
624 #define ASN1_F_ASN1_UTCTIME_NEW 118
625 #define ASN1_F_ASN1_VERIFY 119
626 #define ASN1_F_BN_TO_ASN1_INTEGER 120
627 #define ASN1_F_D2I_ASN1_BIT_STRING 121
628 #define ASN1_F_D2I_ASN1_BOOLEAN 122
629 #define ASN1_F_D2I_ASN1_BYTES 123
630 #define ASN1_F_D2I_ASN1_HEADER 124
631 #define ASN1_F_D2I_ASN1_INTEGER 125
632 #define ASN1_F_D2I_ASN1_OBJECT 126
633 #define ASN1_F_D2I_ASN1_OCTET_STRING 127
634 #define ASN1_F_D2I_ASN1_PRINT_TYPE 128
635 #define ASN1_F_D2I_ASN1_SET 129
636 #define ASN1_F_D2I_ASN1_TYPE 130
637 #define ASN1_F_D2I_ASN1_TYPE_BYTES 131
638 #define ASN1_F_D2I_ASN1_UTCTIME 132
639 #define ASN1_F_D2I_DHPARAMS 133
640 #define ASN1_F_D2I_DSAPARAMS 134
641 #define ASN1_F_D2I_DSAPRIVATEKEY 135
642 #define ASN1_F_D2I_DSAPUBLICKEY 136
643 #define ASN1_F_D2I_NETSCAPE_PKEY 137
644 #define ASN1_F_D2I_NETSCAPE_RSA 138
645 #define ASN1_F_D2I_NETSCAPE_RSA_2 139
646 #define ASN1_F_D2I_NETSCAPE_SPKAC 140
647 #define ASN1_F_D2I_NETSCAPE_SPKI 141
648 #define ASN1_F_D2I_PKCS7 142
649 #define ASN1_F_D2I_PKCS7_DIGEST 143
650 #define ASN1_F_D2I_PKCS7_ENCRYPT 144
651 #define ASN1_F_D2I_PKCS7_ENC_CONTENT 145
652 #define ASN1_F_D2I_PKCS7_ENVELOPE 146
653 #define ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL 147
654 #define ASN1_F_D2I_PKCS7_RECIP_INFO 148
655 #define ASN1_F_D2I_PKCS7_SIGNED 149
656 #define ASN1_F_D2I_PKCS7_SIGNER_INFO 150
657 #define ASN1_F_D2I_PKCS7_SIGN_ENVELOPE 151
658 #define ASN1_F_D2I_PRIVATEKEY 152
659 #define ASN1_F_D2I_PUBLICKEY 153
660 #define ASN1_F_D2I_RSAPRIVATEKEY 154
661 #define ASN1_F_D2I_RSAPUBLICKEY 155
662 #define ASN1_F_D2I_X509 156
663 #define ASN1_F_D2I_X509_ALGOR 157
664 #define ASN1_F_D2I_X509_ATTRIBUTE 158
665 #define ASN1_F_D2I_X509_CINF 159
666 #define ASN1_F_D2I_X509_CRL 160
667 #define ASN1_F_D2I_X509_CRL_INFO 161
668 #define ASN1_F_D2I_X509_EXTENSION 162
669 #define ASN1_F_D2I_X509_KEY 163
670 #define ASN1_F_D2I_X509_NAME 164
671 #define ASN1_F_D2I_X509_NAME_ENTRY 165
672 #define ASN1_F_D2I_X509_PKEY 166
673 #define ASN1_F_D2I_X509_PUBKEY 167
674 #define ASN1_F_D2I_X509_REQ 168
675 #define ASN1_F_D2I_X509_REQ_INFO 169
676 #define ASN1_F_D2I_X509_REVOKED 170
677 #define ASN1_F_D2I_X509_SIG 171
678 #define ASN1_F_D2I_X509_VAL 172
679 #define ASN1_F_I2A_ASN1_OBJECT 173
680 #define ASN1_F_I2D_ASN1_HEADER 174
681 #define ASN1_F_I2D_DHPARAMS 175
682 #define ASN1_F_I2D_DSAPARAMS 176
683 #define ASN1_F_I2D_DSAPRIVATEKEY 177
684 #define ASN1_F_I2D_DSAPUBLICKEY 178
685 #define ASN1_F_I2D_NETSCAPE_RSA 179
686 #define ASN1_F_I2D_PKCS7 180
687 #define ASN1_F_I2D_PRIVATEKEY 181
688 #define ASN1_F_I2D_PUBLICKEY 182
689 #define ASN1_F_I2D_RSAPRIVATEKEY 183
690 #define ASN1_F_I2D_RSAPUBLICKEY 184
691 #define ASN1_F_I2D_X509_ATTRIBUTE 185
692 #define ASN1_F_NETSCAPE_PKEY_NEW 186
693 #define ASN1_F_NETSCAPE_SPKAC_NEW 187
694 #define ASN1_F_NETSCAPE_SPKI_NEW 188
695 #define ASN1_F_PKCS7_DIGEST_NEW 189
696 #define ASN1_F_PKCS7_ENCRYPT_NEW 190
697 #define ASN1_F_PKCS7_ENC_CONTENT_NEW 191
698 #define ASN1_F_PKCS7_ENVELOPE_NEW 192
699 #define ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW 193
700 #define ASN1_F_PKCS7_NEW 194
701 #define ASN1_F_PKCS7_RECIP_INFO_NEW 195
702 #define ASN1_F_PKCS7_SIGNED_NEW 196
703 #define ASN1_F_PKCS7_SIGNER_INFO_NEW 197
704 #define ASN1_F_PKCS7_SIGN_ENVELOPE_NEW 198
705 #define ASN1_F_X509_ALGOR_NEW 199
706 #define ASN1_F_X509_ATTRIBUTE_NEW 200
707 #define ASN1_F_X509_CINF_NEW 201
708 #define ASN1_F_X509_CRL_INFO_NEW 202
709 #define ASN1_F_X509_CRL_NEW 203
710 #define ASN1_F_X509_DHPARAMS_NEW 204
711 #define ASN1_F_X509_EXTENSION_NEW 205
712 #define ASN1_F_X509_INFO_NEW 206
713 #define ASN1_F_X509_KEY_NEW 207
714 #define ASN1_F_X509_NAME_ENTRY_NEW 208
715 #define ASN1_F_X509_NAME_NEW 209
716 #define ASN1_F_X509_NEW 210
717 #define ASN1_F_X509_PKEY_NEW 211
718 #define ASN1_F_X509_PUBKEY_NEW 212
719 #define ASN1_F_X509_REQ_INFO_NEW 213
720 #define ASN1_F_X509_REQ_NEW 214
721 #define ASN1_F_X509_REVOKED_NEW 215
722 #define ASN1_F_X509_SIG_NEW 216
723 #define ASN1_F_X509_VAL_FREE 217
724 #define ASN1_F_X509_VAL_NEW 218
727 #define ASN1_R_BAD_CLASS 100
728 #define ASN1_R_BAD_GET_OBJECT 101
729 #define ASN1_R_BAD_OBJECT_HEADER 102
730 #define ASN1_R_BAD_PASSWORD_READ 103
731 #define ASN1_R_BAD_PKCS7_CONTENT 104
732 #define ASN1_R_BAD_PKCS7_TYPE 105
733 #define ASN1_R_BAD_TAG 106
734 #define ASN1_R_BAD_TYPE 107
735 #define ASN1_R_BN_LIB 108
736 #define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 109
737 #define ASN1_R_BUFFER_TOO_SMALL 110
738 #define ASN1_R_DECODING_ERROR 111
739 #define ASN1_R_ERROR_STACK 112
740 #define ASN1_R_EXPECTING_AN_INTEGER 113
741 #define ASN1_R_EXPECTING_AN_OBJECT 114
742 #define ASN1_R_EXPECTING_AN_OCTET_STRING 115
743 #define ASN1_R_EXPECTING_A_BIT_STRING 116
744 #define ASN1_R_EXPECTING_A_BOOLEAN 117
745 #define ASN1_R_EXPECTING_A_SEQUENCE 118
746 #define ASN1_R_EXPECTING_A_UTCTIME 119
747 #define ASN1_R_FIRST_NUM_TOO_LARGE 120
748 #define ASN1_R_HEADER_TOO_LONG 121
749 #define ASN1_R_INVALID_DIGIT 122
750 #define ASN1_R_INVALID_SEPARATOR 123
751 #define ASN1_R_INVALID_TIME_FORMAT 124
752 #define ASN1_R_IV_TOO_LARGE 125
753 #define ASN1_R_LENGTH_ERROR 126
754 #define ASN1_R_LENGTH_MISMATCH 127
755 #define ASN1_R_MISSING_EOS 128
756 #define ASN1_R_MISSING_SECOND_NUMBER 129
757 #define ASN1_R_NON_HEX_CHARACTERS 130
758 #define ASN1_R_NOT_ENOUGH_DATA 131
759 #define ASN1_R_ODD_NUMBER_OF_CHARS 132
760 #define ASN1_R_PARSING 133
761 #define ASN1_R_PRIVATE_KEY_HEADER_MISSING 134
762 #define ASN1_R_SECOND_NUMBER_TOO_LARGE 135
763 #define ASN1_R_SHORT_LINE 136
764 #define ASN1_R_STRING_TOO_SHORT 137
765 #define ASN1_R_TAG_VALUE_TOO_HIGH 138
766 #define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 139
767 #define ASN1_R_TOO_LONG 140
768 #define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 141
769 #define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 142
770 #define ASN1_R_UNKNOWN_ATTRIBUTE_TYPE 143
771 #define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 144
772 #define ASN1_R_UNKNOWN_OBJECT_TYPE 145
773 #define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 146
774 #define ASN1_R_UNSUPPORTED_CIPHER 147
775 #define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 148
776 #define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 149
777 #define ASN1_R_UTCTIME_TOO_LONG 150
778 #define ASN1_R_WRONG_PRINTABLE_TYPE 151
779 #define ASN1_R_WRONG_TAG 152
780 #define ASN1_R_WRONG_TYPE 153