Eneboo - Documentación para desarrolladores
|
00001 /* crypto/asn1/asn1.h */ 00002 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 00003 * All rights reserved. 00004 * 00005 * This package is an SSL implementation written 00006 * by Eric Young (eay@cryptsoft.com). 00007 * The implementation was written so as to conform with Netscapes SSL. 00008 * 00009 * This library is free for commercial and non-commercial use as long as 00010 * the following conditions are aheared to. The following conditions 00011 * apply to all code found in this distribution, be it the RC4, RSA, 00012 * lhash, DES, etc., code; not just the SSL code. The SSL documentation 00013 * included with this distribution is covered by the same copyright terms 00014 * except that the holder is Tim Hudson (tjh@cryptsoft.com). 00015 * 00016 * Copyright remains Eric Young's, and as such any Copyright notices in 00017 * the code are not to be removed. 00018 * If this package is used in a product, Eric Young should be given attribution 00019 * as the author of the parts of the library used. 00020 * This can be in the form of a textual message at program startup or 00021 * in documentation (online or textual) provided with the package. 00022 * 00023 * Redistribution and use in source and binary forms, with or without 00024 * modification, are permitted provided that the following conditions 00025 * are met: 00026 * 1. Redistributions of source code must retain the copyright 00027 * notice, this list of conditions and the following disclaimer. 00028 * 2. Redistributions in binary form must reproduce the above copyright 00029 * notice, this list of conditions and the following disclaimer in the 00030 * documentation and/or other materials provided with the distribution. 00031 * 3. All advertising materials mentioning features or use of this software 00032 * must display the following acknowledgement: 00033 * "This product includes cryptographic software written by 00034 * Eric Young (eay@cryptsoft.com)" 00035 * The word 'cryptographic' can be left out if the rouines from the library 00036 * being used are not cryptographic related :-). 00037 * 4. If you include any Windows specific code (or a derivative thereof) from 00038 * the apps directory (application code) you must include an acknowledgement: 00039 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 00040 * 00041 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 00042 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00043 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00044 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 00045 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00046 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00047 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00048 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00049 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00050 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00051 * SUCH DAMAGE. 00052 * 00053 * The licence and distribution terms for any publically available version or 00054 * derivative of this code cannot be changed. i.e. this code cannot simply be 00055 * copied and put under another distribution licence 00056 * [including the GNU Public Licence.] 00057 */ 00058 00059 #ifndef HEADER_ASN1_H 00060 #define HEADER_ASN1_H 00061 00062 #include <time.h> 00063 #include <openssl/e_os2.h> 00064 #ifndef OPENSSL_NO_BIO 00065 #include <openssl/bio.h> 00066 #endif 00067 #include <openssl/stack.h> 00068 #include <openssl/safestack.h> 00069 00070 #include <openssl/symhacks.h> 00071 00072 #include <openssl/ossl_typ.h> 00073 #ifndef OPENSSL_NO_DEPRECATED 00074 #include <openssl/bn.h> 00075 #endif 00076 00077 #ifdef OPENSSL_BUILD_SHLIBCRYPTO 00078 # undef OPENSSL_EXTERN 00079 # define OPENSSL_EXTERN OPENSSL_EXPORT 00080 #endif 00081 00082 #ifdef __cplusplus 00083 extern "C" { 00084 #endif 00085 00086 #define V_ASN1_UNIVERSAL 0x00 00087 #define V_ASN1_APPLICATION 0x40 00088 #define V_ASN1_CONTEXT_SPECIFIC 0x80 00089 #define V_ASN1_PRIVATE 0xc0 00090 00091 #define V_ASN1_CONSTRUCTED 0x20 00092 #define V_ASN1_PRIMITIVE_TAG 0x1f 00093 #define V_ASN1_PRIMATIVE_TAG 0x1f 00094 00095 #define V_ASN1_APP_CHOOSE -2 /* let the recipient choose */ 00096 #define V_ASN1_OTHER -3 /* used in ASN1_TYPE */ 00097 #define V_ASN1_ANY -4 /* used in ASN1 template code */ 00098 00099 #define V_ASN1_NEG 0x100 /* negative flag */ 00100 00101 #define V_ASN1_UNDEF -1 00102 #define V_ASN1_EOC 0 00103 #define V_ASN1_BOOLEAN 1 00104 #define V_ASN1_INTEGER 2 00105 #define V_ASN1_NEG_INTEGER (2 | V_ASN1_NEG) 00106 #define V_ASN1_BIT_STRING 3 00107 #define V_ASN1_OCTET_STRING 4 00108 #define V_ASN1_NULL 5 00109 #define V_ASN1_OBJECT 6 00110 #define V_ASN1_OBJECT_DESCRIPTOR 7 00111 #define V_ASN1_EXTERNAL 8 00112 #define V_ASN1_REAL 9 00113 #define V_ASN1_ENUMERATED 10 00114 #define V_ASN1_NEG_ENUMERATED (10 | V_ASN1_NEG) 00115 #define V_ASN1_UTF8STRING 12 00116 #define V_ASN1_SEQUENCE 16 00117 #define V_ASN1_SET 17 00118 #define V_ASN1_NUMERICSTRING 18 00119 #define V_ASN1_PRINTABLESTRING 19 00120 #define V_ASN1_T61STRING 20 00121 #define V_ASN1_TELETEXSTRING 20 /* alias */ 00122 #define V_ASN1_VIDEOTEXSTRING 21 00123 #define V_ASN1_IA5STRING 22 00124 #define V_ASN1_UTCTIME 23 00125 #define V_ASN1_GENERALIZEDTIME 24 00126 #define V_ASN1_GRAPHICSTRING 25 00127 #define V_ASN1_ISO64STRING 26 00128 #define V_ASN1_VISIBLESTRING 26 /* alias */ 00129 #define V_ASN1_GENERALSTRING 27 00130 #define V_ASN1_UNIVERSALSTRING 28 00131 #define V_ASN1_BMPSTRING 30 00132 00133 /* For use with d2i_ASN1_type_bytes() */ 00134 #define B_ASN1_NUMERICSTRING 0x0001 00135 #define B_ASN1_PRINTABLESTRING 0x0002 00136 #define B_ASN1_T61STRING 0x0004 00137 #define B_ASN1_TELETEXSTRING 0x0004 00138 #define B_ASN1_VIDEOTEXSTRING 0x0008 00139 #define B_ASN1_IA5STRING 0x0010 00140 #define B_ASN1_GRAPHICSTRING 0x0020 00141 #define B_ASN1_ISO64STRING 0x0040 00142 #define B_ASN1_VISIBLESTRING 0x0040 00143 #define B_ASN1_GENERALSTRING 0x0080 00144 #define B_ASN1_UNIVERSALSTRING 0x0100 00145 #define B_ASN1_OCTET_STRING 0x0200 00146 #define B_ASN1_BIT_STRING 0x0400 00147 #define B_ASN1_BMPSTRING 0x0800 00148 #define B_ASN1_UNKNOWN 0x1000 00149 #define B_ASN1_UTF8STRING 0x2000 00150 #define B_ASN1_UTCTIME 0x4000 00151 #define B_ASN1_GENERALIZEDTIME 0x8000 00152 #define B_ASN1_SEQUENCE 0x10000 00153 00154 /* For use with ASN1_mbstring_copy() */ 00155 #define MBSTRING_FLAG 0x1000 00156 #define MBSTRING_UTF8 (MBSTRING_FLAG) 00157 #define MBSTRING_ASC (MBSTRING_FLAG|1) 00158 #define MBSTRING_BMP (MBSTRING_FLAG|2) 00159 #define MBSTRING_UNIV (MBSTRING_FLAG|4) 00160 00161 #define SMIME_OLDMIME 0x400 00162 #define SMIME_CRLFEOL 0x800 00163 #define SMIME_STREAM 0x1000 00164 00165 struct X509_algor_st; 00166 DECLARE_STACK_OF(X509_ALGOR) 00167 00168 #define DECLARE_ASN1_SET_OF(type) /* filled in by mkstack.pl */ 00169 #define IMPLEMENT_ASN1_SET_OF(type) /* nothing, no longer needed */ 00170 00171 /* We MUST make sure that, except for constness, asn1_ctx_st and 00172 asn1_const_ctx are exactly the same. Fortunately, as soon as 00173 the old ASN1 parsing macros are gone, we can throw this away 00174 as well... */ 00175 typedef struct asn1_ctx_st 00176 { 00177 unsigned char *p;/* work char pointer */ 00178 int eos; /* end of sequence read for indefinite encoding */ 00179 int error; /* error code to use when returning an error */ 00180 int inf; /* constructed if 0x20, indefinite is 0x21 */ 00181 int tag; /* tag from last 'get object' */ 00182 int xclass; /* class from last 'get object' */ 00183 long slen; /* length of last 'get object' */ 00184 unsigned char *max; /* largest value of p allowed */ 00185 unsigned char *q;/* temporary variable */ 00186 unsigned char **pp;/* variable */ 00187 int line; /* used in error processing */ 00188 } ASN1_CTX; 00189 00190 typedef struct asn1_const_ctx_st 00191 { 00192 const unsigned char *p;/* work char pointer */ 00193 int eos; /* end of sequence read for indefinite encoding */ 00194 int error; /* error code to use when returning an error */ 00195 int inf; /* constructed if 0x20, indefinite is 0x21 */ 00196 int tag; /* tag from last 'get object' */ 00197 int xclass; /* class from last 'get object' */ 00198 long slen; /* length of last 'get object' */ 00199 const unsigned char *max; /* largest value of p allowed */ 00200 const unsigned char *q;/* temporary variable */ 00201 const unsigned char **pp;/* variable */ 00202 int line; /* used in error processing */ 00203 } ASN1_const_CTX; 00204 00205 /* These are used internally in the ASN1_OBJECT to keep track of 00206 * whether the names and data need to be free()ed */ 00207 #define ASN1_OBJECT_FLAG_DYNAMIC 0x01 /* internal use */ 00208 #define ASN1_OBJECT_FLAG_CRITICAL 0x02 /* critical x509v3 object id */ 00209 #define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04 /* internal use */ 00210 #define ASN1_OBJECT_FLAG_DYNAMIC_DATA 0x08 /* internal use */ 00211 typedef struct asn1_object_st 00212 { 00213 const char *sn,*ln; 00214 int nid; 00215 int length; 00216 unsigned char *data; 00217 int flags; /* Should we free this one */ 00218 } ASN1_OBJECT; 00219 00220 #define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */ 00221 /* This indicates that the ASN1_STRING is not a real value but just a place 00222 * holder for the location where indefinite length constructed data should 00223 * be inserted in the memory buffer 00224 */ 00225 #define ASN1_STRING_FLAG_NDEF 0x010 00226 00227 /* This flag is used by the CMS code to indicate that a string is not 00228 * complete and is a place holder for content when it had all been 00229 * accessed. The flag will be reset when content has been written to it. 00230 */ 00231 #define ASN1_STRING_FLAG_CONT 0x020 00232 00233 /* This is the base type that holds just about everything :-) */ 00234 typedef struct asn1_string_st 00235 { 00236 int length; 00237 int type; 00238 unsigned char *data; 00239 /* The value of the following field depends on the type being 00240 * held. It is mostly being used for BIT_STRING so if the 00241 * input data has a non-zero 'unused bits' value, it will be 00242 * handled correctly */ 00243 long flags; 00244 } ASN1_STRING; 00245 00246 /* ASN1_ENCODING structure: this is used to save the received 00247 * encoding of an ASN1 type. This is useful to get round 00248 * problems with invalid encodings which can break signatures. 00249 */ 00250 00251 typedef struct ASN1_ENCODING_st 00252 { 00253 unsigned char *enc; /* DER encoding */ 00254 long len; /* Length of encoding */ 00255 int modified; /* set to 1 if 'enc' is invalid */ 00256 } ASN1_ENCODING; 00257 00258 /* Used with ASN1 LONG type: if a long is set to this it is omitted */ 00259 #define ASN1_LONG_UNDEF 0x7fffffffL 00260 00261 #define STABLE_FLAGS_MALLOC 0x01 00262 #define STABLE_NO_MASK 0x02 00263 #define DIRSTRING_TYPE \ 00264 (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING) 00265 #define PKCS9STRING_TYPE (DIRSTRING_TYPE|B_ASN1_IA5STRING) 00266 00267 typedef struct asn1_string_table_st { 00268 int nid; 00269 long minsize; 00270 long maxsize; 00271 unsigned long mask; 00272 unsigned long flags; 00273 } ASN1_STRING_TABLE; 00274 00275 DECLARE_STACK_OF(ASN1_STRING_TABLE) 00276 00277 /* size limits: this stuff is taken straight from RFC2459 */ 00278 00279 #define ub_name 32768 00280 #define ub_common_name 64 00281 #define ub_locality_name 128 00282 #define ub_state_name 128 00283 #define ub_organization_name 64 00284 #define ub_organization_unit_name 64 00285 #define ub_title 64 00286 #define ub_email_address 128 00287 00288 /* Declarations for template structures: for full definitions 00289 * see asn1t.h 00290 */ 00291 typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE; 00292 typedef struct ASN1_ITEM_st ASN1_ITEM; 00293 typedef struct ASN1_TLC_st ASN1_TLC; 00294 /* This is just an opaque pointer */ 00295 typedef struct ASN1_VALUE_st ASN1_VALUE; 00296 00297 /* Declare ASN1 functions: the implement macro in in asn1t.h */ 00298 00299 #define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type) 00300 00301 #define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \ 00302 DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type) 00303 00304 #define DECLARE_ASN1_FUNCTIONS_name(type, name) \ 00305 DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ 00306 DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) 00307 00308 #define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \ 00309 DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ 00310 DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) 00311 00312 #define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \ 00313 type *d2i_##name(type **a, const unsigned char **in, long len); \ 00314 int i2d_##name(type *a, unsigned char **out); \ 00315 DECLARE_ASN1_ITEM(itname) 00316 00317 #define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \ 00318 type *d2i_##name(type **a, const unsigned char **in, long len); \ 00319 int i2d_##name(const type *a, unsigned char **out); \ 00320 DECLARE_ASN1_ITEM(name) 00321 00322 #define DECLARE_ASN1_NDEF_FUNCTION(name) \ 00323 int i2d_##name##_NDEF(name *a, unsigned char **out); 00324 00325 #define DECLARE_ASN1_FUNCTIONS_const(name) \ 00326 DECLARE_ASN1_ALLOC_FUNCTIONS(name) \ 00327 DECLARE_ASN1_ENCODE_FUNCTIONS_const(name, name) 00328 00329 #define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ 00330 type *name##_new(void); \ 00331 void name##_free(type *a); 00332 00333 #define D2I_OF(type) type *(*)(type **,const unsigned char **,long) 00334 #define I2D_OF(type) int (*)(type *,unsigned char **) 00335 #define I2D_OF_const(type) int (*)(const type *,unsigned char **) 00336 00337 #define CHECKED_D2I_OF(type, d2i) \ 00338 ((d2i_of_void*) (1 ? d2i : ((D2I_OF(type))0))) 00339 #define CHECKED_I2D_OF(type, i2d) \ 00340 ((i2d_of_void*) (1 ? i2d : ((I2D_OF(type))0))) 00341 #define CHECKED_NEW_OF(type, xnew) \ 00342 ((void *(*)(void)) (1 ? xnew : ((type *(*)(void))0))) 00343 #define CHECKED_PTR_OF(type, p) \ 00344 ((void*) (1 ? p : (type*)0)) 00345 #define CHECKED_PPTR_OF(type, p) \ 00346 ((void**) (1 ? p : (type**)0)) 00347 #define CHECKED_PTR_OF_TO_CHAR(type, p) \ 00348 ((char*) (1 ? p : (type*)0)) 00349 00350 #define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long) 00351 #define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **) 00352 #define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type) 00353 00354 TYPEDEF_D2I2D_OF(void); 00355 00356 /* The following macros and typedefs allow an ASN1_ITEM 00357 * to be embedded in a structure and referenced. Since 00358 * the ASN1_ITEM pointers need to be globally accessible 00359 * (possibly from shared libraries) they may exist in 00360 * different forms. On platforms that support it the 00361 * ASN1_ITEM structure itself will be globally exported. 00362 * Other platforms will export a function that returns 00363 * an ASN1_ITEM pointer. 00364 * 00365 * To handle both cases transparently the macros below 00366 * should be used instead of hard coding an ASN1_ITEM 00367 * pointer in a structure. 00368 * 00369 * The structure will look like this: 00370 * 00371 * typedef struct SOMETHING_st { 00372 * ... 00373 * ASN1_ITEM_EXP *iptr; 00374 * ... 00375 * } SOMETHING; 00376 * 00377 * It would be initialised as e.g.: 00378 * 00379 * SOMETHING somevar = {...,ASN1_ITEM_ref(X509),...}; 00380 * 00381 * and the actual pointer extracted with: 00382 * 00383 * const ASN1_ITEM *it = ASN1_ITEM_ptr(somevar.iptr); 00384 * 00385 * Finally an ASN1_ITEM pointer can be extracted from an 00386 * appropriate reference with: ASN1_ITEM_rptr(X509). This 00387 * would be used when a function takes an ASN1_ITEM * argument. 00388 * 00389 */ 00390 00391 #ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION 00392 00393 /* ASN1_ITEM pointer exported type */ 00394 typedef const ASN1_ITEM ASN1_ITEM_EXP; 00395 00396 /* Macro to obtain ASN1_ITEM pointer from exported type */ 00397 #define ASN1_ITEM_ptr(iptr) (iptr) 00398 00399 /* Macro to include ASN1_ITEM pointer from base type */ 00400 #define ASN1_ITEM_ref(iptr) (&(iptr##_it)) 00401 00402 #define ASN1_ITEM_rptr(ref) (&(ref##_it)) 00403 00404 #define DECLARE_ASN1_ITEM(name) \ 00405 OPENSSL_EXTERN const ASN1_ITEM name##_it; 00406 00407 #else 00408 00409 /* Platforms that can't easily handle shared global variables are declared 00410 * as functions returning ASN1_ITEM pointers. 00411 */ 00412 00413 /* ASN1_ITEM pointer exported type */ 00414 typedef const ASN1_ITEM * ASN1_ITEM_EXP(void); 00415 00416 /* Macro to obtain ASN1_ITEM pointer from exported type */ 00417 #define ASN1_ITEM_ptr(iptr) (iptr()) 00418 00419 /* Macro to include ASN1_ITEM pointer from base type */ 00420 #define ASN1_ITEM_ref(iptr) (iptr##_it) 00421 00422 #define ASN1_ITEM_rptr(ref) (ref##_it()) 00423 00424 #define DECLARE_ASN1_ITEM(name) \ 00425 const ASN1_ITEM * name##_it(void); 00426 00427 #endif 00428 00429 /* Parameters used by ASN1_STRING_print_ex() */ 00430 00431 /* These determine which characters to escape: 00432 * RFC2253 special characters, control characters and 00433 * MSB set characters 00434 */ 00435 00436 #define ASN1_STRFLGS_ESC_2253 1 00437 #define ASN1_STRFLGS_ESC_CTRL 2 00438 #define ASN1_STRFLGS_ESC_MSB 4 00439 00440 00441 /* This flag determines how we do escaping: normally 00442 * RC2253 backslash only, set this to use backslash and 00443 * quote. 00444 */ 00445 00446 #define ASN1_STRFLGS_ESC_QUOTE 8 00447 00448 00449 /* These three flags are internal use only. */ 00450 00451 /* Character is a valid PrintableString character */ 00452 #define CHARTYPE_PRINTABLESTRING 0x10 00453 /* Character needs escaping if it is the first character */ 00454 #define CHARTYPE_FIRST_ESC_2253 0x20 00455 /* Character needs escaping if it is the last character */ 00456 #define CHARTYPE_LAST_ESC_2253 0x40 00457 00458 /* NB the internal flags are safely reused below by flags 00459 * handled at the top level. 00460 */ 00461 00462 /* If this is set we convert all character strings 00463 * to UTF8 first 00464 */ 00465 00466 #define ASN1_STRFLGS_UTF8_CONVERT 0x10 00467 00468 /* If this is set we don't attempt to interpret content: 00469 * just assume all strings are 1 byte per character. This 00470 * will produce some pretty odd looking output! 00471 */ 00472 00473 #define ASN1_STRFLGS_IGNORE_TYPE 0x20 00474 00475 /* If this is set we include the string type in the output */ 00476 #define ASN1_STRFLGS_SHOW_TYPE 0x40 00477 00478 /* This determines which strings to display and which to 00479 * 'dump' (hex dump of content octets or DER encoding). We can 00480 * only dump non character strings or everything. If we 00481 * don't dump 'unknown' they are interpreted as character 00482 * strings with 1 octet per character and are subject to 00483 * the usual escaping options. 00484 */ 00485 00486 #define ASN1_STRFLGS_DUMP_ALL 0x80 00487 #define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 00488 00489 /* These determine what 'dumping' does, we can dump the 00490 * content octets or the DER encoding: both use the 00491 * RFC2253 #XXXXX notation. 00492 */ 00493 00494 #define ASN1_STRFLGS_DUMP_DER 0x200 00495 00496 /* All the string flags consistent with RFC2253, 00497 * escaping control characters isn't essential in 00498 * RFC2253 but it is advisable anyway. 00499 */ 00500 00501 #define ASN1_STRFLGS_RFC2253 (ASN1_STRFLGS_ESC_2253 | \ 00502 ASN1_STRFLGS_ESC_CTRL | \ 00503 ASN1_STRFLGS_ESC_MSB | \ 00504 ASN1_STRFLGS_UTF8_CONVERT | \ 00505 ASN1_STRFLGS_DUMP_UNKNOWN | \ 00506 ASN1_STRFLGS_DUMP_DER) 00507 00508 DECLARE_STACK_OF(ASN1_INTEGER) 00509 DECLARE_ASN1_SET_OF(ASN1_INTEGER) 00510 00511 DECLARE_STACK_OF(ASN1_GENERALSTRING) 00512 00513 typedef struct asn1_type_st 00514 { 00515 int type; 00516 union { 00517 char *ptr; 00518 ASN1_BOOLEAN boolean; 00519 ASN1_STRING * asn1_string; 00520 ASN1_OBJECT * object; 00521 ASN1_INTEGER * integer; 00522 ASN1_ENUMERATED * enumerated; 00523 ASN1_BIT_STRING * bit_string; 00524 ASN1_OCTET_STRING * octet_string; 00525 ASN1_PRINTABLESTRING * printablestring; 00526 ASN1_T61STRING * t61string; 00527 ASN1_IA5STRING * ia5string; 00528 ASN1_GENERALSTRING * generalstring; 00529 ASN1_BMPSTRING * bmpstring; 00530 ASN1_UNIVERSALSTRING * universalstring; 00531 ASN1_UTCTIME * utctime; 00532 ASN1_GENERALIZEDTIME * generalizedtime; 00533 ASN1_VISIBLESTRING * visiblestring; 00534 ASN1_UTF8STRING * utf8string; 00535 /* set and sequence are left complete and still 00536 * contain the set or sequence bytes */ 00537 ASN1_STRING * set; 00538 ASN1_STRING * sequence; 00539 ASN1_VALUE * asn1_value; 00540 } value; 00541 } ASN1_TYPE; 00542 00543 DECLARE_STACK_OF(ASN1_TYPE) 00544 DECLARE_ASN1_SET_OF(ASN1_TYPE) 00545 00546 typedef struct asn1_method_st 00547 { 00548 i2d_of_void *i2d; 00549 d2i_of_void *d2i; 00550 void *(*create)(void); 00551 void (*destroy)(void *); 00552 } ASN1_METHOD; 00553 00554 /* This is used when parsing some Netscape objects */ 00555 typedef struct asn1_header_st 00556 { 00557 ASN1_OCTET_STRING *header; 00558 void *data; 00559 ASN1_METHOD *meth; 00560 } ASN1_HEADER; 00561 00562 /* This is used to contain a list of bit names */ 00563 typedef struct BIT_STRING_BITNAME_st { 00564 int bitnum; 00565 const char *lname; 00566 const char *sname; 00567 } BIT_STRING_BITNAME; 00568 00569 00570 #define M_ASN1_STRING_length(x) ((x)->length) 00571 #define M_ASN1_STRING_length_set(x, n) ((x)->length = (n)) 00572 #define M_ASN1_STRING_type(x) ((x)->type) 00573 #define M_ASN1_STRING_data(x) ((x)->data) 00574 00575 /* Macros for string operations */ 00576 #define M_ASN1_BIT_STRING_new() (ASN1_BIT_STRING *)\ 00577 ASN1_STRING_type_new(V_ASN1_BIT_STRING) 00578 #define M_ASN1_BIT_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) 00579 #define M_ASN1_BIT_STRING_dup(a) (ASN1_BIT_STRING *)\ 00580 ASN1_STRING_dup((ASN1_STRING *)a) 00581 #define M_ASN1_BIT_STRING_cmp(a,b) ASN1_STRING_cmp(\ 00582 (ASN1_STRING *)a,(ASN1_STRING *)b) 00583 #define M_ASN1_BIT_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c) 00584 00585 #define M_ASN1_INTEGER_new() (ASN1_INTEGER *)\ 00586 ASN1_STRING_type_new(V_ASN1_INTEGER) 00587 #define M_ASN1_INTEGER_free(a) ASN1_STRING_free((ASN1_STRING *)a) 00588 #define M_ASN1_INTEGER_dup(a) (ASN1_INTEGER *)ASN1_STRING_dup((ASN1_STRING *)a) 00589 #define M_ASN1_INTEGER_cmp(a,b) ASN1_STRING_cmp(\ 00590 (ASN1_STRING *)a,(ASN1_STRING *)b) 00591 00592 #define M_ASN1_ENUMERATED_new() (ASN1_ENUMERATED *)\ 00593 ASN1_STRING_type_new(V_ASN1_ENUMERATED) 00594 #define M_ASN1_ENUMERATED_free(a) ASN1_STRING_free((ASN1_STRING *)a) 00595 #define M_ASN1_ENUMERATED_dup(a) (ASN1_ENUMERATED *)ASN1_STRING_dup((ASN1_STRING *)a) 00596 #define M_ASN1_ENUMERATED_cmp(a,b) ASN1_STRING_cmp(\ 00597 (ASN1_STRING *)a,(ASN1_STRING *)b) 00598 00599 #define M_ASN1_OCTET_STRING_new() (ASN1_OCTET_STRING *)\ 00600 ASN1_STRING_type_new(V_ASN1_OCTET_STRING) 00601 #define M_ASN1_OCTET_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) 00602 #define M_ASN1_OCTET_STRING_dup(a) (ASN1_OCTET_STRING *)\ 00603 ASN1_STRING_dup((ASN1_STRING *)a) 00604 #define M_ASN1_OCTET_STRING_cmp(a,b) ASN1_STRING_cmp(\ 00605 (ASN1_STRING *)a,(ASN1_STRING *)b) 00606 #define M_ASN1_OCTET_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c) 00607 #define M_ASN1_OCTET_STRING_print(a,b) ASN1_STRING_print(a,(ASN1_STRING *)b) 00608 #define M_i2d_ASN1_OCTET_STRING(a,pp) \ 00609 i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_OCTET_STRING,\ 00610 V_ASN1_UNIVERSAL) 00611 00612 #define B_ASN1_TIME \ 00613 B_ASN1_UTCTIME | \ 00614 B_ASN1_GENERALIZEDTIME 00615 00616 #define B_ASN1_PRINTABLE \ 00617 B_ASN1_NUMERICSTRING| \ 00618 B_ASN1_PRINTABLESTRING| \ 00619 B_ASN1_T61STRING| \ 00620 B_ASN1_IA5STRING| \ 00621 B_ASN1_BIT_STRING| \ 00622 B_ASN1_UNIVERSALSTRING|\ 00623 B_ASN1_BMPSTRING|\ 00624 B_ASN1_UTF8STRING|\ 00625 B_ASN1_SEQUENCE|\ 00626 B_ASN1_UNKNOWN 00627 00628 #define B_ASN1_DIRECTORYSTRING \ 00629 B_ASN1_PRINTABLESTRING| \ 00630 B_ASN1_TELETEXSTRING|\ 00631 B_ASN1_BMPSTRING|\ 00632 B_ASN1_UNIVERSALSTRING|\ 00633 B_ASN1_UTF8STRING 00634 00635 #define B_ASN1_DISPLAYTEXT \ 00636 B_ASN1_IA5STRING| \ 00637 B_ASN1_VISIBLESTRING| \ 00638 B_ASN1_BMPSTRING|\ 00639 B_ASN1_UTF8STRING 00640 00641 #define M_ASN1_PRINTABLE_new() ASN1_STRING_type_new(V_ASN1_T61STRING) 00642 #define M_ASN1_PRINTABLE_free(a) ASN1_STRING_free((ASN1_STRING *)a) 00643 #define M_i2d_ASN1_PRINTABLE(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\ 00644 pp,a->type,V_ASN1_UNIVERSAL) 00645 #define M_d2i_ASN1_PRINTABLE(a,pp,l) \ 00646 d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \ 00647 B_ASN1_PRINTABLE) 00648 00649 #define M_DIRECTORYSTRING_new() ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING) 00650 #define M_DIRECTORYSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) 00651 #define M_i2d_DIRECTORYSTRING(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\ 00652 pp,a->type,V_ASN1_UNIVERSAL) 00653 #define M_d2i_DIRECTORYSTRING(a,pp,l) \ 00654 d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \ 00655 B_ASN1_DIRECTORYSTRING) 00656 00657 #define M_DISPLAYTEXT_new() ASN1_STRING_type_new(V_ASN1_VISIBLESTRING) 00658 #define M_DISPLAYTEXT_free(a) ASN1_STRING_free((ASN1_STRING *)a) 00659 #define M_i2d_DISPLAYTEXT(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\ 00660 pp,a->type,V_ASN1_UNIVERSAL) 00661 #define M_d2i_DISPLAYTEXT(a,pp,l) \ 00662 d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \ 00663 B_ASN1_DISPLAYTEXT) 00664 00665 #define M_ASN1_PRINTABLESTRING_new() (ASN1_PRINTABLESTRING *)\ 00666 ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING) 00667 #define M_ASN1_PRINTABLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) 00668 #define M_i2d_ASN1_PRINTABLESTRING(a,pp) \ 00669 i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_PRINTABLESTRING,\ 00670 V_ASN1_UNIVERSAL) 00671 #define M_d2i_ASN1_PRINTABLESTRING(a,pp,l) \ 00672 (ASN1_PRINTABLESTRING *)d2i_ASN1_type_bytes\ 00673 ((ASN1_STRING **)a,pp,l,B_ASN1_PRINTABLESTRING) 00674 00675 #define M_ASN1_T61STRING_new() (ASN1_T61STRING *)\ 00676 ASN1_STRING_type_new(V_ASN1_T61STRING) 00677 #define M_ASN1_T61STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) 00678 #define M_i2d_ASN1_T61STRING(a,pp) \ 00679 i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_T61STRING,\ 00680 V_ASN1_UNIVERSAL) 00681 #define M_d2i_ASN1_T61STRING(a,pp,l) \ 00682 (ASN1_T61STRING *)d2i_ASN1_type_bytes\ 00683 ((ASN1_STRING **)a,pp,l,B_ASN1_T61STRING) 00684 00685 #define M_ASN1_IA5STRING_new() (ASN1_IA5STRING *)\ 00686 ASN1_STRING_type_new(V_ASN1_IA5STRING) 00687 #define M_ASN1_IA5STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) 00688 #define M_ASN1_IA5STRING_dup(a) \ 00689 (ASN1_IA5STRING *)ASN1_STRING_dup((ASN1_STRING *)a) 00690 #define M_i2d_ASN1_IA5STRING(a,pp) \ 00691 i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_IA5STRING,\ 00692 V_ASN1_UNIVERSAL) 00693 #define M_d2i_ASN1_IA5STRING(a,pp,l) \ 00694 (ASN1_IA5STRING *)d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l,\ 00695 B_ASN1_IA5STRING) 00696 00697 #define M_ASN1_UTCTIME_new() (ASN1_UTCTIME *)\ 00698 ASN1_STRING_type_new(V_ASN1_UTCTIME) 00699 #define M_ASN1_UTCTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) 00700 #define M_ASN1_UTCTIME_dup(a) (ASN1_UTCTIME *)ASN1_STRING_dup((ASN1_STRING *)a) 00701 00702 #define M_ASN1_GENERALIZEDTIME_new() (ASN1_GENERALIZEDTIME *)\ 00703 ASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME) 00704 #define M_ASN1_GENERALIZEDTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) 00705 #define M_ASN1_GENERALIZEDTIME_dup(a) (ASN1_GENERALIZEDTIME *)ASN1_STRING_dup(\ 00706 (ASN1_STRING *)a) 00707 00708 #define M_ASN1_TIME_new() (ASN1_TIME *)\ 00709 ASN1_STRING_type_new(V_ASN1_UTCTIME) 00710 #define M_ASN1_TIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) 00711 #define M_ASN1_TIME_dup(a) (ASN1_TIME *)ASN1_STRING_dup((ASN1_STRING *)a) 00712 00713 #define M_ASN1_GENERALSTRING_new() (ASN1_GENERALSTRING *)\ 00714 ASN1_STRING_type_new(V_ASN1_GENERALSTRING) 00715 #define M_ASN1_GENERALSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) 00716 #define M_i2d_ASN1_GENERALSTRING(a,pp) \ 00717 i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_GENERALSTRING,\ 00718 V_ASN1_UNIVERSAL) 00719 #define M_d2i_ASN1_GENERALSTRING(a,pp,l) \ 00720 (ASN1_GENERALSTRING *)d2i_ASN1_type_bytes\ 00721 ((ASN1_STRING **)a,pp,l,B_ASN1_GENERALSTRING) 00722 00723 #define M_ASN1_UNIVERSALSTRING_new() (ASN1_UNIVERSALSTRING *)\ 00724 ASN1_STRING_type_new(V_ASN1_UNIVERSALSTRING) 00725 #define M_ASN1_UNIVERSALSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) 00726 #define M_i2d_ASN1_UNIVERSALSTRING(a,pp) \ 00727 i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UNIVERSALSTRING,\ 00728 V_ASN1_UNIVERSAL) 00729 #define M_d2i_ASN1_UNIVERSALSTRING(a,pp,l) \ 00730 (ASN1_UNIVERSALSTRING *)d2i_ASN1_type_bytes\ 00731 ((ASN1_STRING **)a,pp,l,B_ASN1_UNIVERSALSTRING) 00732 00733 #define M_ASN1_BMPSTRING_new() (ASN1_BMPSTRING *)\ 00734 ASN1_STRING_type_new(V_ASN1_BMPSTRING) 00735 #define M_ASN1_BMPSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) 00736 #define M_i2d_ASN1_BMPSTRING(a,pp) \ 00737 i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_BMPSTRING,\ 00738 V_ASN1_UNIVERSAL) 00739 #define M_d2i_ASN1_BMPSTRING(a,pp,l) \ 00740 (ASN1_BMPSTRING *)d2i_ASN1_type_bytes\ 00741 ((ASN1_STRING **)a,pp,l,B_ASN1_BMPSTRING) 00742 00743 #define M_ASN1_VISIBLESTRING_new() (ASN1_VISIBLESTRING *)\ 00744 ASN1_STRING_type_new(V_ASN1_VISIBLESTRING) 00745 #define M_ASN1_VISIBLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) 00746 #define M_i2d_ASN1_VISIBLESTRING(a,pp) \ 00747 i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_VISIBLESTRING,\ 00748 V_ASN1_UNIVERSAL) 00749 #define M_d2i_ASN1_VISIBLESTRING(a,pp,l) \ 00750 (ASN1_VISIBLESTRING *)d2i_ASN1_type_bytes\ 00751 ((ASN1_STRING **)a,pp,l,B_ASN1_VISIBLESTRING) 00752 00753 #define M_ASN1_UTF8STRING_new() (ASN1_UTF8STRING *)\ 00754 ASN1_STRING_type_new(V_ASN1_UTF8STRING) 00755 #define M_ASN1_UTF8STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) 00756 #define M_i2d_ASN1_UTF8STRING(a,pp) \ 00757 i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UTF8STRING,\ 00758 V_ASN1_UNIVERSAL) 00759 #define M_d2i_ASN1_UTF8STRING(a,pp,l) \ 00760 (ASN1_UTF8STRING *)d2i_ASN1_type_bytes\ 00761 ((ASN1_STRING **)a,pp,l,B_ASN1_UTF8STRING) 00762 00763 /* for the is_set parameter to i2d_ASN1_SET */ 00764 #define IS_SEQUENCE 0 00765 #define IS_SET 1 00766 00767 DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE) 00768 00769 int ASN1_TYPE_get(ASN1_TYPE *a); 00770 void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value); 00771 int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value); 00772 00773 ASN1_OBJECT * ASN1_OBJECT_new(void ); 00774 void ASN1_OBJECT_free(ASN1_OBJECT *a); 00775 int i2d_ASN1_OBJECT(ASN1_OBJECT *a,unsigned char **pp); 00776 ASN1_OBJECT * c2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp, 00777 long length); 00778 ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp, 00779 long length); 00780 00781 DECLARE_ASN1_ITEM(ASN1_OBJECT) 00782 00783 DECLARE_STACK_OF(ASN1_OBJECT) 00784 DECLARE_ASN1_SET_OF(ASN1_OBJECT) 00785 00786 ASN1_STRING * ASN1_STRING_new(void); 00787 void ASN1_STRING_free(ASN1_STRING *a); 00788 ASN1_STRING * ASN1_STRING_dup(ASN1_STRING *a); 00789 ASN1_STRING * ASN1_STRING_type_new(int type ); 00790 int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b); 00791 /* Since this is used to store all sorts of things, via macros, for now, make 00792 its data void * */ 00793 int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len); 00794 void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len); 00795 int ASN1_STRING_length(ASN1_STRING *x); 00796 void ASN1_STRING_length_set(ASN1_STRING *x, int n); 00797 int ASN1_STRING_type(ASN1_STRING *x); 00798 unsigned char * ASN1_STRING_data(ASN1_STRING *x); 00799 00800 DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING) 00801 int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp); 00802 ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,const unsigned char **pp, 00803 long length); 00804 int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, 00805 int length ); 00806 int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); 00807 int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n); 00808 00809 #ifndef OPENSSL_NO_BIO 00810 int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, 00811 BIT_STRING_BITNAME *tbl, int indent); 00812 #endif 00813 int ASN1_BIT_STRING_num_asc(char *name, BIT_STRING_BITNAME *tbl); 00814 int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value, 00815 BIT_STRING_BITNAME *tbl); 00816 00817 int i2d_ASN1_BOOLEAN(int a,unsigned char **pp); 00818 int d2i_ASN1_BOOLEAN(int *a,const unsigned char **pp,long length); 00819 00820 DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER) 00821 int i2c_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp); 00822 ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,const unsigned char **pp, 00823 long length); 00824 ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,const unsigned char **pp, 00825 long length); 00826 ASN1_INTEGER * ASN1_INTEGER_dup(ASN1_INTEGER *x); 00827 int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y); 00828 00829 DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED) 00830 00831 int ASN1_UTCTIME_check(ASN1_UTCTIME *a); 00832 ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t); 00833 int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str); 00834 int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t); 00835 #if 0 00836 time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s); 00837 #endif 00838 00839 int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a); 00840 ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t); 00841 int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str); 00842 00843 DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING) 00844 ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *a); 00845 int ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b); 00846 int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, int len); 00847 00848 DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) 00849 DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING) 00850 DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING) 00851 DECLARE_ASN1_FUNCTIONS(ASN1_NULL) 00852 DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING) 00853 00854 int UTF8_getc(const unsigned char *str, int len, unsigned long *val); 00855 int UTF8_putc(unsigned char *str, int len, unsigned long value); 00856 00857 DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE) 00858 00859 DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING) 00860 DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT) 00861 DECLARE_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING) 00862 DECLARE_ASN1_FUNCTIONS(ASN1_T61STRING) 00863 DECLARE_ASN1_FUNCTIONS(ASN1_IA5STRING) 00864 DECLARE_ASN1_FUNCTIONS(ASN1_GENERALSTRING) 00865 DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME) 00866 DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME) 00867 DECLARE_ASN1_FUNCTIONS(ASN1_TIME) 00868 00869 DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF) 00870 00871 ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t); 00872 int ASN1_TIME_check(ASN1_TIME *t); 00873 ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out); 00874 00875 int i2d_ASN1_SET(STACK *a, unsigned char **pp, 00876 i2d_of_void *i2d, int ex_tag, int ex_class, int is_set); 00877 STACK * d2i_ASN1_SET(STACK **a, const unsigned char **pp, long length, 00878 d2i_of_void *d2i, void (*free_func)(void *), 00879 int ex_tag, int ex_class); 00880 00881 #ifndef OPENSSL_NO_BIO 00882 int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a); 00883 int a2i_ASN1_INTEGER(BIO *bp,ASN1_INTEGER *bs,char *buf,int size); 00884 int i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a); 00885 int a2i_ASN1_ENUMERATED(BIO *bp,ASN1_ENUMERATED *bs,char *buf,int size); 00886 int i2a_ASN1_OBJECT(BIO *bp,ASN1_OBJECT *a); 00887 int a2i_ASN1_STRING(BIO *bp,ASN1_STRING *bs,char *buf,int size); 00888 int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type); 00889 #endif 00890 int i2t_ASN1_OBJECT(char *buf,int buf_len,ASN1_OBJECT *a); 00891 00892 int a2d_ASN1_OBJECT(unsigned char *out,int olen, const char *buf, int num); 00893 ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len, 00894 const char *sn, const char *ln); 00895 00896 int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); 00897 long ASN1_INTEGER_get(ASN1_INTEGER *a); 00898 ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai); 00899 BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai,BIGNUM *bn); 00900 00901 int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v); 00902 long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a); 00903 ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai); 00904 BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai,BIGNUM *bn); 00905 00906 /* General */ 00907 /* given a string, return the correct type, max is the maximum length */ 00908 int ASN1_PRINTABLE_type(const unsigned char *s, int max); 00909 00910 int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass); 00911 ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp, 00912 long length, int Ptag, int Pclass); 00913 unsigned long ASN1_tag2bit(int tag); 00914 /* type is one or more of the B_ASN1_ values. */ 00915 ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a,const unsigned char **pp, 00916 long length,int type); 00917 00918 /* PARSING */ 00919 int asn1_Finish(ASN1_CTX *c); 00920 int asn1_const_Finish(ASN1_const_CTX *c); 00921 00922 /* SPECIALS */ 00923 int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, 00924 int *pclass, long omax); 00925 int ASN1_check_infinite_end(unsigned char **p,long len); 00926 int ASN1_const_check_infinite_end(const unsigned char **p,long len); 00927 void ASN1_put_object(unsigned char **pp, int constructed, int length, 00928 int tag, int xclass); 00929 int ASN1_put_eoc(unsigned char **pp); 00930 int ASN1_object_size(int constructed, int length, int tag); 00931 00932 /* Used to implement other functions */ 00933 void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x); 00934 00935 #define ASN1_dup_of(type,i2d,d2i,x) \ 00936 ((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \ 00937 CHECKED_D2I_OF(type, d2i), \ 00938 CHECKED_PTR_OF_TO_CHAR(type, x))) 00939 00940 #define ASN1_dup_of_const(type,i2d,d2i,x) \ 00941 ((type*)ASN1_dup(CHECKED_I2D_OF(const type, i2d), \ 00942 CHECKED_D2I_OF(type, d2i), \ 00943 CHECKED_PTR_OF_TO_CHAR(const type, x))) 00944 00945 void *ASN1_item_dup(const ASN1_ITEM *it, void *x); 00946 00947 /* ASN1 alloc/free macros for when a type is only used internally */ 00948 00949 #define M_ASN1_new_of(type) (type *)ASN1_item_new(ASN1_ITEM_rptr(type)) 00950 #define M_ASN1_free_of(x, type) \ 00951 ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type)) 00952 00953 #ifndef OPENSSL_NO_FP_API 00954 void *ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x); 00955 00956 #define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \ 00957 ((type*)ASN1_d2i_fp(CHECKED_NEW_OF(type, xnew), \ 00958 CHECKED_D2I_OF(type, d2i), \ 00959 in, \ 00960 CHECKED_PPTR_OF(type, x))) 00961 00962 void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x); 00963 int ASN1_i2d_fp(i2d_of_void *i2d,FILE *out,void *x); 00964 00965 #define ASN1_i2d_fp_of(type,i2d,out,x) \ 00966 (ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \ 00967 out, \ 00968 CHECKED_PTR_OF(type, x))) 00969 00970 #define ASN1_i2d_fp_of_const(type,i2d,out,x) \ 00971 (ASN1_i2d_fp(CHECKED_I2D_OF(const type, i2d), \ 00972 out, \ 00973 CHECKED_PTR_OF(const type, x))) 00974 00975 int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x); 00976 int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags); 00977 #endif 00978 00979 int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in); 00980 00981 #ifndef OPENSSL_NO_BIO 00982 void *ASN1_d2i_bio(void *(*xnew)(void), d2i_of_void *d2i, BIO *in, void **x); 00983 00984 #define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \ 00985 ((type*)ASN1_d2i_bio( CHECKED_NEW_OF(type, xnew), \ 00986 CHECKED_D2I_OF(type, d2i), \ 00987 in, \ 00988 CHECKED_PPTR_OF(type, x))) 00989 00990 void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x); 00991 int ASN1_i2d_bio(i2d_of_void *i2d,BIO *out, unsigned char *x); 00992 00993 #define ASN1_i2d_bio_of(type,i2d,out,x) \ 00994 (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \ 00995 out, \ 00996 CHECKED_PTR_OF(type, x))) 00997 00998 #define ASN1_i2d_bio_of_const(type,i2d,out,x) \ 00999 (ASN1_i2d_bio(CHECKED_I2D_OF(const type, i2d), \ 01000 out, \ 01001 CHECKED_PTR_OF(const type, x))) 01002 01003 int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x); 01004 int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a); 01005 int ASN1_GENERALIZEDTIME_print(BIO *fp,ASN1_GENERALIZEDTIME *a); 01006 int ASN1_TIME_print(BIO *fp,ASN1_TIME *a); 01007 int ASN1_STRING_print(BIO *bp,ASN1_STRING *v); 01008 int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags); 01009 int ASN1_parse(BIO *bp,const unsigned char *pp,long len,int indent); 01010 int ASN1_parse_dump(BIO *bp,const unsigned char *pp,long len,int indent,int dump); 01011 #endif 01012 const char *ASN1_tag2str(int tag); 01013 01014 /* Used to load and write netscape format cert/key */ 01015 int i2d_ASN1_HEADER(ASN1_HEADER *a,unsigned char **pp); 01016 ASN1_HEADER *d2i_ASN1_HEADER(ASN1_HEADER **a,const unsigned char **pp, long length); 01017 ASN1_HEADER *ASN1_HEADER_new(void ); 01018 void ASN1_HEADER_free(ASN1_HEADER *a); 01019 01020 int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s); 01021 01022 /* Not used that much at this point, except for the first two */ 01023 ASN1_METHOD *X509_asn1_meth(void); 01024 ASN1_METHOD *RSAPrivateKey_asn1_meth(void); 01025 ASN1_METHOD *ASN1_IA5STRING_asn1_meth(void); 01026 ASN1_METHOD *ASN1_BIT_STRING_asn1_meth(void); 01027 01028 int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, 01029 unsigned char *data, int len); 01030 int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, 01031 unsigned char *data, int max_len); 01032 int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, 01033 unsigned char *data, int len); 01034 int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num, 01035 unsigned char *data, int max_len); 01036 01037 STACK *ASN1_seq_unpack(const unsigned char *buf, int len, 01038 d2i_of_void *d2i, void (*free_func)(void *)); 01039 unsigned char *ASN1_seq_pack(STACK *safes, i2d_of_void *i2d, 01040 unsigned char **buf, int *len ); 01041 void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i); 01042 void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it); 01043 ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d, 01044 ASN1_OCTET_STRING **oct); 01045 01046 #define ASN1_pack_string_of(type,obj,i2d,oct) \ 01047 (ASN1_pack_string(CHECKED_PTR_OF(type, obj), \ 01048 CHECKED_I2D_OF(type, i2d), \ 01049 oct)) 01050 01051 ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct); 01052 01053 void ASN1_STRING_set_default_mask(unsigned long mask); 01054 int ASN1_STRING_set_default_mask_asc(char *p); 01055 unsigned long ASN1_STRING_get_default_mask(void); 01056 int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len, 01057 int inform, unsigned long mask); 01058 int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, 01059 int inform, unsigned long mask, 01060 long minsize, long maxsize); 01061 01062 ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, 01063 const unsigned char *in, int inlen, int inform, int nid); 01064 ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid); 01065 int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long); 01066 void ASN1_STRING_TABLE_cleanup(void); 01067 01068 /* ASN1 template functions */ 01069 01070 /* Old API compatible functions */ 01071 ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it); 01072 void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it); 01073 ASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, long len, const ASN1_ITEM *it); 01074 int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); 01075 int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); 01076 01077 void ASN1_add_oid_module(void); 01078 01079 ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf); 01080 ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf); 01081 01082 typedef int asn1_output_data_fn(BIO *out, BIO *data, ASN1_VALUE *val, int flags, 01083 const ASN1_ITEM *it); 01084 01085 int int_smime_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, 01086 int ctype_nid, int econt_nid, 01087 STACK_OF(X509_ALGOR) *mdalgs, 01088 asn1_output_data_fn *data_fn, 01089 const ASN1_ITEM *it); 01090 ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it); 01091 01092 /* BEGIN ERROR CODES */ 01093 /* The following lines are auto generated by the script mkerr.pl. Any changes 01094 * made after this point may be overwritten when the script is next run. 01095 */ 01096 void ERR_load_ASN1_strings(void); 01097 01098 /* Error codes for the ASN1 functions. */ 01099 01100 /* Function codes. */ 01101 #define ASN1_F_A2D_ASN1_OBJECT 100 01102 #define ASN1_F_A2I_ASN1_ENUMERATED 101 01103 #define ASN1_F_A2I_ASN1_INTEGER 102 01104 #define ASN1_F_A2I_ASN1_STRING 103 01105 #define ASN1_F_APPEND_EXP 176 01106 #define ASN1_F_ASN1_BIT_STRING_SET_BIT 183 01107 #define ASN1_F_ASN1_CB 177 01108 #define ASN1_F_ASN1_CHECK_TLEN 104 01109 #define ASN1_F_ASN1_COLLATE_PRIMITIVE 105 01110 #define ASN1_F_ASN1_COLLECT 106 01111 #define ASN1_F_ASN1_D2I_EX_PRIMITIVE 108 01112 #define ASN1_F_ASN1_D2I_FP 109 01113 #define ASN1_F_ASN1_D2I_READ_BIO 107 01114 #define ASN1_F_ASN1_DIGEST 184 01115 #define ASN1_F_ASN1_DO_ADB 110 01116 #define ASN1_F_ASN1_DUP 111 01117 #define ASN1_F_ASN1_ENUMERATED_SET 112 01118 #define ASN1_F_ASN1_ENUMERATED_TO_BN 113 01119 #define ASN1_F_ASN1_EX_C2I 204 01120 #define ASN1_F_ASN1_FIND_END 190 01121 #define ASN1_F_ASN1_GENERALIZEDTIME_SET 185 01122 #define ASN1_F_ASN1_GENERATE_V3 178 01123 #define ASN1_F_ASN1_GET_OBJECT 114 01124 #define ASN1_F_ASN1_HEADER_NEW 115 01125 #define ASN1_F_ASN1_I2D_BIO 116 01126 #define ASN1_F_ASN1_I2D_FP 117 01127 #define ASN1_F_ASN1_INTEGER_SET 118 01128 #define ASN1_F_ASN1_INTEGER_TO_BN 119 01129 #define ASN1_F_ASN1_ITEM_D2I_FP 206 01130 #define ASN1_F_ASN1_ITEM_DUP 191 01131 #define ASN1_F_ASN1_ITEM_EX_COMBINE_NEW 121 01132 #define ASN1_F_ASN1_ITEM_EX_D2I 120 01133 #define ASN1_F_ASN1_ITEM_I2D_BIO 192 01134 #define ASN1_F_ASN1_ITEM_I2D_FP 193 01135 #define ASN1_F_ASN1_ITEM_PACK 198 01136 #define ASN1_F_ASN1_ITEM_SIGN 195 01137 #define ASN1_F_ASN1_ITEM_UNPACK 199 01138 #define ASN1_F_ASN1_ITEM_VERIFY 197 01139 #define ASN1_F_ASN1_MBSTRING_NCOPY 122 01140 #define ASN1_F_ASN1_OBJECT_NEW 123 01141 #define ASN1_F_ASN1_OUTPUT_DATA 207 01142 #define ASN1_F_ASN1_PACK_STRING 124 01143 #define ASN1_F_ASN1_PCTX_NEW 205 01144 #define ASN1_F_ASN1_PKCS5_PBE_SET 125 01145 #define ASN1_F_ASN1_SEQ_PACK 126 01146 #define ASN1_F_ASN1_SEQ_UNPACK 127 01147 #define ASN1_F_ASN1_SIGN 128 01148 #define ASN1_F_ASN1_STR2TYPE 179 01149 #define ASN1_F_ASN1_STRING_SET 186 01150 #define ASN1_F_ASN1_STRING_TABLE_ADD 129 01151 #define ASN1_F_ASN1_STRING_TYPE_NEW 130 01152 #define ASN1_F_ASN1_TEMPLATE_EX_D2I 132 01153 #define ASN1_F_ASN1_TEMPLATE_NEW 133 01154 #define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I 131 01155 #define ASN1_F_ASN1_TIME_SET 175 01156 #define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 134 01157 #define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135 01158 #define ASN1_F_ASN1_UNPACK_STRING 136 01159 #define ASN1_F_ASN1_UTCTIME_SET 187 01160 #define ASN1_F_ASN1_VERIFY 137 01161 #define ASN1_F_B64_READ_ASN1 208 01162 #define ASN1_F_B64_WRITE_ASN1 209 01163 #define ASN1_F_BITSTR_CB 180 01164 #define ASN1_F_BN_TO_ASN1_ENUMERATED 138 01165 #define ASN1_F_BN_TO_ASN1_INTEGER 139 01166 #define ASN1_F_C2I_ASN1_BIT_STRING 189 01167 #define ASN1_F_C2I_ASN1_INTEGER 194 01168 #define ASN1_F_C2I_ASN1_OBJECT 196 01169 #define ASN1_F_COLLECT_DATA 140 01170 #define ASN1_F_D2I_ASN1_BIT_STRING 141 01171 #define ASN1_F_D2I_ASN1_BOOLEAN 142 01172 #define ASN1_F_D2I_ASN1_BYTES 143 01173 #define ASN1_F_D2I_ASN1_GENERALIZEDTIME 144 01174 #define ASN1_F_D2I_ASN1_HEADER 145 01175 #define ASN1_F_D2I_ASN1_INTEGER 146 01176 #define ASN1_F_D2I_ASN1_OBJECT 147 01177 #define ASN1_F_D2I_ASN1_SET 148 01178 #define ASN1_F_D2I_ASN1_TYPE_BYTES 149 01179 #define ASN1_F_D2I_ASN1_UINTEGER 150 01180 #define ASN1_F_D2I_ASN1_UTCTIME 151 01181 #define ASN1_F_D2I_NETSCAPE_RSA 152 01182 #define ASN1_F_D2I_NETSCAPE_RSA_2 153 01183 #define ASN1_F_D2I_PRIVATEKEY 154 01184 #define ASN1_F_D2I_PUBLICKEY 155 01185 #define ASN1_F_D2I_RSA_NET 200 01186 #define ASN1_F_D2I_RSA_NET_2 201 01187 #define ASN1_F_D2I_X509 156 01188 #define ASN1_F_D2I_X509_CINF 157 01189 #define ASN1_F_D2I_X509_PKEY 159 01190 #define ASN1_F_I2D_ASN1_SET 188 01191 #define ASN1_F_I2D_ASN1_TIME 160 01192 #define ASN1_F_I2D_DSA_PUBKEY 161 01193 #define ASN1_F_I2D_EC_PUBKEY 181 01194 #define ASN1_F_I2D_PRIVATEKEY 163 01195 #define ASN1_F_I2D_PUBLICKEY 164 01196 #define ASN1_F_I2D_RSA_NET 162 01197 #define ASN1_F_I2D_RSA_PUBKEY 165 01198 #define ASN1_F_LONG_C2I 166 01199 #define ASN1_F_OID_MODULE_INIT 174 01200 #define ASN1_F_PARSE_TAGGING 182 01201 #define ASN1_F_PKCS5_PBE2_SET 167 01202 #define ASN1_F_PKCS5_PBE_SET 202 01203 #define ASN1_F_SMIME_READ_ASN1 210 01204 #define ASN1_F_SMIME_TEXT 211 01205 #define ASN1_F_X509_CINF_NEW 168 01206 #define ASN1_F_X509_CRL_ADD0_REVOKED 169 01207 #define ASN1_F_X509_INFO_NEW 170 01208 #define ASN1_F_X509_NAME_ENCODE 203 01209 #define ASN1_F_X509_NAME_EX_D2I 158 01210 #define ASN1_F_X509_NAME_EX_NEW 171 01211 #define ASN1_F_X509_NEW 172 01212 #define ASN1_F_X509_PKEY_NEW 173 01213 01214 /* Reason codes. */ 01215 #define ASN1_R_ADDING_OBJECT 171 01216 #define ASN1_R_ASN1_PARSE_ERROR 198 01217 #define ASN1_R_ASN1_SIG_PARSE_ERROR 199 01218 #define ASN1_R_AUX_ERROR 100 01219 #define ASN1_R_BAD_CLASS 101 01220 #define ASN1_R_BAD_OBJECT_HEADER 102 01221 #define ASN1_R_BAD_PASSWORD_READ 103 01222 #define ASN1_R_BAD_TAG 104 01223 #define ASN1_R_BMPSTRING_IS_WRONG_LENGTH 210 01224 #define ASN1_R_BN_LIB 105 01225 #define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106 01226 #define ASN1_R_BUFFER_TOO_SMALL 107 01227 #define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 108 01228 #define ASN1_R_DATA_IS_WRONG 109 01229 #define ASN1_R_DECODE_ERROR 110 01230 #define ASN1_R_DECODING_ERROR 111 01231 #define ASN1_R_DEPTH_EXCEEDED 174 01232 #define ASN1_R_ENCODE_ERROR 112 01233 #define ASN1_R_ERROR_GETTING_TIME 173 01234 #define ASN1_R_ERROR_LOADING_SECTION 172 01235 #define ASN1_R_ERROR_PARSING_SET_ELEMENT 113 01236 #define ASN1_R_ERROR_SETTING_CIPHER_PARAMS 114 01237 #define ASN1_R_EXPECTING_AN_INTEGER 115 01238 #define ASN1_R_EXPECTING_AN_OBJECT 116 01239 #define ASN1_R_EXPECTING_A_BOOLEAN 117 01240 #define ASN1_R_EXPECTING_A_TIME 118 01241 #define ASN1_R_EXPLICIT_LENGTH_MISMATCH 119 01242 #define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED 120 01243 #define ASN1_R_FIELD_MISSING 121 01244 #define ASN1_R_FIRST_NUM_TOO_LARGE 122 01245 #define ASN1_R_HEADER_TOO_LONG 123 01246 #define ASN1_R_ILLEGAL_BITSTRING_FORMAT 175 01247 #define ASN1_R_ILLEGAL_BOOLEAN 176 01248 #define ASN1_R_ILLEGAL_CHARACTERS 124 01249 #define ASN1_R_ILLEGAL_FORMAT 177 01250 #define ASN1_R_ILLEGAL_HEX 178 01251 #define ASN1_R_ILLEGAL_IMPLICIT_TAG 179 01252 #define ASN1_R_ILLEGAL_INTEGER 180 01253 #define ASN1_R_ILLEGAL_NESTED_TAGGING 181 01254 #define ASN1_R_ILLEGAL_NULL 125 01255 #define ASN1_R_ILLEGAL_NULL_VALUE 182 01256 #define ASN1_R_ILLEGAL_OBJECT 183 01257 #define ASN1_R_ILLEGAL_OPTIONAL_ANY 126 01258 #define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE 170 01259 #define ASN1_R_ILLEGAL_TAGGED_ANY 127 01260 #define ASN1_R_ILLEGAL_TIME_VALUE 184 01261 #define ASN1_R_INTEGER_NOT_ASCII_FORMAT 185 01262 #define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128 01263 #define ASN1_R_INVALID_BMPSTRING_LENGTH 129 01264 #define ASN1_R_INVALID_DIGIT 130 01265 #define ASN1_R_INVALID_MIME_TYPE 200 01266 #define ASN1_R_INVALID_MODIFIER 186 01267 #define ASN1_R_INVALID_NUMBER 187 01268 #define ASN1_R_INVALID_OBJECT_ENCODING 212 01269 #define ASN1_R_INVALID_SEPARATOR 131 01270 #define ASN1_R_INVALID_TIME_FORMAT 132 01271 #define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133 01272 #define ASN1_R_INVALID_UTF8STRING 134 01273 #define ASN1_R_IV_TOO_LARGE 135 01274 #define ASN1_R_LENGTH_ERROR 136 01275 #define ASN1_R_LIST_ERROR 188 01276 #define ASN1_R_MIME_NO_CONTENT_TYPE 201 01277 #define ASN1_R_MIME_PARSE_ERROR 202 01278 #define ASN1_R_MIME_SIG_PARSE_ERROR 203 01279 #define ASN1_R_MISSING_EOC 137 01280 #define ASN1_R_MISSING_SECOND_NUMBER 138 01281 #define ASN1_R_MISSING_VALUE 189 01282 #define ASN1_R_MSTRING_NOT_UNIVERSAL 139 01283 #define ASN1_R_MSTRING_WRONG_TAG 140 01284 #define ASN1_R_NESTED_ASN1_STRING 197 01285 #define ASN1_R_NON_HEX_CHARACTERS 141 01286 #define ASN1_R_NOT_ASCII_FORMAT 190 01287 #define ASN1_R_NOT_ENOUGH_DATA 142 01288 #define ASN1_R_NO_CONTENT_TYPE 204 01289 #define ASN1_R_NO_MATCHING_CHOICE_TYPE 143 01290 #define ASN1_R_NO_MULTIPART_BODY_FAILURE 205 01291 #define ASN1_R_NO_MULTIPART_BOUNDARY 206 01292 #define ASN1_R_NO_SIG_CONTENT_TYPE 207 01293 #define ASN1_R_NULL_IS_WRONG_LENGTH 144 01294 #define ASN1_R_OBJECT_NOT_ASCII_FORMAT 191 01295 #define ASN1_R_ODD_NUMBER_OF_CHARS 145 01296 #define ASN1_R_PRIVATE_KEY_HEADER_MISSING 146 01297 #define ASN1_R_SECOND_NUMBER_TOO_LARGE 147 01298 #define ASN1_R_SEQUENCE_LENGTH_MISMATCH 148 01299 #define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149 01300 #define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 192 01301 #define ASN1_R_SHORT_LINE 150 01302 #define ASN1_R_SIG_INVALID_MIME_TYPE 208 01303 #define ASN1_R_STREAMING_NOT_SUPPORTED 209 01304 #define ASN1_R_STRING_TOO_LONG 151 01305 #define ASN1_R_STRING_TOO_SHORT 152 01306 #define ASN1_R_TAG_VALUE_TOO_HIGH 153 01307 #define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154 01308 #define ASN1_R_TIME_NOT_ASCII_FORMAT 193 01309 #define ASN1_R_TOO_LONG 155 01310 #define ASN1_R_TYPE_NOT_CONSTRUCTED 156 01311 #define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 157 01312 #define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 158 01313 #define ASN1_R_UNEXPECTED_EOC 159 01314 #define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH 211 01315 #define ASN1_R_UNKNOWN_FORMAT 160 01316 #define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161 01317 #define ASN1_R_UNKNOWN_OBJECT_TYPE 162 01318 #define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163 01319 #define ASN1_R_UNKNOWN_TAG 194 01320 #define ASN1_R_UNKOWN_FORMAT 195 01321 #define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164 01322 #define ASN1_R_UNSUPPORTED_CIPHER 165 01323 #define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 166 01324 #define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167 01325 #define ASN1_R_UNSUPPORTED_TYPE 196 01326 #define ASN1_R_WRONG_TAG 168 01327 #define ASN1_R_WRONG_TYPE 169 01328 01329 #ifdef __cplusplus 01330 } 01331 #endif 01332 #endif