diff options
Diffstat (limited to 'src/lib/libcrypto/asn1/asn1.h')
| -rw-r--r-- | src/lib/libcrypto/asn1/asn1.h | 1180 |
1 files changed, 712 insertions, 468 deletions
diff --git a/src/lib/libcrypto/asn1/asn1.h b/src/lib/libcrypto/asn1/asn1.h index 9793db365d..0d1713f8dd 100644 --- a/src/lib/libcrypto/asn1/asn1.h +++ b/src/lib/libcrypto/asn1/asn1.h | |||
| @@ -59,29 +59,49 @@ | |||
| 59 | #ifndef HEADER_ASN1_H | 59 | #ifndef HEADER_ASN1_H |
| 60 | #define HEADER_ASN1_H | 60 | #define HEADER_ASN1_H |
| 61 | 61 | ||
| 62 | #include <time.h> | ||
| 63 | #ifndef OPENSSL_NO_BIO | ||
| 64 | #include <openssl/bio.h> | ||
| 65 | #endif | ||
| 66 | #include <openssl/e_os2.h> | ||
| 67 | #include <openssl/bn.h> | ||
| 68 | #include <openssl/stack.h> | ||
| 69 | #include <openssl/safestack.h> | ||
| 70 | |||
| 71 | #include <openssl/symhacks.h> | ||
| 72 | |||
| 73 | #include <openssl/e_os2.h> | ||
| 74 | #include <openssl/ossl_typ.h> | ||
| 75 | |||
| 76 | #ifdef OPENSSL_BUILD_SHLIBCRYPTO | ||
| 77 | # undef OPENSSL_EXTERN | ||
| 78 | # define OPENSSL_EXTERN OPENSSL_EXPORT | ||
| 79 | #endif | ||
| 80 | |||
| 62 | #ifdef __cplusplus | 81 | #ifdef __cplusplus |
| 63 | extern "C" { | 82 | extern "C" { |
| 64 | #endif | 83 | #endif |
| 65 | 84 | ||
| 66 | #include <time.h> | ||
| 67 | #include "bn.h" | ||
| 68 | #include "stack.h" | ||
| 69 | |||
| 70 | #define V_ASN1_UNIVERSAL 0x00 | 85 | #define V_ASN1_UNIVERSAL 0x00 |
| 71 | #define V_ASN1_APPLICATION 0x40 | 86 | #define V_ASN1_APPLICATION 0x40 |
| 72 | #define V_ASN1_CONTEXT_SPECIFIC 0x80 | 87 | #define V_ASN1_CONTEXT_SPECIFIC 0x80 |
| 73 | #define V_ASN1_PRIVATE 0xc0 | 88 | #define V_ASN1_PRIVATE 0xc0 |
| 74 | 89 | ||
| 75 | #define V_ASN1_CONSTRUCTED 0x20 | 90 | #define V_ASN1_CONSTRUCTED 0x20 |
| 91 | #define V_ASN1_PRIMITIVE_TAG 0x1f | ||
| 76 | #define V_ASN1_PRIMATIVE_TAG 0x1f | 92 | #define V_ASN1_PRIMATIVE_TAG 0x1f |
| 77 | 93 | ||
| 78 | #define V_ASN1_APP_CHOOSE -2 /* let the recipent choose */ | 94 | #define V_ASN1_APP_CHOOSE -2 /* let the recipient choose */ |
| 95 | #define V_ASN1_OTHER -3 /* used in ASN1_TYPE */ | ||
| 96 | #define V_ASN1_ANY -4 /* used in ASN1 template code */ | ||
| 97 | |||
| 98 | #define V_ASN1_NEG 0x100 /* negative flag */ | ||
| 79 | 99 | ||
| 80 | #define V_ASN1_UNDEF -1 | 100 | #define V_ASN1_UNDEF -1 |
| 81 | #define V_ASN1_EOC 0 | 101 | #define V_ASN1_EOC 0 |
| 82 | #define V_ASN1_BOOLEAN 1 /**/ | 102 | #define V_ASN1_BOOLEAN 1 /**/ |
| 83 | #define V_ASN1_INTEGER 2 | 103 | #define V_ASN1_INTEGER 2 |
| 84 | #define V_ASN1_NEG_INTEGER (2+0x100) | 104 | #define V_ASN1_NEG_INTEGER (2 | V_ASN1_NEG) |
| 85 | #define V_ASN1_BIT_STRING 3 | 105 | #define V_ASN1_BIT_STRING 3 |
| 86 | #define V_ASN1_OCTET_STRING 4 | 106 | #define V_ASN1_OCTET_STRING 4 |
| 87 | #define V_ASN1_NULL 5 | 107 | #define V_ASN1_NULL 5 |
| @@ -89,7 +109,9 @@ extern "C" { | |||
| 89 | #define V_ASN1_OBJECT_DESCRIPTOR 7 | 109 | #define V_ASN1_OBJECT_DESCRIPTOR 7 |
| 90 | #define V_ASN1_EXTERNAL 8 | 110 | #define V_ASN1_EXTERNAL 8 |
| 91 | #define V_ASN1_REAL 9 | 111 | #define V_ASN1_REAL 9 |
| 92 | #define V_ASN1_ENUMERATED 10 /* microsoft weirdness */ | 112 | #define V_ASN1_ENUMERATED 10 |
| 113 | #define V_ASN1_NEG_ENUMERATED (10 | V_ASN1_NEG) | ||
| 114 | #define V_ASN1_UTF8STRING 12 | ||
| 93 | #define V_ASN1_SEQUENCE 16 | 115 | #define V_ASN1_SEQUENCE 16 |
| 94 | #define V_ASN1_SET 17 | 116 | #define V_ASN1_SET 17 |
| 95 | #define V_ASN1_NUMERICSTRING 18 /**/ | 117 | #define V_ASN1_NUMERICSTRING 18 /**/ |
| @@ -111,111 +133,33 @@ extern "C" { | |||
| 111 | #define B_ASN1_NUMERICSTRING 0x0001 | 133 | #define B_ASN1_NUMERICSTRING 0x0001 |
| 112 | #define B_ASN1_PRINTABLESTRING 0x0002 | 134 | #define B_ASN1_PRINTABLESTRING 0x0002 |
| 113 | #define B_ASN1_T61STRING 0x0004 | 135 | #define B_ASN1_T61STRING 0x0004 |
| 136 | #define B_ASN1_TELETEXSTRING 0x0008 | ||
| 114 | #define B_ASN1_VIDEOTEXSTRING 0x0008 | 137 | #define B_ASN1_VIDEOTEXSTRING 0x0008 |
| 115 | #define B_ASN1_IA5STRING 0x0010 | 138 | #define B_ASN1_IA5STRING 0x0010 |
| 116 | #define B_ASN1_GRAPHICSTRING 0x0020 | 139 | #define B_ASN1_GRAPHICSTRING 0x0020 |
| 117 | #define B_ASN1_ISO64STRING 0x0040 | 140 | #define B_ASN1_ISO64STRING 0x0040 |
| 141 | #define B_ASN1_VISIBLESTRING 0x0040 | ||
| 118 | #define B_ASN1_GENERALSTRING 0x0080 | 142 | #define B_ASN1_GENERALSTRING 0x0080 |
| 119 | #define B_ASN1_UNIVERSALSTRING 0x0100 | 143 | #define B_ASN1_UNIVERSALSTRING 0x0100 |
| 120 | #define B_ASN1_OCTET_STRING 0x0200 | 144 | #define B_ASN1_OCTET_STRING 0x0200 |
| 121 | #define B_ASN1_BIT_STRING 0x0400 | 145 | #define B_ASN1_BIT_STRING 0x0400 |
| 122 | #define B_ASN1_BMPSTRING 0x0800 | 146 | #define B_ASN1_BMPSTRING 0x0800 |
| 123 | #define B_ASN1_UNKNOWN 0x1000 | 147 | #define B_ASN1_UNKNOWN 0x1000 |
| 148 | #define B_ASN1_UTF8STRING 0x2000 | ||
| 149 | #define B_ASN1_UTCTIME 0x4000 | ||
| 150 | #define B_ASN1_GENERALIZEDTIME 0x8000 | ||
| 124 | 151 | ||
| 125 | #ifndef DEBUG | 152 | /* For use with ASN1_mbstring_copy() */ |
| 126 | 153 | #define MBSTRING_FLAG 0x1000 | |
| 127 | #define ASN1_INTEGER ASN1_STRING | 154 | #define MBSTRING_ASC (MBSTRING_FLAG|1) |
| 128 | #define ASN1_BIT_STRING ASN1_STRING | 155 | #define MBSTRING_BMP (MBSTRING_FLAG|2) |
| 129 | #define ASN1_OCTET_STRING ASN1_STRING | 156 | #define MBSTRING_UNIV (MBSTRING_FLAG|3) |
| 130 | #define ASN1_PRINTABLESTRING ASN1_STRING | 157 | #define MBSTRING_UTF8 (MBSTRING_FLAG|4) |
| 131 | #define ASN1_T61STRING ASN1_STRING | ||
| 132 | #define ASN1_IA5STRING ASN1_STRING | ||
| 133 | #define ASN1_UTCTIME ASN1_STRING | ||
| 134 | #define ASN1_GENERALIZEDTIME ASN1_STRING | ||
| 135 | #define ASN1_GENERALSTRING ASN1_STRING | ||
| 136 | #define ASN1_UNIVERSALSTRING ASN1_STRING | ||
| 137 | #define ASN1_BMPSTRING ASN1_STRING | ||
| 138 | |||
| 139 | #else | ||
| 140 | |||
| 141 | typedef struct asn1_integer_st | ||
| 142 | { | ||
| 143 | int length; | ||
| 144 | int type; | ||
| 145 | unsigned char *data; | ||
| 146 | } ASN1_INTEGER; | ||
| 147 | |||
| 148 | typedef struct asn1_bit_string_st | ||
| 149 | { | ||
| 150 | int length; | ||
| 151 | int type; | ||
| 152 | unsigned char *data; | ||
| 153 | } ASN1_BIT_STRING; | ||
| 154 | |||
| 155 | typedef struct asn1_octet_string_st | ||
| 156 | { | ||
| 157 | int length; | ||
| 158 | int type; | ||
| 159 | unsigned char *data; | ||
| 160 | } ASN1_OCTET_STRING; | ||
| 161 | |||
| 162 | typedef struct asn1_printablestring_st | ||
| 163 | { | ||
| 164 | int length; | ||
| 165 | int type; | ||
| 166 | unsigned char *data; | ||
| 167 | } ASN1_PRINTABLESTRING; | ||
| 168 | 158 | ||
| 169 | typedef struct asn1_t61string_st | 159 | struct X509_algor_st; |
| 170 | { | ||
| 171 | int length; | ||
| 172 | int type; | ||
| 173 | unsigned char *data; | ||
| 174 | } ASN1_T61STRING; | ||
| 175 | 160 | ||
| 176 | typedef struct asn1_ia5string_st | 161 | #define DECLARE_ASN1_SET_OF(type) /* filled in by mkstack.pl */ |
| 177 | { | 162 | #define IMPLEMENT_ASN1_SET_OF(type) /* nothing, no longer needed */ |
| 178 | int length; | ||
| 179 | int type; | ||
| 180 | unsigned char *data; | ||
| 181 | } ASN1_IA5STRING; | ||
| 182 | |||
| 183 | typedef struct asn1_generalstring_st | ||
| 184 | { | ||
| 185 | int length; | ||
| 186 | int type; | ||
| 187 | unsigned char *data; | ||
| 188 | } ASN1_GENERALSTRING; | ||
| 189 | |||
| 190 | typedef struct asn1_universalstring_st | ||
| 191 | { | ||
| 192 | int length; | ||
| 193 | int type; | ||
| 194 | unsigned char *data; | ||
| 195 | } ASN1_UNIVERSALSTRING; | ||
| 196 | |||
| 197 | typedef struct asn1_bmpstring_st | ||
| 198 | { | ||
| 199 | int length; | ||
| 200 | int type; | ||
| 201 | unsigned char *data; | ||
| 202 | } ASN1_BMPSTRING; | ||
| 203 | |||
| 204 | typedef struct asn1_utctime_st | ||
| 205 | { | ||
| 206 | int length; | ||
| 207 | int type; | ||
| 208 | unsigned char *data; | ||
| 209 | } ASN1_UTCTIME; | ||
| 210 | |||
| 211 | typedef struct asn1_generalizedtime_st | ||
| 212 | { | ||
| 213 | int length; | ||
| 214 | int type; | ||
| 215 | unsigned char *data; | ||
| 216 | } ASN1_GENERALIZEDTIME; | ||
| 217 | |||
| 218 | #endif | ||
| 219 | 163 | ||
| 220 | typedef struct asn1_ctx_st | 164 | typedef struct asn1_ctx_st |
| 221 | { | 165 | { |
| @@ -226,9 +170,10 @@ typedef struct asn1_ctx_st | |||
| 226 | int tag; /* tag from last 'get object' */ | 170 | int tag; /* tag from last 'get object' */ |
| 227 | int xclass; /* class from last 'get object' */ | 171 | int xclass; /* class from last 'get object' */ |
| 228 | long slen; /* length of last 'get object' */ | 172 | long slen; /* length of last 'get object' */ |
| 229 | unsigned char *max; /* largest value of p alowed */ | 173 | unsigned char *max; /* largest value of p allowed */ |
| 230 | unsigned char *q;/* temporary variable */ | 174 | unsigned char *q;/* temporary variable */ |
| 231 | unsigned char **pp;/* variable */ | 175 | unsigned char **pp;/* variable */ |
| 176 | int line; /* used in error processing */ | ||
| 232 | } ASN1_CTX; | 177 | } ASN1_CTX; |
| 233 | 178 | ||
| 234 | /* These are used internally in the ASN1_OBJECT to keep track of | 179 | /* These are used internally in the ASN1_OBJECT to keep track of |
| @@ -239,29 +184,274 @@ typedef struct asn1_ctx_st | |||
| 239 | #define ASN1_OBJECT_FLAG_DYNAMIC_DATA 0x08 /* internal use */ | 184 | #define ASN1_OBJECT_FLAG_DYNAMIC_DATA 0x08 /* internal use */ |
| 240 | typedef struct asn1_object_st | 185 | typedef struct asn1_object_st |
| 241 | { | 186 | { |
| 242 | char *sn,*ln; | 187 | const char *sn,*ln; |
| 243 | int nid; | 188 | int nid; |
| 244 | int length; | 189 | int length; |
| 245 | unsigned char *data; | 190 | unsigned char *data; |
| 246 | int flags; /* Should we free this one */ | 191 | int flags; /* Should we free this one */ |
| 247 | } ASN1_OBJECT; | 192 | } ASN1_OBJECT; |
| 248 | 193 | ||
| 194 | #define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */ | ||
| 249 | /* This is the base type that holds just about everything :-) */ | 195 | /* This is the base type that holds just about everything :-) */ |
| 250 | typedef struct asn1_string_st | 196 | typedef struct asn1_string_st |
| 251 | { | 197 | { |
| 252 | int length; | 198 | int length; |
| 253 | int type; | 199 | int type; |
| 254 | unsigned char *data; | 200 | unsigned char *data; |
| 201 | /* The value of the following field depends on the type being | ||
| 202 | * held. It is mostly being used for BIT_STRING so if the | ||
| 203 | * input data has a non-zero 'unused bits' value, it will be | ||
| 204 | * handled correctly */ | ||
| 205 | long flags; | ||
| 255 | } ASN1_STRING; | 206 | } ASN1_STRING; |
| 256 | 207 | ||
| 208 | /* ASN1_ENCODING structure: this is used to save the received | ||
| 209 | * encoding of an ASN1 type. This is useful to get round | ||
| 210 | * problems with invalid encodings which can break signatures. | ||
| 211 | */ | ||
| 212 | |||
| 213 | typedef struct ASN1_ENCODING_st | ||
| 214 | { | ||
| 215 | unsigned char *enc; /* DER encoding */ | ||
| 216 | long len; /* Length of encoding */ | ||
| 217 | int modified; /* set to 1 if 'enc' is invalid */ | ||
| 218 | } ASN1_ENCODING; | ||
| 219 | |||
| 220 | /* Used with ASN1 LONG type: if a long is set to this it is omitted */ | ||
| 221 | #define ASN1_LONG_UNDEF 0x7fffffffL | ||
| 222 | |||
| 223 | #define STABLE_FLAGS_MALLOC 0x01 | ||
| 224 | #define STABLE_NO_MASK 0x02 | ||
| 225 | #define DIRSTRING_TYPE \ | ||
| 226 | (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING) | ||
| 227 | #define PKCS9STRING_TYPE (DIRSTRING_TYPE|B_ASN1_IA5STRING) | ||
| 228 | |||
| 229 | typedef struct asn1_string_table_st { | ||
| 230 | int nid; | ||
| 231 | long minsize; | ||
| 232 | long maxsize; | ||
| 233 | unsigned long mask; | ||
| 234 | unsigned long flags; | ||
| 235 | } ASN1_STRING_TABLE; | ||
| 236 | |||
| 237 | DECLARE_STACK_OF(ASN1_STRING_TABLE) | ||
| 238 | |||
| 239 | /* size limits: this stuff is taken straight from RFC2459 */ | ||
| 240 | |||
| 241 | #define ub_name 32768 | ||
| 242 | #define ub_common_name 64 | ||
| 243 | #define ub_locality_name 128 | ||
| 244 | #define ub_state_name 128 | ||
| 245 | #define ub_organization_name 64 | ||
| 246 | #define ub_organization_unit_name 64 | ||
| 247 | #define ub_title 64 | ||
| 248 | #define ub_email_address 128 | ||
| 249 | |||
| 250 | /* Declarations for template structures: for full definitions | ||
| 251 | * see asn1t.h | ||
| 252 | */ | ||
| 253 | typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE; | ||
| 254 | typedef struct ASN1_ITEM_st ASN1_ITEM; | ||
| 255 | typedef struct ASN1_TLC_st ASN1_TLC; | ||
| 256 | /* This is just an opaque pointer */ | ||
| 257 | typedef struct ASN1_VALUE_st ASN1_VALUE; | ||
| 258 | |||
| 259 | /* Declare ASN1 functions: the implement macro in in asn1t.h */ | ||
| 260 | |||
| 261 | #define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type) | ||
| 262 | |||
| 263 | #define DECLARE_ASN1_FUNCTIONS_name(type, name) \ | ||
| 264 | type *name##_new(void); \ | ||
| 265 | void name##_free(type *a); \ | ||
| 266 | DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) | ||
| 267 | |||
| 268 | #define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \ | ||
| 269 | type *name##_new(void); \ | ||
| 270 | void name##_free(type *a); \ | ||
| 271 | DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) | ||
| 272 | |||
| 273 | #define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \ | ||
| 274 | type *d2i_##name(type **a, unsigned char **in, long len); \ | ||
| 275 | int i2d_##name(type *a, unsigned char **out); \ | ||
| 276 | DECLARE_ASN1_ITEM(itname) | ||
| 277 | |||
| 278 | #define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \ | ||
| 279 | type *d2i_##name(type **a, const unsigned char **in, long len); \ | ||
| 280 | int i2d_##name(const type *a, unsigned char **out); \ | ||
| 281 | DECLARE_ASN1_ITEM(name) | ||
| 282 | |||
| 283 | #define DECLARE_ASN1_FUNCTIONS_const(name) \ | ||
| 284 | name *name##_new(void); \ | ||
| 285 | void name##_free(name *a); | ||
| 286 | |||
| 287 | |||
| 288 | /* The following macros and typedefs allow an ASN1_ITEM | ||
| 289 | * to be embedded in a structure and referenced. Since | ||
| 290 | * the ASN1_ITEM pointers need to be globally accessible | ||
| 291 | * (possibly from shared libraries) they may exist in | ||
| 292 | * different forms. On platforms that support it the | ||
| 293 | * ASN1_ITEM structure itself will be globally exported. | ||
| 294 | * Other platforms will export a function that returns | ||
| 295 | * an ASN1_ITEM pointer. | ||
| 296 | * | ||
| 297 | * To handle both cases transparently the macros below | ||
| 298 | * should be used instead of hard coding an ASN1_ITEM | ||
| 299 | * pointer in a structure. | ||
| 300 | * | ||
| 301 | * The structure will look like this: | ||
| 302 | * | ||
| 303 | * typedef struct SOMETHING_st { | ||
| 304 | * ... | ||
| 305 | * ASN1_ITEM_EXP *iptr; | ||
| 306 | * ... | ||
| 307 | * } SOMETHING; | ||
| 308 | * | ||
| 309 | * It would be initialised as e.g.: | ||
| 310 | * | ||
| 311 | * SOMETHING somevar = {...,ASN1_ITEM_ref(X509),...}; | ||
| 312 | * | ||
| 313 | * and the actual pointer extracted with: | ||
| 314 | * | ||
| 315 | * const ASN1_ITEM *it = ASN1_ITEM_ptr(somevar.iptr); | ||
| 316 | * | ||
| 317 | * Finally an ASN1_ITEM pointer can be extracted from an | ||
| 318 | * appropriate reference with: ASN1_ITEM_rptr(X509). This | ||
| 319 | * would be used when a function takes an ASN1_ITEM * argument. | ||
| 320 | * | ||
| 321 | */ | ||
| 322 | |||
| 323 | #ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION | ||
| 324 | |||
| 325 | /* ASN1_ITEM pointer exported type */ | ||
| 326 | typedef const ASN1_ITEM ASN1_ITEM_EXP; | ||
| 327 | |||
| 328 | /* Macro to obtain ASN1_ITEM pointer from exported type */ | ||
| 329 | #define ASN1_ITEM_ptr(iptr) (iptr) | ||
| 330 | |||
| 331 | /* Macro to include ASN1_ITEM pointer from base type */ | ||
| 332 | #define ASN1_ITEM_ref(iptr) (&(iptr##_it)) | ||
| 333 | |||
| 334 | #define ASN1_ITEM_rptr(ref) (&(ref##_it)) | ||
| 335 | |||
| 336 | #define DECLARE_ASN1_ITEM(name) \ | ||
| 337 | OPENSSL_EXTERN const ASN1_ITEM name##_it; | ||
| 338 | |||
| 339 | #else | ||
| 340 | |||
| 341 | /* Platforms that can't easily handle shared global variables are declared | ||
| 342 | * as functions returning ASN1_ITEM pointers. | ||
| 343 | */ | ||
| 344 | |||
| 345 | /* ASN1_ITEM pointer exported type */ | ||
| 346 | typedef const ASN1_ITEM * ASN1_ITEM_EXP(void); | ||
| 347 | |||
| 348 | /* Macro to obtain ASN1_ITEM pointer from exported type */ | ||
| 349 | #define ASN1_ITEM_ptr(iptr) (iptr()) | ||
| 350 | |||
| 351 | /* Macro to include ASN1_ITEM pointer from base type */ | ||
| 352 | #define ASN1_ITEM_ref(iptr) (iptr##_it) | ||
| 353 | |||
| 354 | #define ASN1_ITEM_rptr(ref) (ref##_it()) | ||
| 355 | |||
| 356 | #define DECLARE_ASN1_ITEM(name) \ | ||
| 357 | const ASN1_ITEM * name##_it(void); | ||
| 358 | |||
| 359 | #endif | ||
| 360 | |||
| 361 | /* Parameters used by ASN1_STRING_print_ex() */ | ||
| 362 | |||
| 363 | /* These determine which characters to escape: | ||
| 364 | * RFC2253 special characters, control characters and | ||
| 365 | * MSB set characters | ||
| 366 | */ | ||
| 367 | |||
| 368 | #define ASN1_STRFLGS_ESC_2253 1 | ||
| 369 | #define ASN1_STRFLGS_ESC_CTRL 2 | ||
| 370 | #define ASN1_STRFLGS_ESC_MSB 4 | ||
| 371 | |||
| 372 | |||
| 373 | /* This flag determines how we do escaping: normally | ||
| 374 | * RC2253 backslash only, set this to use backslash and | ||
| 375 | * quote. | ||
| 376 | */ | ||
| 377 | |||
| 378 | #define ASN1_STRFLGS_ESC_QUOTE 8 | ||
| 379 | |||
| 380 | |||
| 381 | /* These three flags are internal use only. */ | ||
| 382 | |||
| 383 | /* Character is a valid PrintableString character */ | ||
| 384 | #define CHARTYPE_PRINTABLESTRING 0x10 | ||
| 385 | /* Character needs escaping if it is the first character */ | ||
| 386 | #define CHARTYPE_FIRST_ESC_2253 0x20 | ||
| 387 | /* Character needs escaping if it is the last character */ | ||
| 388 | #define CHARTYPE_LAST_ESC_2253 0x40 | ||
| 389 | |||
| 390 | /* NB the internal flags are safely reused below by flags | ||
| 391 | * handled at the top level. | ||
| 392 | */ | ||
| 393 | |||
| 394 | /* If this is set we convert all character strings | ||
| 395 | * to UTF8 first | ||
| 396 | */ | ||
| 397 | |||
| 398 | #define ASN1_STRFLGS_UTF8_CONVERT 0x10 | ||
| 399 | |||
| 400 | /* If this is set we don't attempt to interpret content: | ||
| 401 | * just assume all strings are 1 byte per character. This | ||
| 402 | * will produce some pretty odd looking output! | ||
| 403 | */ | ||
| 404 | |||
| 405 | #define ASN1_STRFLGS_IGNORE_TYPE 0x20 | ||
| 406 | |||
| 407 | /* If this is set we include the string type in the output */ | ||
| 408 | #define ASN1_STRFLGS_SHOW_TYPE 0x40 | ||
| 409 | |||
| 410 | /* This determines which strings to display and which to | ||
| 411 | * 'dump' (hex dump of content octets or DER encoding). We can | ||
| 412 | * only dump non character strings or everything. If we | ||
| 413 | * don't dump 'unknown' they are interpreted as character | ||
| 414 | * strings with 1 octet per character and are subject to | ||
| 415 | * the usual escaping options. | ||
| 416 | */ | ||
| 417 | |||
| 418 | #define ASN1_STRFLGS_DUMP_ALL 0x80 | ||
| 419 | #define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 | ||
| 420 | |||
| 421 | /* These determine what 'dumping' does, we can dump the | ||
| 422 | * content octets or the DER encoding: both use the | ||
| 423 | * RFC2253 #XXXXX notation. | ||
| 424 | */ | ||
| 425 | |||
| 426 | #define ASN1_STRFLGS_DUMP_DER 0x200 | ||
| 427 | |||
| 428 | /* All the string flags consistent with RFC2253, | ||
| 429 | * escaping control characters isn't essential in | ||
| 430 | * RFC2253 but it is advisable anyway. | ||
| 431 | */ | ||
| 432 | |||
| 433 | #define ASN1_STRFLGS_RFC2253 (ASN1_STRFLGS_ESC_2253 | \ | ||
| 434 | ASN1_STRFLGS_ESC_CTRL | \ | ||
| 435 | ASN1_STRFLGS_ESC_MSB | \ | ||
| 436 | ASN1_STRFLGS_UTF8_CONVERT | \ | ||
| 437 | ASN1_STRFLGS_DUMP_UNKNOWN | \ | ||
| 438 | ASN1_STRFLGS_DUMP_DER) | ||
| 439 | |||
| 440 | DECLARE_STACK_OF(ASN1_INTEGER) | ||
| 441 | DECLARE_ASN1_SET_OF(ASN1_INTEGER) | ||
| 442 | |||
| 443 | DECLARE_STACK_OF(ASN1_GENERALSTRING) | ||
| 444 | |||
| 257 | typedef struct asn1_type_st | 445 | typedef struct asn1_type_st |
| 258 | { | 446 | { |
| 259 | int type; | 447 | int type; |
| 260 | union { | 448 | union { |
| 261 | char *ptr; | 449 | char *ptr; |
| 450 | ASN1_BOOLEAN boolean; | ||
| 262 | ASN1_STRING * asn1_string; | 451 | ASN1_STRING * asn1_string; |
| 263 | ASN1_OBJECT * object; | 452 | ASN1_OBJECT * object; |
| 264 | ASN1_INTEGER * integer; | 453 | ASN1_INTEGER * integer; |
| 454 | ASN1_ENUMERATED * enumerated; | ||
| 265 | ASN1_BIT_STRING * bit_string; | 455 | ASN1_BIT_STRING * bit_string; |
| 266 | ASN1_OCTET_STRING * octet_string; | 456 | ASN1_OCTET_STRING * octet_string; |
| 267 | ASN1_PRINTABLESTRING * printablestring; | 457 | ASN1_PRINTABLESTRING * printablestring; |
| @@ -272,6 +462,8 @@ typedef struct asn1_type_st | |||
| 272 | ASN1_UNIVERSALSTRING * universalstring; | 462 | ASN1_UNIVERSALSTRING * universalstring; |
| 273 | ASN1_UTCTIME * utctime; | 463 | ASN1_UTCTIME * utctime; |
| 274 | ASN1_GENERALIZEDTIME * generalizedtime; | 464 | ASN1_GENERALIZEDTIME * generalizedtime; |
| 465 | ASN1_VISIBLESTRING * visiblestring; | ||
| 466 | ASN1_UTF8STRING * utf8string; | ||
| 275 | /* set and sequence are left complete and still | 467 | /* set and sequence are left complete and still |
| 276 | * contain the set or sequence bytes */ | 468 | * contain the set or sequence bytes */ |
| 277 | ASN1_STRING * set; | 469 | ASN1_STRING * set; |
| @@ -279,6 +471,9 @@ typedef struct asn1_type_st | |||
| 279 | } value; | 471 | } value; |
| 280 | } ASN1_TYPE; | 472 | } ASN1_TYPE; |
| 281 | 473 | ||
| 474 | DECLARE_STACK_OF(ASN1_TYPE) | ||
| 475 | DECLARE_ASN1_SET_OF(ASN1_TYPE) | ||
| 476 | |||
| 282 | typedef struct asn1_method_st | 477 | typedef struct asn1_method_st |
| 283 | { | 478 | { |
| 284 | int (*i2d)(); | 479 | int (*i2d)(); |
| @@ -295,64 +490,110 @@ typedef struct asn1_header_st | |||
| 295 | ASN1_METHOD *meth; | 490 | ASN1_METHOD *meth; |
| 296 | } ASN1_HEADER; | 491 | } ASN1_HEADER; |
| 297 | 492 | ||
| 298 | #define ASN1_STRING_length(x) ((x)->length) | 493 | /* This is used to contain a list of bit names */ |
| 299 | #define ASN1_STRING_type(x) ((x)->type) | 494 | typedef struct BIT_STRING_BITNAME_st { |
| 300 | #define ASN1_STRING_data(x) ((x)->data) | 495 | int bitnum; |
| 496 | const char *lname; | ||
| 497 | const char *sname; | ||
| 498 | } BIT_STRING_BITNAME; | ||
| 499 | |||
| 500 | |||
| 501 | #define M_ASN1_STRING_length(x) ((x)->length) | ||
| 502 | #define M_ASN1_STRING_length_set(x, n) ((x)->length = (n)) | ||
| 503 | #define M_ASN1_STRING_type(x) ((x)->type) | ||
| 504 | #define M_ASN1_STRING_data(x) ((x)->data) | ||
| 301 | 505 | ||
| 302 | /* Macros for string operations */ | 506 | /* Macros for string operations */ |
| 303 | #define ASN1_BIT_STRING_new() (ASN1_BIT_STRING *)\ | 507 | #define M_ASN1_BIT_STRING_new() (ASN1_BIT_STRING *)\ |
| 304 | ASN1_STRING_type_new(V_ASN1_BIT_STRING) | 508 | ASN1_STRING_type_new(V_ASN1_BIT_STRING) |
| 305 | #define ASN1_BIT_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) | 509 | #define M_ASN1_BIT_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) |
| 306 | #define ASN1_BIT_STRING_dup(a) (ASN1_BIT_STRING *)\ | 510 | #define M_ASN1_BIT_STRING_dup(a) (ASN1_BIT_STRING *)\ |
| 307 | ASN1_STRING_dup((ASN1_STRING *)a) | 511 | ASN1_STRING_dup((ASN1_STRING *)a) |
| 308 | #define ASN1_BIT_STRING_cmp(a,b) ASN1_STRING_cmp(\ | 512 | #define M_ASN1_BIT_STRING_cmp(a,b) ASN1_STRING_cmp(\ |
| 309 | (ASN1_STRING *)a,(ASN1_STRING *)b) | 513 | (ASN1_STRING *)a,(ASN1_STRING *)b) |
| 310 | #define ASN1_BIT_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c) | 514 | #define M_ASN1_BIT_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c) |
| 311 | /* i2d_ASN1_BIT_STRING() is a function */ | ||
| 312 | /* d2i_ASN1_BIT_STRING() is a function */ | ||
| 313 | 515 | ||
| 314 | #define ASN1_INTEGER_new() (ASN1_INTEGER *)\ | 516 | #define M_ASN1_INTEGER_new() (ASN1_INTEGER *)\ |
| 315 | ASN1_STRING_type_new(V_ASN1_INTEGER) | 517 | ASN1_STRING_type_new(V_ASN1_INTEGER) |
| 316 | #define ASN1_INTEGER_free(a) ASN1_STRING_free((ASN1_STRING *)a) | 518 | #define M_ASN1_INTEGER_free(a) ASN1_STRING_free((ASN1_STRING *)a) |
| 317 | #define ASN1_INTEGER_dup(a) (ASN1_INTEGER *)ASN1_STRING_dup((ASN1_STRING *)a) | 519 | #define M_ASN1_INTEGER_dup(a) (ASN1_INTEGER *)ASN1_STRING_dup((ASN1_STRING *)a) |
| 318 | #define ASN1_INTEGER_cmp(a,b) ASN1_STRING_cmp(\ | 520 | #define M_ASN1_INTEGER_cmp(a,b) ASN1_STRING_cmp(\ |
| 521 | (ASN1_STRING *)a,(ASN1_STRING *)b) | ||
| 522 | |||
| 523 | #define M_ASN1_ENUMERATED_new() (ASN1_ENUMERATED *)\ | ||
| 524 | ASN1_STRING_type_new(V_ASN1_ENUMERATED) | ||
| 525 | #define M_ASN1_ENUMERATED_free(a) ASN1_STRING_free((ASN1_STRING *)a) | ||
| 526 | #define M_ASN1_ENUMERATED_dup(a) (ASN1_ENUMERATED *)ASN1_STRING_dup((ASN1_STRING *)a) | ||
| 527 | #define M_ASN1_ENUMERATED_cmp(a,b) ASN1_STRING_cmp(\ | ||
| 319 | (ASN1_STRING *)a,(ASN1_STRING *)b) | 528 | (ASN1_STRING *)a,(ASN1_STRING *)b) |
| 320 | /* ASN1_INTEGER_set() is a function, also see BN_to_ASN1_INTEGER() */ | ||
| 321 | /* ASN1_INTEGER_get() is a function, also see ASN1_INTEGER_to_BN() */ | ||
| 322 | /* i2d_ASN1_INTEGER() is a function */ | ||
| 323 | /* d2i_ASN1_INTEGER() is a function */ | ||
| 324 | 529 | ||
| 325 | #define ASN1_OCTET_STRING_new() (ASN1_OCTET_STRING *)\ | 530 | #define M_ASN1_OCTET_STRING_new() (ASN1_OCTET_STRING *)\ |
| 326 | ASN1_STRING_type_new(V_ASN1_OCTET_STRING) | 531 | ASN1_STRING_type_new(V_ASN1_OCTET_STRING) |
| 327 | #define ASN1_OCTET_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) | 532 | #define M_ASN1_OCTET_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) |
| 328 | #define ASN1_OCTET_STRING_dup(a) (ASN1_OCTET_STRING *)\ | 533 | #define M_ASN1_OCTET_STRING_dup(a) (ASN1_OCTET_STRING *)\ |
| 329 | ASN1_STRING_dup((ASN1_STRING *)a) | 534 | ASN1_STRING_dup((ASN1_STRING *)a) |
| 330 | #define ASN1_OCTET_STRING_cmp(a,b) ASN1_STRING_cmp(\ | 535 | #define M_ASN1_OCTET_STRING_cmp(a,b) ASN1_STRING_cmp(\ |
| 331 | (ASN1_STRING *)a,(ASN1_STRING *)b) | 536 | (ASN1_STRING *)a,(ASN1_STRING *)b) |
| 332 | #define ASN1_OCTET_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c) | 537 | #define M_ASN1_OCTET_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c) |
| 333 | #define ASN1_OCTET_STRING_print(a,b) ASN1_STRING_print(a,(ASN1_STRING *)b) | 538 | #define M_ASN1_OCTET_STRING_print(a,b) ASN1_STRING_print(a,(ASN1_STRING *)b) |
| 334 | #define M_i2d_ASN1_OCTET_STRING(a,pp) \ | 539 | #define M_i2d_ASN1_OCTET_STRING(a,pp) \ |
| 335 | i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_OCTET_STRING,\ | 540 | i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_OCTET_STRING,\ |
| 336 | V_ASN1_OCTET_STRING) | 541 | V_ASN1_UNIVERSAL) |
| 337 | /* d2i_ASN1_OCTET_STRING() is a function */ | ||
| 338 | 542 | ||
| 339 | #define ASN1_PRINTABLE_new() ASN1_STRING_type_new(V_ASN1_T61STRING) | 543 | #define B_ASN1_TIME \ |
| 340 | #define ASN1_PRINTABLE_free(a) ASN1_STRING_free((ASN1_STRING *)a) | 544 | B_ASN1_UTCTIME | \ |
| 341 | #define M_i2d_ASN1_PRINTABLE(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\ | 545 | B_ASN1_GENERALIZEDTIME |
| 342 | pp,a->type,V_ASN1_UNIVERSAL) | 546 | |
| 343 | #define M_d2i_ASN1_PRINTABLE(a,pp,l) \ | 547 | #define B_ASN1_PRINTABLE \ |
| 344 | d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \ | ||
| 345 | B_ASN1_PRINTABLESTRING| \ | 548 | B_ASN1_PRINTABLESTRING| \ |
| 346 | B_ASN1_T61STRING| \ | 549 | B_ASN1_T61STRING| \ |
| 347 | B_ASN1_IA5STRING| \ | 550 | B_ASN1_IA5STRING| \ |
| 348 | B_ASN1_BIT_STRING| \ | 551 | B_ASN1_BIT_STRING| \ |
| 349 | B_ASN1_UNIVERSALSTRING|\ | 552 | B_ASN1_UNIVERSALSTRING|\ |
| 350 | B_ASN1_BMPSTRING|\ | 553 | B_ASN1_BMPSTRING|\ |
| 351 | B_ASN1_UNKNOWN) | 554 | B_ASN1_UTF8STRING|\ |
| 555 | B_ASN1_UNKNOWN | ||
| 352 | 556 | ||
| 353 | #define ASN1_PRINTABLESTRING_new() (ASN1_PRINTABLESTRING_STRING *)\ | 557 | #define B_ASN1_DIRECTORYSTRING \ |
| 558 | B_ASN1_PRINTABLESTRING| \ | ||
| 559 | B_ASN1_TELETEXSTRING|\ | ||
| 560 | B_ASN1_BMPSTRING|\ | ||
| 561 | B_ASN1_UNIVERSALSTRING|\ | ||
| 562 | B_ASN1_UTF8STRING | ||
| 563 | |||
| 564 | #define B_ASN1_DISPLAYTEXT \ | ||
| 565 | B_ASN1_IA5STRING| \ | ||
| 566 | B_ASN1_VISIBLESTRING| \ | ||
| 567 | B_ASN1_BMPSTRING|\ | ||
| 568 | B_ASN1_UTF8STRING | ||
| 569 | |||
| 570 | #define M_ASN1_PRINTABLE_new() ASN1_STRING_type_new(V_ASN1_T61STRING) | ||
| 571 | #define M_ASN1_PRINTABLE_free(a) ASN1_STRING_free((ASN1_STRING *)a) | ||
| 572 | #define M_i2d_ASN1_PRINTABLE(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\ | ||
| 573 | pp,a->type,V_ASN1_UNIVERSAL) | ||
| 574 | #define M_d2i_ASN1_PRINTABLE(a,pp,l) \ | ||
| 575 | d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \ | ||
| 576 | B_ASN1_PRINTABLE) | ||
| 577 | |||
| 578 | #define M_DIRECTORYSTRING_new() ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING) | ||
| 579 | #define M_DIRECTORYSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) | ||
| 580 | #define M_i2d_DIRECTORYSTRING(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\ | ||
| 581 | pp,a->type,V_ASN1_UNIVERSAL) | ||
| 582 | #define M_d2i_DIRECTORYSTRING(a,pp,l) \ | ||
| 583 | d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \ | ||
| 584 | B_ASN1_DIRECTORYSTRING) | ||
| 585 | |||
| 586 | #define M_DISPLAYTEXT_new() ASN1_STRING_type_new(V_ASN1_VISIBLESTRING) | ||
| 587 | #define M_DISPLAYTEXT_free(a) ASN1_STRING_free((ASN1_STRING *)a) | ||
| 588 | #define M_i2d_DISPLAYTEXT(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\ | ||
| 589 | pp,a->type,V_ASN1_UNIVERSAL) | ||
| 590 | #define M_d2i_DISPLAYTEXT(a,pp,l) \ | ||
| 591 | d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \ | ||
| 592 | B_ASN1_DISPLAYTEXT) | ||
| 593 | |||
| 594 | #define M_ASN1_PRINTABLESTRING_new() (ASN1_PRINTABLESTRING *)\ | ||
| 354 | ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING) | 595 | ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING) |
| 355 | #define ASN1_PRINTABLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) | 596 | #define M_ASN1_PRINTABLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) |
| 356 | #define M_i2d_ASN1_PRINTABLESTRING(a,pp) \ | 597 | #define M_i2d_ASN1_PRINTABLESTRING(a,pp) \ |
| 357 | i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_PRINTABLESTRING,\ | 598 | i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_PRINTABLESTRING,\ |
| 358 | V_ASN1_UNIVERSAL) | 599 | V_ASN1_UNIVERSAL) |
| @@ -360,9 +601,9 @@ typedef struct asn1_header_st | |||
| 360 | (ASN1_PRINTABLESTRING *)d2i_ASN1_type_bytes\ | 601 | (ASN1_PRINTABLESTRING *)d2i_ASN1_type_bytes\ |
| 361 | ((ASN1_STRING **)a,pp,l,B_ASN1_PRINTABLESTRING) | 602 | ((ASN1_STRING **)a,pp,l,B_ASN1_PRINTABLESTRING) |
| 362 | 603 | ||
| 363 | #define ASN1_T61STRING_new() (ASN1_T61STRING_STRING *)\ | 604 | #define M_ASN1_T61STRING_new() (ASN1_T61STRING *)\ |
| 364 | ASN1_STRING_type_new(V_ASN1_T61STRING) | 605 | ASN1_STRING_type_new(V_ASN1_T61STRING) |
| 365 | #define ASN1_T61STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) | 606 | #define M_ASN1_T61STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) |
| 366 | #define M_i2d_ASN1_T61STRING(a,pp) \ | 607 | #define M_i2d_ASN1_T61STRING(a,pp) \ |
| 367 | i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_T61STRING,\ | 608 | i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_T61STRING,\ |
| 368 | V_ASN1_UNIVERSAL) | 609 | V_ASN1_UNIVERSAL) |
| @@ -370,9 +611,11 @@ typedef struct asn1_header_st | |||
| 370 | (ASN1_T61STRING *)d2i_ASN1_type_bytes\ | 611 | (ASN1_T61STRING *)d2i_ASN1_type_bytes\ |
| 371 | ((ASN1_STRING **)a,pp,l,B_ASN1_T61STRING) | 612 | ((ASN1_STRING **)a,pp,l,B_ASN1_T61STRING) |
| 372 | 613 | ||
| 373 | #define ASN1_IA5STRING_new() (ASN1_IA5STRING *)\ | 614 | #define M_ASN1_IA5STRING_new() (ASN1_IA5STRING *)\ |
| 374 | ASN1_STRING_type_new(V_ASN1_IA5STRING) | 615 | ASN1_STRING_type_new(V_ASN1_IA5STRING) |
| 375 | #define ASN1_IA5STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) | 616 | #define M_ASN1_IA5STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) |
| 617 | #define M_ASN1_IA5STRING_dup(a) \ | ||
| 618 | (ASN1_IA5STRING *)ASN1_STRING_dup((ASN1_STRING *)a) | ||
| 376 | #define M_i2d_ASN1_IA5STRING(a,pp) \ | 619 | #define M_i2d_ASN1_IA5STRING(a,pp) \ |
| 377 | i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_IA5STRING,\ | 620 | i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_IA5STRING,\ |
| 378 | V_ASN1_UNIVERSAL) | 621 | V_ASN1_UNIVERSAL) |
| @@ -380,28 +623,25 @@ typedef struct asn1_header_st | |||
| 380 | (ASN1_IA5STRING *)d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l,\ | 623 | (ASN1_IA5STRING *)d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l,\ |
| 381 | B_ASN1_IA5STRING) | 624 | B_ASN1_IA5STRING) |
| 382 | 625 | ||
| 383 | #define ASN1_UTCTIME_new() (ASN1_UTCTIME *)\ | 626 | #define M_ASN1_UTCTIME_new() (ASN1_UTCTIME *)\ |
| 384 | ASN1_STRING_type_new(V_ASN1_UTCTIME) | 627 | ASN1_STRING_type_new(V_ASN1_UTCTIME) |
| 385 | #define ASN1_UTCTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) | 628 | #define M_ASN1_UTCTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) |
| 386 | #define ASN1_UTCTIME_dup(a) (ASN1_UTCTIME *)ASN1_STRING_dup((ASN1_STRING *)a) | 629 | #define M_ASN1_UTCTIME_dup(a) (ASN1_UTCTIME *)ASN1_STRING_dup((ASN1_STRING *)a) |
| 387 | /* i2d_ASN1_UTCTIME() is a function */ | 630 | |
| 388 | /* d2i_ASN1_UTCTIME() is a function */ | 631 | #define M_ASN1_GENERALIZEDTIME_new() (ASN1_GENERALIZEDTIME *)\ |
| 389 | /* ASN1_UTCTIME_set() is a function */ | ||
| 390 | /* ASN1_UTCTIME_check() is a function */ | ||
| 391 | |||
| 392 | #define ASN1_GENERALIZEDTIME_new() (ASN1_GENERALIZEDTIME *)\ | ||
| 393 | ASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME) | 632 | ASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME) |
| 394 | #define ASN1_GENERALIZEDTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) | 633 | #define M_ASN1_GENERALIZEDTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) |
| 395 | #define ASN1_GENERALIZEDTIME_dup(a) (ASN1_UTCTIME *)ASN1_STRING_dup(\ | 634 | #define M_ASN1_GENERALIZEDTIME_dup(a) (ASN1_GENERALIZEDTIME *)ASN1_STRING_dup(\ |
| 396 | (ASN1_STRING *)a) | 635 | (ASN1_STRING *)a) |
| 397 | /* DOES NOT EXIST YET i2d_ASN1_GENERALIZEDTIME() is a function */ | ||
| 398 | /* DOES NOT EXIST YET d2i_ASN1_GENERALIZEDTIME() is a function */ | ||
| 399 | /* DOES NOT EXIST YET ASN1_GENERALIZEDTIME_set() is a function */ | ||
| 400 | /* DOES NOT EXIST YET ASN1_GENERALIZEDTIME_check() is a function */ | ||
| 401 | 636 | ||
| 402 | #define ASN1_GENERALSTRING_new() (ASN1_GENERALSTRING *)\ | 637 | #define M_ASN1_TIME_new() (ASN1_TIME *)\ |
| 638 | ASN1_STRING_type_new(V_ASN1_UTCTIME) | ||
| 639 | #define M_ASN1_TIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) | ||
| 640 | #define M_ASN1_TIME_dup(a) (ASN1_TIME *)ASN1_STRING_dup((ASN1_STRING *)a) | ||
| 641 | |||
| 642 | #define M_ASN1_GENERALSTRING_new() (ASN1_GENERALSTRING *)\ | ||
| 403 | ASN1_STRING_type_new(V_ASN1_GENERALSTRING) | 643 | ASN1_STRING_type_new(V_ASN1_GENERALSTRING) |
| 404 | #define ASN1_GENERALSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) | 644 | #define M_ASN1_GENERALSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) |
| 405 | #define M_i2d_ASN1_GENERALSTRING(a,pp) \ | 645 | #define M_i2d_ASN1_GENERALSTRING(a,pp) \ |
| 406 | i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_GENERALSTRING,\ | 646 | i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_GENERALSTRING,\ |
| 407 | V_ASN1_UNIVERSAL) | 647 | V_ASN1_UNIVERSAL) |
| @@ -409,9 +649,9 @@ typedef struct asn1_header_st | |||
| 409 | (ASN1_GENERALSTRING *)d2i_ASN1_type_bytes\ | 649 | (ASN1_GENERALSTRING *)d2i_ASN1_type_bytes\ |
| 410 | ((ASN1_STRING **)a,pp,l,B_ASN1_GENERALSTRING) | 650 | ((ASN1_STRING **)a,pp,l,B_ASN1_GENERALSTRING) |
| 411 | 651 | ||
| 412 | #define ASN1_UNIVERSALSTRING_new() (ASN1_UNIVERSALSTRING *)\ | 652 | #define M_ASN1_UNIVERSALSTRING_new() (ASN1_UNIVERSALSTRING *)\ |
| 413 | ASN1_STRING_type_new(V_ASN1_UNIVERSALSTRING) | 653 | ASN1_STRING_type_new(V_ASN1_UNIVERSALSTRING) |
| 414 | #define ASN1_UNIVERSALSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) | 654 | #define M_ASN1_UNIVERSALSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) |
| 415 | #define M_i2d_ASN1_UNIVERSALSTRING(a,pp) \ | 655 | #define M_i2d_ASN1_UNIVERSALSTRING(a,pp) \ |
| 416 | i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UNIVERSALSTRING,\ | 656 | i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UNIVERSALSTRING,\ |
| 417 | V_ASN1_UNIVERSAL) | 657 | V_ASN1_UNIVERSAL) |
| @@ -419,9 +659,9 @@ typedef struct asn1_header_st | |||
| 419 | (ASN1_UNIVERSALSTRING *)d2i_ASN1_type_bytes\ | 659 | (ASN1_UNIVERSALSTRING *)d2i_ASN1_type_bytes\ |
| 420 | ((ASN1_STRING **)a,pp,l,B_ASN1_UNIVERSALSTRING) | 660 | ((ASN1_STRING **)a,pp,l,B_ASN1_UNIVERSALSTRING) |
| 421 | 661 | ||
| 422 | #define ASN1_BMPSTRING_new() (ASN1_BMPSTRING *)\ | 662 | #define M_ASN1_BMPSTRING_new() (ASN1_BMPSTRING *)\ |
| 423 | ASN1_STRING_type_new(V_ASN1_BMPSTRING) | 663 | ASN1_STRING_type_new(V_ASN1_BMPSTRING) |
| 424 | #define ASN1_BMPSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) | 664 | #define M_ASN1_BMPSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) |
| 425 | #define M_i2d_ASN1_BMPSTRING(a,pp) \ | 665 | #define M_i2d_ASN1_BMPSTRING(a,pp) \ |
| 426 | i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_BMPSTRING,\ | 666 | i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_BMPSTRING,\ |
| 427 | V_ASN1_UNIVERSAL) | 667 | V_ASN1_UNIVERSAL) |
| @@ -429,88 +669,164 @@ typedef struct asn1_header_st | |||
| 429 | (ASN1_BMPSTRING *)d2i_ASN1_type_bytes\ | 669 | (ASN1_BMPSTRING *)d2i_ASN1_type_bytes\ |
| 430 | ((ASN1_STRING **)a,pp,l,B_ASN1_BMPSTRING) | 670 | ((ASN1_STRING **)a,pp,l,B_ASN1_BMPSTRING) |
| 431 | 671 | ||
| 432 | #ifndef NOPROTO | 672 | #define M_ASN1_VISIBLESTRING_new() (ASN1_VISIBLESTRING *)\ |
| 433 | ASN1_TYPE * ASN1_TYPE_new(void ); | 673 | ASN1_STRING_type_new(V_ASN1_VISIBLESTRING) |
| 434 | void ASN1_TYPE_free(ASN1_TYPE *a); | 674 | #define M_ASN1_VISIBLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) |
| 435 | int i2d_ASN1_TYPE(ASN1_TYPE *a,unsigned char **pp); | 675 | #define M_i2d_ASN1_VISIBLESTRING(a,pp) \ |
| 436 | ASN1_TYPE * d2i_ASN1_TYPE(ASN1_TYPE **a,unsigned char **pp,long length); | 676 | i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_VISIBLESTRING,\ |
| 677 | V_ASN1_UNIVERSAL) | ||
| 678 | #define M_d2i_ASN1_VISIBLESTRING(a,pp,l) \ | ||
| 679 | (ASN1_VISIBLESTRING *)d2i_ASN1_type_bytes\ | ||
| 680 | ((ASN1_STRING **)a,pp,l,B_ASN1_VISIBLESTRING) | ||
| 681 | |||
| 682 | #define M_ASN1_UTF8STRING_new() (ASN1_UTF8STRING *)\ | ||
| 683 | ASN1_STRING_type_new(V_ASN1_UTF8STRING) | ||
| 684 | #define M_ASN1_UTF8STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) | ||
| 685 | #define M_i2d_ASN1_UTF8STRING(a,pp) \ | ||
| 686 | i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UTF8STRING,\ | ||
| 687 | V_ASN1_UNIVERSAL) | ||
| 688 | #define M_d2i_ASN1_UTF8STRING(a,pp,l) \ | ||
| 689 | (ASN1_UTF8STRING *)d2i_ASN1_type_bytes\ | ||
| 690 | ((ASN1_STRING **)a,pp,l,B_ASN1_UTF8STRING) | ||
| 691 | |||
| 692 | /* for the is_set parameter to i2d_ASN1_SET */ | ||
| 693 | #define IS_SEQUENCE 0 | ||
| 694 | #define IS_SET 1 | ||
| 695 | |||
| 696 | DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE) | ||
| 697 | |||
| 437 | int ASN1_TYPE_get(ASN1_TYPE *a); | 698 | int ASN1_TYPE_get(ASN1_TYPE *a); |
| 438 | void ASN1_TYPE_set(ASN1_TYPE *a, int type, char *value); | 699 | void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value); |
| 439 | 700 | ||
| 440 | ASN1_OBJECT * ASN1_OBJECT_new(void ); | 701 | ASN1_OBJECT * ASN1_OBJECT_new(void ); |
| 441 | void ASN1_OBJECT_free(ASN1_OBJECT *a); | 702 | void ASN1_OBJECT_free(ASN1_OBJECT *a); |
| 442 | int i2d_ASN1_OBJECT(ASN1_OBJECT *a,unsigned char **pp); | 703 | int i2d_ASN1_OBJECT(ASN1_OBJECT *a,unsigned char **pp); |
| 704 | ASN1_OBJECT * c2i_ASN1_OBJECT(ASN1_OBJECT **a,unsigned char **pp, | ||
| 705 | long length); | ||
| 443 | ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,unsigned char **pp, | 706 | ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,unsigned char **pp, |
| 444 | long length); | 707 | long length); |
| 445 | 708 | ||
| 446 | ASN1_STRING * ASN1_STRING_new(void ); | 709 | DECLARE_ASN1_ITEM(ASN1_OBJECT) |
| 710 | |||
| 711 | DECLARE_STACK_OF(ASN1_OBJECT) | ||
| 712 | DECLARE_ASN1_SET_OF(ASN1_OBJECT) | ||
| 713 | |||
| 714 | ASN1_STRING * ASN1_STRING_new(void); | ||
| 447 | void ASN1_STRING_free(ASN1_STRING *a); | 715 | void ASN1_STRING_free(ASN1_STRING *a); |
| 448 | ASN1_STRING * ASN1_STRING_dup(ASN1_STRING *a); | 716 | ASN1_STRING * ASN1_STRING_dup(ASN1_STRING *a); |
| 449 | ASN1_STRING * ASN1_STRING_type_new(int type ); | 717 | ASN1_STRING * ASN1_STRING_type_new(int type ); |
| 450 | int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b); | 718 | int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b); |
| 451 | int ASN1_STRING_set(ASN1_STRING *str,unsigned char *data, int len); | 719 | /* Since this is used to store all sorts of things, via macros, for now, make |
| 452 | 720 | its data void * */ | |
| 453 | int i2d_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp); | 721 | int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len); |
| 454 | ASN1_BIT_STRING *d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,unsigned char **pp, | 722 | int ASN1_STRING_length(ASN1_STRING *x); |
| 723 | void ASN1_STRING_length_set(ASN1_STRING *x, int n); | ||
| 724 | int ASN1_STRING_type(ASN1_STRING *x); | ||
| 725 | unsigned char * ASN1_STRING_data(ASN1_STRING *x); | ||
| 726 | |||
| 727 | DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING) | ||
| 728 | int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp); | ||
| 729 | ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,unsigned char **pp, | ||
| 455 | long length); | 730 | long length); |
| 731 | int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, | ||
| 732 | int length ); | ||
| 456 | int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); | 733 | int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); |
| 457 | int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n); | 734 | int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n); |
| 458 | 735 | ||
| 736 | #ifndef OPENSSL_NO_BIO | ||
| 737 | int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, | ||
| 738 | BIT_STRING_BITNAME *tbl, int indent); | ||
| 739 | #endif | ||
| 740 | int ASN1_BIT_STRING_num_asc(char *name, BIT_STRING_BITNAME *tbl); | ||
| 741 | int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value, | ||
| 742 | BIT_STRING_BITNAME *tbl); | ||
| 459 | 743 | ||
| 460 | int i2d_ASN1_BOOLEAN(int a,unsigned char **pp); | 744 | int i2d_ASN1_BOOLEAN(int a,unsigned char **pp); |
| 461 | int d2i_ASN1_BOOLEAN(int *a,unsigned char **pp,long length); | 745 | int d2i_ASN1_BOOLEAN(int *a,unsigned char **pp,long length); |
| 462 | 746 | ||
| 463 | int i2d_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp); | 747 | DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER) |
| 464 | ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a,unsigned char **pp, | 748 | int i2c_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp); |
| 749 | ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,unsigned char **pp, | ||
| 750 | long length); | ||
| 751 | ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,unsigned char **pp, | ||
| 465 | long length); | 752 | long length); |
| 753 | ASN1_INTEGER * ASN1_INTEGER_dup(ASN1_INTEGER *x); | ||
| 754 | int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y); | ||
| 755 | |||
| 756 | DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED) | ||
| 466 | 757 | ||
| 467 | int ASN1_UTCTIME_check(ASN1_UTCTIME *a); | 758 | int ASN1_UTCTIME_check(ASN1_UTCTIME *a); |
| 468 | ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t); | 759 | ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t); |
| 469 | int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, char *str); | 760 | int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, char *str); |
| 761 | int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t); | ||
| 762 | #if 0 | ||
| 763 | time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s); | ||
| 764 | #endif | ||
| 470 | 765 | ||
| 471 | int i2d_ASN1_OCTET_STRING(ASN1_OCTET_STRING *a,unsigned char **pp); | 766 | int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a); |
| 472 | ASN1_OCTET_STRING *d2i_ASN1_OCTET_STRING(ASN1_OCTET_STRING **a, | 767 | ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t); |
| 473 | unsigned char **pp,long length); | 768 | int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, char *str); |
| 474 | 769 | ||
| 475 | int i2d_ASN1_PRINTABLE(ASN1_STRING *a,unsigned char **pp); | 770 | DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING) |
| 476 | ASN1_STRING *d2i_ASN1_PRINTABLE(ASN1_STRING **a, | 771 | ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *a); |
| 477 | unsigned char **pp, long l); | 772 | int ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b); |
| 478 | ASN1_PRINTABLESTRING *d2i_ASN1_PRINTABLESTRING(ASN1_PRINTABLESTRING **a, | 773 | int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, unsigned char *data, int len); |
| 479 | unsigned char **pp, long l); | ||
| 480 | 774 | ||
| 481 | ASN1_T61STRING *d2i_ASN1_T61STRING(ASN1_T61STRING **a, | 775 | DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) |
| 482 | unsigned char **pp, long l); | 776 | DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING) |
| 483 | int i2d_ASN1_IA5STRING(ASN1_IA5STRING *a,unsigned char **pp); | 777 | DECLARE_ASN1_FUNCTIONS(ASN1_NULL) |
| 484 | ASN1_IA5STRING *d2i_ASN1_IA5STRING(ASN1_IA5STRING **a, | 778 | DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING) |
| 485 | unsigned char **pp, long l); | ||
| 486 | 779 | ||
| 487 | int i2d_ASN1_UTCTIME(ASN1_UTCTIME *a,unsigned char **pp); | 780 | int UTF8_getc(const unsigned char *str, int len, unsigned long *val); |
| 488 | ASN1_UTCTIME * d2i_ASN1_UTCTIME(ASN1_UTCTIME **a,unsigned char **pp, | 781 | int UTF8_putc(unsigned char *str, int len, unsigned long value); |
| 489 | long length); | 782 | |
| 783 | DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE) | ||
| 784 | |||
| 785 | DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING) | ||
| 786 | DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT) | ||
| 787 | DECLARE_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING) | ||
| 788 | DECLARE_ASN1_FUNCTIONS(ASN1_T61STRING) | ||
| 789 | DECLARE_ASN1_FUNCTIONS(ASN1_IA5STRING) | ||
| 790 | DECLARE_ASN1_FUNCTIONS(ASN1_GENERALSTRING) | ||
| 791 | DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME) | ||
| 792 | DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME) | ||
| 793 | DECLARE_ASN1_FUNCTIONS(ASN1_TIME) | ||
| 794 | |||
| 795 | ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t); | ||
| 796 | int ASN1_TIME_check(ASN1_TIME *t); | ||
| 797 | ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out); | ||
| 490 | 798 | ||
| 491 | int i2d_ASN1_SET(STACK *a, unsigned char **pp, | 799 | int i2d_ASN1_SET(STACK *a, unsigned char **pp, |
| 492 | int (*func)(), int ex_tag, int ex_class); | 800 | int (*func)(), int ex_tag, int ex_class, int is_set); |
| 493 | STACK * d2i_ASN1_SET(STACK **a, unsigned char **pp, long length, | 801 | STACK * d2i_ASN1_SET(STACK **a, unsigned char **pp, long length, |
| 494 | char *(*func)(), int ex_tag, int ex_class); | 802 | char *(*func)(), void (*free_func)(void *), |
| 803 | int ex_tag, int ex_class); | ||
| 495 | 804 | ||
| 496 | #ifdef HEADER_BIO_H | 805 | #ifndef OPENSSL_NO_BIO |
| 497 | int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a); | 806 | int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a); |
| 498 | int a2i_ASN1_INTEGER(BIO *bp,ASN1_INTEGER *bs,char *buf,int size); | 807 | int a2i_ASN1_INTEGER(BIO *bp,ASN1_INTEGER *bs,char *buf,int size); |
| 808 | int i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a); | ||
| 809 | int a2i_ASN1_ENUMERATED(BIO *bp,ASN1_ENUMERATED *bs,char *buf,int size); | ||
| 499 | int i2a_ASN1_OBJECT(BIO *bp,ASN1_OBJECT *a); | 810 | int i2a_ASN1_OBJECT(BIO *bp,ASN1_OBJECT *a); |
| 500 | int a2i_ASN1_STRING(BIO *bp,ASN1_STRING *bs,char *buf,int size); | 811 | int a2i_ASN1_STRING(BIO *bp,ASN1_STRING *bs,char *buf,int size); |
| 501 | int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type); | 812 | int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type); |
| 502 | #endif | 813 | #endif |
| 503 | int i2t_ASN1_OBJECT(char *buf,int buf_len,ASN1_OBJECT *a); | 814 | int i2t_ASN1_OBJECT(char *buf,int buf_len,ASN1_OBJECT *a); |
| 504 | 815 | ||
| 505 | int a2d_ASN1_OBJECT(unsigned char *out,int olen, char *buf, int num); | 816 | int a2d_ASN1_OBJECT(unsigned char *out,int olen, const char *buf, int num); |
| 506 | ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len, | 817 | ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len, |
| 507 | char *sn, char *ln); | 818 | const char *sn, const char *ln); |
| 508 | 819 | ||
| 509 | int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); | 820 | int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); |
| 510 | long ASN1_INTEGER_get(ASN1_INTEGER *a); | 821 | long ASN1_INTEGER_get(ASN1_INTEGER *a); |
| 511 | ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai); | 822 | ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai); |
| 512 | BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai,BIGNUM *bn); | 823 | BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai,BIGNUM *bn); |
| 513 | 824 | ||
| 825 | int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v); | ||
| 826 | long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a); | ||
| 827 | ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai); | ||
| 828 | BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai,BIGNUM *bn); | ||
| 829 | |||
| 514 | /* General */ | 830 | /* General */ |
| 515 | /* given a string, return the correct type, max is the maximum length */ | 831 | /* given a string, return the correct type, max is the maximum length */ |
| 516 | int ASN1_PRINTABLE_type(unsigned char *s, int max); | 832 | int ASN1_PRINTABLE_type(unsigned char *s, int max); |
| @@ -518,6 +834,7 @@ int ASN1_PRINTABLE_type(unsigned char *s, int max); | |||
| 518 | int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass); | 834 | int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass); |
| 519 | ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp, | 835 | ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp, |
| 520 | long length, int Ptag, int Pclass); | 836 | long length, int Ptag, int Pclass); |
| 837 | unsigned long ASN1_tag2bit(int tag); | ||
| 521 | /* type is one or more of the B_ASN1_ values. */ | 838 | /* type is one or more of the B_ASN1_ values. */ |
| 522 | ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a,unsigned char **pp, | 839 | ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a,unsigned char **pp, |
| 523 | long length,int type); | 840 | long length,int type); |
| @@ -536,18 +853,32 @@ int ASN1_object_size(int constructed, int length, int tag); | |||
| 536 | /* Used to implement other functions */ | 853 | /* Used to implement other functions */ |
| 537 | char *ASN1_dup(int (*i2d)(),char *(*d2i)(),char *x); | 854 | char *ASN1_dup(int (*i2d)(),char *(*d2i)(),char *x); |
| 538 | 855 | ||
| 539 | #ifndef NO_FP_API | 856 | void *ASN1_item_dup(const ASN1_ITEM *it, void *x); |
| 857 | |||
| 858 | #ifndef OPENSSL_NO_FP_API | ||
| 540 | char *ASN1_d2i_fp(char *(*xnew)(),char *(*d2i)(),FILE *fp,unsigned char **x); | 859 | char *ASN1_d2i_fp(char *(*xnew)(),char *(*d2i)(),FILE *fp,unsigned char **x); |
| 860 | void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x); | ||
| 541 | int ASN1_i2d_fp(int (*i2d)(),FILE *out,unsigned char *x); | 861 | int ASN1_i2d_fp(int (*i2d)(),FILE *out,unsigned char *x); |
| 862 | int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x); | ||
| 863 | int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags); | ||
| 542 | #endif | 864 | #endif |
| 543 | 865 | ||
| 544 | #ifdef HEADER_BIO_H | 866 | int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in); |
| 867 | |||
| 868 | #ifndef OPENSSL_NO_BIO | ||
| 545 | char *ASN1_d2i_bio(char *(*xnew)(),char *(*d2i)(),BIO *bp,unsigned char **x); | 869 | char *ASN1_d2i_bio(char *(*xnew)(),char *(*d2i)(),BIO *bp,unsigned char **x); |
| 870 | void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x); | ||
| 546 | int ASN1_i2d_bio(int (*i2d)(),BIO *out,unsigned char *x); | 871 | int ASN1_i2d_bio(int (*i2d)(),BIO *out,unsigned char *x); |
| 872 | int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x); | ||
| 547 | int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a); | 873 | int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a); |
| 874 | int ASN1_GENERALIZEDTIME_print(BIO *fp,ASN1_GENERALIZEDTIME *a); | ||
| 875 | int ASN1_TIME_print(BIO *fp,ASN1_TIME *a); | ||
| 548 | int ASN1_STRING_print(BIO *bp,ASN1_STRING *v); | 876 | int ASN1_STRING_print(BIO *bp,ASN1_STRING *v); |
| 877 | int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags); | ||
| 549 | int ASN1_parse(BIO *bp,unsigned char *pp,long len,int indent); | 878 | int ASN1_parse(BIO *bp,unsigned char *pp,long len,int indent); |
| 879 | int ASN1_parse_dump(BIO *bp,unsigned char *pp,long len,int indent,int dump); | ||
| 550 | #endif | 880 | #endif |
| 881 | const char *ASN1_tag2str(int tag); | ||
| 551 | 882 | ||
| 552 | /* Used to load and write netscape format cert/key */ | 883 | /* Used to load and write netscape format cert/key */ |
| 553 | int i2d_ASN1_HEADER(ASN1_HEADER *a,unsigned char **pp); | 884 | int i2d_ASN1_HEADER(ASN1_HEADER *a,unsigned char **pp); |
| @@ -557,8 +888,6 @@ void ASN1_HEADER_free(ASN1_HEADER *a); | |||
| 557 | 888 | ||
| 558 | int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s); | 889 | int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s); |
| 559 | 890 | ||
| 560 | void ERR_load_ASN1_strings(void); | ||
| 561 | |||
| 562 | /* Not used that much at this point, except for the first two */ | 891 | /* Not used that much at this point, except for the first two */ |
| 563 | ASN1_METHOD *X509_asn1_meth(void); | 892 | ASN1_METHOD *X509_asn1_meth(void); |
| 564 | ASN1_METHOD *RSAPrivateKey_asn1_meth(void); | 893 | ASN1_METHOD *RSAPrivateKey_asn1_meth(void); |
| @@ -574,286 +903,201 @@ int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, | |||
| 574 | int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num, | 903 | int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num, |
| 575 | unsigned char *data, int max_len); | 904 | unsigned char *data, int max_len); |
| 576 | 905 | ||
| 577 | #else | 906 | STACK *ASN1_seq_unpack(unsigned char *buf, int len, char *(*d2i)(), |
| 578 | 907 | void (*free_func)(void *) ); | |
| 579 | ASN1_TYPE * ASN1_TYPE_new(); | 908 | unsigned char *ASN1_seq_pack(STACK *safes, int (*i2d)(), unsigned char **buf, |
| 580 | void ASN1_TYPE_free(); | 909 | int *len ); |
| 581 | int i2d_ASN1_TYPE(); | 910 | void *ASN1_unpack_string(ASN1_STRING *oct, char *(*d2i)()); |
| 582 | ASN1_TYPE * d2i_ASN1_TYPE(); | 911 | void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it); |
| 583 | int ASN1_TYPE_get(); | 912 | ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_OCTET_STRING **oct); |
| 584 | void ASN1_TYPE_set(); | 913 | ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct); |
| 585 | 914 | ||
| 586 | ASN1_OBJECT * ASN1_OBJECT_new(); | 915 | void ASN1_STRING_set_default_mask(unsigned long mask); |
| 587 | void ASN1_OBJECT_free(); | 916 | int ASN1_STRING_set_default_mask_asc(char *p); |
| 588 | int i2d_ASN1_OBJECT(); | 917 | unsigned long ASN1_STRING_get_default_mask(void); |
| 589 | ASN1_OBJECT * d2i_ASN1_OBJECT(); | 918 | int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len, |
| 590 | ASN1_STRING * ASN1_STRING_new(); | 919 | int inform, unsigned long mask); |
| 591 | void ASN1_STRING_free(); | 920 | int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, |
| 592 | ASN1_STRING * ASN1_STRING_dup(); | 921 | int inform, unsigned long mask, |
| 593 | ASN1_STRING * ASN1_STRING_type_new(); | 922 | long minsize, long maxsize); |
| 594 | int ASN1_STRING_cmp(); | 923 | |
| 595 | int ASN1_STRING_set(); | 924 | ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, |
| 596 | int i2d_ASN1_BIT_STRING(); | 925 | const unsigned char *in, int inlen, int inform, int nid); |
| 597 | ASN1_BIT_STRING *d2i_ASN1_BIT_STRING(); | 926 | ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid); |
| 598 | int ASN1_BIT_STRING_set_bit(); | 927 | int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long); |
| 599 | int ASN1_BIT_STRING_get_bit(); | 928 | void ASN1_STRING_TABLE_cleanup(void); |
| 600 | int i2d_ASN1_BOOLEAN(); | 929 | |
| 601 | int d2i_ASN1_BOOLEAN(); | 930 | /* ASN1 template functions */ |
| 602 | int i2d_ASN1_INTEGER(); | 931 | |
| 603 | ASN1_INTEGER *d2i_ASN1_INTEGER(); | 932 | /* Old API compatible functions */ |
| 604 | int ASN1_UTCTIME_check(); | 933 | ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it); |
| 605 | ASN1_UTCTIME *ASN1_UTCTIME_set(); | 934 | void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it); |
| 606 | int ASN1_UTCTIME_set_string(); | 935 | ASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, unsigned char **in, long len, const ASN1_ITEM *it); |
| 607 | int i2d_ASN1_OCTET_STRING(); | 936 | int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); |
| 608 | ASN1_OCTET_STRING *d2i_ASN1_OCTET_STRING(); | 937 | |
| 609 | int i2d_ASN1_PRINTABLE(); | 938 | void ASN1_add_oid_module(void); |
| 610 | ASN1_STRING *d2i_ASN1_PRINTABLE(); | ||
| 611 | ASN1_PRINTABLESTRING *d2i_ASN1_PRINTABLESTRING(); | ||
| 612 | ASN1_T61STRING *d2i_ASN1_T61STRING(); | ||
| 613 | int i2d_ASN1_IA5STRING(); | ||
| 614 | ASN1_IA5STRING *d2i_ASN1_IA5STRING(); | ||
| 615 | int i2d_ASN1_UTCTIME(); | ||
| 616 | ASN1_UTCTIME * d2i_ASN1_UTCTIME(); | ||
| 617 | int i2d_ASN1_SET(); | ||
| 618 | STACK * d2i_ASN1_SET(); | ||
| 619 | int a2d_ASN1_OBJECT(); | ||
| 620 | ASN1_OBJECT *ASN1_OBJECT_create(); | ||
| 621 | int ASN1_INTEGER_set(); | ||
| 622 | long ASN1_INTEGER_get(); | ||
| 623 | ASN1_INTEGER *BN_to_ASN1_INTEGER(); | ||
| 624 | BIGNUM *ASN1_INTEGER_to_BN(); | ||
| 625 | int ASN1_PRINTABLE_type(); | ||
| 626 | int i2d_ASN1_bytes(); | ||
| 627 | ASN1_STRING *d2i_ASN1_bytes(); | ||
| 628 | ASN1_STRING *d2i_ASN1_type_bytes(); | ||
| 629 | int asn1_Finish(); | ||
| 630 | int ASN1_get_object(); | ||
| 631 | int ASN1_check_infinite_end(); | ||
| 632 | void ASN1_put_object(); | ||
| 633 | int ASN1_object_size(); | ||
| 634 | char *ASN1_dup(); | ||
| 635 | #ifndef NO_FP_API | ||
| 636 | char *ASN1_d2i_fp(); | ||
| 637 | int ASN1_i2d_fp(); | ||
| 638 | #endif | ||
| 639 | |||
| 640 | char *ASN1_d2i_bio(); | ||
| 641 | int ASN1_i2d_bio(); | ||
| 642 | int ASN1_UTCTIME_print(); | ||
| 643 | int ASN1_STRING_print(); | ||
| 644 | int ASN1_parse(); | ||
| 645 | int i2a_ASN1_INTEGER(); | ||
| 646 | int a2i_ASN1_INTEGER(); | ||
| 647 | int i2a_ASN1_OBJECT(); | ||
| 648 | int i2t_ASN1_OBJECT(); | ||
| 649 | int a2i_ASN1_STRING(); | ||
| 650 | int i2a_ASN1_STRING(); | ||
| 651 | |||
| 652 | int i2d_ASN1_HEADER(); | ||
| 653 | ASN1_HEADER *d2i_ASN1_HEADER(); | ||
| 654 | ASN1_HEADER *ASN1_HEADER_new(); | ||
| 655 | void ASN1_HEADER_free(); | ||
| 656 | void ERR_load_ASN1_strings(); | ||
| 657 | ASN1_METHOD *X509_asn1_meth(); | ||
| 658 | ASN1_METHOD *RSAPrivateKey_asn1_meth(); | ||
| 659 | ASN1_METHOD *ASN1_IA5STRING_asn1_meth(); | ||
| 660 | ASN1_METHOD *ASN1_BIT_STRING_asn1_meth(); | ||
| 661 | |||
| 662 | int ASN1_UNIVERSALSTRING_to_string(); | ||
| 663 | |||
| 664 | int ASN1_TYPE_set_octetstring(); | ||
| 665 | int ASN1_TYPE_get_octetstring(); | ||
| 666 | int ASN1_TYPE_set_int_octetstring(); | ||
| 667 | int ASN1_TYPE_get_int_octetstring(); | ||
| 668 | |||
| 669 | #endif | ||
| 670 | 939 | ||
| 671 | /* BEGIN ERROR CODES */ | 940 | /* BEGIN ERROR CODES */ |
| 941 | /* The following lines are auto generated by the script mkerr.pl. Any changes | ||
| 942 | * made after this point may be overwritten when the script is next run. | ||
| 943 | */ | ||
| 944 | void ERR_load_ASN1_strings(void); | ||
| 945 | |||
| 672 | /* Error codes for the ASN1 functions. */ | 946 | /* Error codes for the ASN1 functions. */ |
| 673 | 947 | ||
| 674 | /* Function codes. */ | 948 | /* Function codes. */ |
| 675 | #define ASN1_F_A2D_ASN1_OBJECT 100 | 949 | #define ASN1_F_A2D_ASN1_OBJECT 100 |
| 676 | #define ASN1_F_A2I_ASN1_INTEGER 101 | 950 | #define ASN1_F_A2I_ASN1_ENUMERATED 101 |
| 677 | #define ASN1_F_A2I_ASN1_STRING 102 | 951 | #define ASN1_F_A2I_ASN1_INTEGER 102 |
| 678 | #define ASN1_F_ASN1_COLLATE_PRIMATIVE 103 | 952 | #define ASN1_F_A2I_ASN1_STRING 103 |
| 679 | #define ASN1_F_ASN1_D2I_BIO 104 | 953 | #define ASN1_F_ASN1_CHECK_TLEN 104 |
| 680 | #define ASN1_F_ASN1_D2I_FP 105 | 954 | #define ASN1_F_ASN1_COLLATE_PRIMITIVE 105 |
| 681 | #define ASN1_F_ASN1_DUP 106 | 955 | #define ASN1_F_ASN1_COLLECT 106 |
| 682 | #define ASN1_F_ASN1_GET_OBJECT 107 | 956 | #define ASN1_F_ASN1_D2I_BIO 107 |
| 683 | #define ASN1_F_ASN1_HEADER_NEW 108 | 957 | #define ASN1_F_ASN1_D2I_EX_PRIMITIVE 108 |
| 684 | #define ASN1_F_ASN1_I2D_BIO 109 | 958 | #define ASN1_F_ASN1_D2I_FP 109 |
| 685 | #define ASN1_F_ASN1_I2D_FP 110 | 959 | #define ASN1_F_ASN1_DO_ADB 110 |
| 686 | #define ASN1_F_ASN1_INTEGER_SET 111 | 960 | #define ASN1_F_ASN1_DUP 111 |
| 687 | #define ASN1_F_ASN1_INTEGER_TO_BN 112 | 961 | #define ASN1_F_ASN1_ENUMERATED_SET 112 |
| 688 | #define ASN1_F_ASN1_OBJECT_NEW 113 | 962 | #define ASN1_F_ASN1_ENUMERATED_TO_BN 113 |
| 689 | #define ASN1_F_ASN1_SIGN 114 | 963 | #define ASN1_F_ASN1_GET_OBJECT 114 |
| 690 | #define ASN1_F_ASN1_STRING_NEW 115 | 964 | #define ASN1_F_ASN1_HEADER_NEW 115 |
| 691 | #define ASN1_F_ASN1_STRING_TYPE_NEW 116 | 965 | #define ASN1_F_ASN1_I2D_BIO 116 |
| 692 | #define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 117 | 966 | #define ASN1_F_ASN1_I2D_FP 117 |
| 693 | #define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 118 | 967 | #define ASN1_F_ASN1_INTEGER_SET 118 |
| 694 | #define ASN1_F_ASN1_TYPE_NEW 119 | 968 | #define ASN1_F_ASN1_INTEGER_TO_BN 119 |
| 695 | #define ASN1_F_ASN1_UTCTIME_NEW 120 | 969 | #define ASN1_F_ASN1_ITEM_EX_D2I 120 |
| 696 | #define ASN1_F_ASN1_VERIFY 121 | 970 | #define ASN1_F_ASN1_ITEM_NEW 121 |
| 697 | #define ASN1_F_BN_TO_ASN1_INTEGER 122 | 971 | #define ASN1_F_ASN1_MBSTRING_COPY 122 |
| 698 | #define ASN1_F_D2I_ASN1_BIT_STRING 123 | 972 | #define ASN1_F_ASN1_OBJECT_NEW 123 |
| 699 | #define ASN1_F_D2I_ASN1_BMPSTRING 124 | 973 | #define ASN1_F_ASN1_PACK_STRING 124 |
| 700 | #define ASN1_F_D2I_ASN1_BOOLEAN 125 | 974 | #define ASN1_F_ASN1_PBE_SET 125 |
| 701 | #define ASN1_F_D2I_ASN1_BYTES 126 | 975 | #define ASN1_F_ASN1_SEQ_PACK 126 |
| 702 | #define ASN1_F_D2I_ASN1_HEADER 127 | 976 | #define ASN1_F_ASN1_SEQ_UNPACK 127 |
| 703 | #define ASN1_F_D2I_ASN1_INTEGER 128 | 977 | #define ASN1_F_ASN1_SIGN 128 |
| 704 | #define ASN1_F_D2I_ASN1_OBJECT 129 | 978 | #define ASN1_F_ASN1_STRING_TABLE_ADD 129 |
| 705 | #define ASN1_F_D2I_ASN1_OCTET_STRING 130 | 979 | #define ASN1_F_ASN1_STRING_TYPE_NEW 130 |
| 706 | #define ASN1_F_D2I_ASN1_PRINT_TYPE 131 | 980 | #define ASN1_F_ASN1_TEMPLATE_D2I 131 |
| 707 | #define ASN1_F_D2I_ASN1_SET 132 | 981 | #define ASN1_F_ASN1_TEMPLATE_EX_D2I 132 |
| 708 | #define ASN1_F_D2I_ASN1_TYPE 133 | 982 | #define ASN1_F_ASN1_TEMPLATE_NEW 133 |
| 709 | #define ASN1_F_D2I_ASN1_TYPE_BYTES 134 | 983 | #define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 134 |
| 710 | #define ASN1_F_D2I_ASN1_UTCTIME 135 | 984 | #define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135 |
| 711 | #define ASN1_F_D2I_DHPARAMS 136 | 985 | #define ASN1_F_ASN1_UNPACK_STRING 136 |
| 712 | #define ASN1_F_D2I_DSAPARAMS 137 | 986 | #define ASN1_F_ASN1_VERIFY 137 |
| 713 | #define ASN1_F_D2I_DSAPRIVATEKEY 138 | 987 | #define ASN1_F_BN_TO_ASN1_ENUMERATED 138 |
| 714 | #define ASN1_F_D2I_DSAPUBLICKEY 139 | 988 | #define ASN1_F_BN_TO_ASN1_INTEGER 139 |
| 715 | #define ASN1_F_D2I_NETSCAPE_PKEY 140 | 989 | #define ASN1_F_COLLECT_DATA 140 |
| 716 | #define ASN1_F_D2I_NETSCAPE_RSA 141 | 990 | #define ASN1_F_D2I_ASN1_BIT_STRING 141 |
| 717 | #define ASN1_F_D2I_NETSCAPE_RSA_2 142 | 991 | #define ASN1_F_D2I_ASN1_BOOLEAN 142 |
| 718 | #define ASN1_F_D2I_NETSCAPE_SPKAC 143 | 992 | #define ASN1_F_D2I_ASN1_BYTES 143 |
| 719 | #define ASN1_F_D2I_NETSCAPE_SPKI 144 | 993 | #define ASN1_F_D2I_ASN1_GENERALIZEDTIME 144 |
| 720 | #define ASN1_F_D2I_PKCS7 145 | 994 | #define ASN1_F_D2I_ASN1_HEADER 145 |
| 721 | #define ASN1_F_D2I_PKCS7_DIGEST 146 | 995 | #define ASN1_F_D2I_ASN1_INTEGER 146 |
| 722 | #define ASN1_F_D2I_PKCS7_ENCRYPT 147 | 996 | #define ASN1_F_D2I_ASN1_OBJECT 147 |
| 723 | #define ASN1_F_D2I_PKCS7_ENC_CONTENT 148 | 997 | #define ASN1_F_D2I_ASN1_SET 148 |
| 724 | #define ASN1_F_D2I_PKCS7_ENVELOPE 149 | 998 | #define ASN1_F_D2I_ASN1_TYPE_BYTES 149 |
| 725 | #define ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL 150 | 999 | #define ASN1_F_D2I_ASN1_UINTEGER 150 |
| 726 | #define ASN1_F_D2I_PKCS7_RECIP_INFO 151 | 1000 | #define ASN1_F_D2I_ASN1_UTCTIME 151 |
| 727 | #define ASN1_F_D2I_PKCS7_SIGNED 152 | 1001 | #define ASN1_F_D2I_NETSCAPE_RSA 152 |
| 728 | #define ASN1_F_D2I_PKCS7_SIGNER_INFO 153 | 1002 | #define ASN1_F_D2I_NETSCAPE_RSA_2 153 |
| 729 | #define ASN1_F_D2I_PKCS7_SIGN_ENVELOPE 154 | 1003 | #define ASN1_F_D2I_PRIVATEKEY 154 |
| 730 | #define ASN1_F_D2I_PRIVATEKEY 155 | 1004 | #define ASN1_F_D2I_PUBLICKEY 155 |
| 731 | #define ASN1_F_D2I_PUBLICKEY 156 | 1005 | #define ASN1_F_D2I_X509 156 |
| 732 | #define ASN1_F_D2I_RSAPRIVATEKEY 157 | 1006 | #define ASN1_F_D2I_X509_CINF 157 |
| 733 | #define ASN1_F_D2I_RSAPUBLICKEY 158 | 1007 | #define ASN1_F_D2I_X509_NAME 158 |
| 734 | #define ASN1_F_D2I_X509 159 | 1008 | #define ASN1_F_D2I_X509_PKEY 159 |
| 735 | #define ASN1_F_D2I_X509_ALGOR 160 | 1009 | #define ASN1_F_I2D_ASN1_TIME 160 |
| 736 | #define ASN1_F_D2I_X509_ATTRIBUTE 161 | 1010 | #define ASN1_F_I2D_DSA_PUBKEY 161 |
| 737 | #define ASN1_F_D2I_X509_CINF 162 | 1011 | #define ASN1_F_I2D_NETSCAPE_RSA 162 |
| 738 | #define ASN1_F_D2I_X509_CRL 163 | 1012 | #define ASN1_F_I2D_PRIVATEKEY 163 |
| 739 | #define ASN1_F_D2I_X509_CRL_INFO 164 | 1013 | #define ASN1_F_I2D_PUBLICKEY 164 |
| 740 | #define ASN1_F_D2I_X509_EXTENSION 165 | 1014 | #define ASN1_F_I2D_RSA_PUBKEY 165 |
| 741 | #define ASN1_F_D2I_X509_KEY 166 | 1015 | #define ASN1_F_LONG_C2I 166 |
| 742 | #define ASN1_F_D2I_X509_NAME 167 | 1016 | #define ASN1_F_OID_MODULE_INIT 174 |
| 743 | #define ASN1_F_D2I_X509_NAME_ENTRY 168 | 1017 | #define ASN1_F_PKCS5_PBE2_SET 167 |
| 744 | #define ASN1_F_D2I_X509_PKEY 169 | 1018 | #define ASN1_F_X509_CINF_NEW 168 |
| 745 | #define ASN1_F_D2I_X509_PUBKEY 170 | 1019 | #define ASN1_F_X509_CRL_ADD0_REVOKED 169 |
| 746 | #define ASN1_F_D2I_X509_REQ 171 | 1020 | #define ASN1_F_X509_INFO_NEW 170 |
| 747 | #define ASN1_F_D2I_X509_REQ_INFO 172 | 1021 | #define ASN1_F_X509_NAME_NEW 171 |
| 748 | #define ASN1_F_D2I_X509_REVOKED 173 | 1022 | #define ASN1_F_X509_NEW 172 |
| 749 | #define ASN1_F_D2I_X509_SIG 174 | 1023 | #define ASN1_F_X509_PKEY_NEW 173 |
| 750 | #define ASN1_F_D2I_X509_VAL 175 | ||
| 751 | #define ASN1_F_I2D_ASN1_HEADER 176 | ||
| 752 | #define ASN1_F_I2D_DHPARAMS 177 | ||
| 753 | #define ASN1_F_I2D_DSAPARAMS 178 | ||
| 754 | #define ASN1_F_I2D_DSAPRIVATEKEY 179 | ||
| 755 | #define ASN1_F_I2D_DSAPUBLICKEY 180 | ||
| 756 | #define ASN1_F_I2D_NETSCAPE_RSA 181 | ||
| 757 | #define ASN1_F_I2D_PKCS7 182 | ||
| 758 | #define ASN1_F_I2D_PRIVATEKEY 183 | ||
| 759 | #define ASN1_F_I2D_PUBLICKEY 184 | ||
| 760 | #define ASN1_F_I2D_RSAPRIVATEKEY 185 | ||
| 761 | #define ASN1_F_I2D_RSAPUBLICKEY 186 | ||
| 762 | #define ASN1_F_I2D_X509_ATTRIBUTE 187 | ||
| 763 | #define ASN1_F_I2T_ASN1_OBJECT 188 | ||
| 764 | #define ASN1_F_NETSCAPE_PKEY_NEW 189 | ||
| 765 | #define ASN1_F_NETSCAPE_SPKAC_NEW 190 | ||
| 766 | #define ASN1_F_NETSCAPE_SPKI_NEW 191 | ||
| 767 | #define ASN1_F_PKCS7_DIGEST_NEW 192 | ||
| 768 | #define ASN1_F_PKCS7_ENCRYPT_NEW 193 | ||
| 769 | #define ASN1_F_PKCS7_ENC_CONTENT_NEW 194 | ||
| 770 | #define ASN1_F_PKCS7_ENVELOPE_NEW 195 | ||
| 771 | #define ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW 196 | ||
| 772 | #define ASN1_F_PKCS7_NEW 197 | ||
| 773 | #define ASN1_F_PKCS7_RECIP_INFO_NEW 198 | ||
| 774 | #define ASN1_F_PKCS7_SIGNED_NEW 199 | ||
| 775 | #define ASN1_F_PKCS7_SIGNER_INFO_NEW 200 | ||
| 776 | #define ASN1_F_PKCS7_SIGN_ENVELOPE_NEW 201 | ||
| 777 | #define ASN1_F_X509_ALGOR_NEW 202 | ||
| 778 | #define ASN1_F_X509_ATTRIBUTE_NEW 203 | ||
| 779 | #define ASN1_F_X509_CINF_NEW 204 | ||
| 780 | #define ASN1_F_X509_CRL_INFO_NEW 205 | ||
| 781 | #define ASN1_F_X509_CRL_NEW 206 | ||
| 782 | #define ASN1_F_X509_DHPARAMS_NEW 207 | ||
| 783 | #define ASN1_F_X509_EXTENSION_NEW 208 | ||
| 784 | #define ASN1_F_X509_INFO_NEW 209 | ||
| 785 | #define ASN1_F_X509_KEY_NEW 210 | ||
| 786 | #define ASN1_F_X509_NAME_ENTRY_NEW 211 | ||
| 787 | #define ASN1_F_X509_NAME_NEW 212 | ||
| 788 | #define ASN1_F_X509_NEW 213 | ||
| 789 | #define ASN1_F_X509_PKEY_NEW 214 | ||
| 790 | #define ASN1_F_X509_PUBKEY_NEW 215 | ||
| 791 | #define ASN1_F_X509_REQ_INFO_NEW 216 | ||
| 792 | #define ASN1_F_X509_REQ_NEW 217 | ||
| 793 | #define ASN1_F_X509_REVOKED_NEW 218 | ||
| 794 | #define ASN1_F_X509_SIG_NEW 219 | ||
| 795 | #define ASN1_F_X509_VAL_FREE 220 | ||
| 796 | #define ASN1_F_X509_VAL_NEW 221 | ||
| 797 | 1024 | ||
| 798 | /* Reason codes. */ | 1025 | /* Reason codes. */ |
| 799 | #define ASN1_R_BAD_CLASS 100 | 1026 | #define ASN1_R_ADDING_OBJECT 171 |
| 800 | #define ASN1_R_BAD_GET_OBJECT 101 | 1027 | #define ASN1_R_AUX_ERROR 100 |
| 1028 | #define ASN1_R_BAD_CLASS 101 | ||
| 801 | #define ASN1_R_BAD_OBJECT_HEADER 102 | 1029 | #define ASN1_R_BAD_OBJECT_HEADER 102 |
| 802 | #define ASN1_R_BAD_PASSWORD_READ 103 | 1030 | #define ASN1_R_BAD_PASSWORD_READ 103 |
| 803 | #define ASN1_R_BAD_PKCS7_CONTENT 104 | 1031 | #define ASN1_R_BAD_TAG 104 |
| 804 | #define ASN1_R_BAD_PKCS7_TYPE 105 | 1032 | #define ASN1_R_BN_LIB 105 |
| 805 | #define ASN1_R_BAD_TAG 106 | 1033 | #define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106 |
| 806 | #define ASN1_R_BAD_TYPE 107 | 1034 | #define ASN1_R_BUFFER_TOO_SMALL 107 |
| 807 | #define ASN1_R_BN_LIB 108 | 1035 | #define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 108 |
| 808 | #define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 109 | 1036 | #define ASN1_R_DATA_IS_WRONG 109 |
| 809 | #define ASN1_R_BUFFER_TOO_SMALL 110 | 1037 | #define ASN1_R_DECODE_ERROR 110 |
| 810 | #define ASN1_R_DATA_IS_WRONG 111 | 1038 | #define ASN1_R_DECODING_ERROR 111 |
| 811 | #define ASN1_R_DECODING_ERROR 112 | 1039 | #define ASN1_R_ENCODE_ERROR 112 |
| 812 | #define ASN1_R_ERROR_STACK 113 | 1040 | #define ASN1_R_ERROR_LOADING_SECTION 172 |
| 813 | #define ASN1_R_EXPECTING_AN_INTEGER 114 | 1041 | #define ASN1_R_ERROR_PARSING_SET_ELEMENT 113 |
| 814 | #define ASN1_R_EXPECTING_AN_OBJECT 115 | 1042 | #define ASN1_R_ERROR_SETTING_CIPHER_PARAMS 114 |
| 815 | #define ASN1_R_EXPECTING_AN_OCTET_STRING 116 | 1043 | #define ASN1_R_EXPECTING_AN_INTEGER 115 |
| 816 | #define ASN1_R_EXPECTING_A_BIT_STRING 117 | 1044 | #define ASN1_R_EXPECTING_AN_OBJECT 116 |
| 817 | #define ASN1_R_EXPECTING_A_BOOLEAN 118 | 1045 | #define ASN1_R_EXPECTING_A_BOOLEAN 117 |
| 818 | #define ASN1_R_EXPECTING_A_SEQUENCE 119 | 1046 | #define ASN1_R_EXPECTING_A_TIME 118 |
| 819 | #define ASN1_R_EXPECTING_A_UTCTIME 120 | 1047 | #define ASN1_R_EXPLICIT_LENGTH_MISMATCH 119 |
| 820 | #define ASN1_R_FIRST_NUM_TOO_LARGE 121 | 1048 | #define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED 120 |
| 821 | #define ASN1_R_HEADER_TOO_LONG 122 | 1049 | #define ASN1_R_FIELD_MISSING 121 |
| 822 | #define ASN1_R_INVALID_DIGIT 123 | 1050 | #define ASN1_R_FIRST_NUM_TOO_LARGE 122 |
| 823 | #define ASN1_R_INVALID_SEPARATOR 124 | 1051 | #define ASN1_R_HEADER_TOO_LONG 123 |
| 824 | #define ASN1_R_INVALID_TIME_FORMAT 125 | 1052 | #define ASN1_R_ILLEGAL_CHARACTERS 124 |
| 825 | #define ASN1_R_IV_TOO_LARGE 126 | 1053 | #define ASN1_R_ILLEGAL_NULL 125 |
| 826 | #define ASN1_R_LENGTH_ERROR 127 | 1054 | #define ASN1_R_ILLEGAL_OPTIONAL_ANY 126 |
| 827 | #define ASN1_R_LENGTH_MISMATCH 128 | 1055 | #define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE 170 |
| 828 | #define ASN1_R_MISSING_EOS 129 | 1056 | #define ASN1_R_ILLEGAL_TAGGED_ANY 127 |
| 829 | #define ASN1_R_MISSING_SECOND_NUMBER 130 | 1057 | #define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128 |
| 830 | #define ASN1_R_NON_HEX_CHARACTERS 131 | 1058 | #define ASN1_R_INVALID_BMPSTRING_LENGTH 129 |
| 831 | #define ASN1_R_NOT_ENOUGH_DATA 132 | 1059 | #define ASN1_R_INVALID_DIGIT 130 |
| 832 | #define ASN1_R_ODD_NUMBER_OF_CHARS 133 | 1060 | #define ASN1_R_INVALID_SEPARATOR 131 |
| 833 | #define ASN1_R_PARSING 134 | 1061 | #define ASN1_R_INVALID_TIME_FORMAT 132 |
| 834 | #define ASN1_R_PRIVATE_KEY_HEADER_MISSING 135 | 1062 | #define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133 |
| 835 | #define ASN1_R_SECOND_NUMBER_TOO_LARGE 136 | 1063 | #define ASN1_R_INVALID_UTF8STRING 134 |
| 836 | #define ASN1_R_SHORT_LINE 137 | 1064 | #define ASN1_R_IV_TOO_LARGE 135 |
| 837 | #define ASN1_R_STRING_TOO_SHORT 138 | 1065 | #define ASN1_R_LENGTH_ERROR 136 |
| 838 | #define ASN1_R_TAG_VALUE_TOO_HIGH 139 | 1066 | #define ASN1_R_MISSING_EOC 137 |
| 839 | #define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 140 | 1067 | #define ASN1_R_MISSING_SECOND_NUMBER 138 |
| 840 | #define ASN1_R_TOO_LONG 141 | 1068 | #define ASN1_R_MSTRING_NOT_UNIVERSAL 139 |
| 841 | #define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 142 | 1069 | #define ASN1_R_MSTRING_WRONG_TAG 140 |
| 842 | #define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 143 | 1070 | #define ASN1_R_NON_HEX_CHARACTERS 141 |
| 843 | #define ASN1_R_UNKNOWN_ATTRIBUTE_TYPE 144 | 1071 | #define ASN1_R_NOT_ENOUGH_DATA 142 |
| 844 | #define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 145 | 1072 | #define ASN1_R_NO_MATCHING_CHOICE_TYPE 143 |
| 845 | #define ASN1_R_UNKNOWN_OBJECT_TYPE 146 | 1073 | #define ASN1_R_NULL_IS_WRONG_LENGTH 144 |
| 846 | #define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 147 | 1074 | #define ASN1_R_ODD_NUMBER_OF_CHARS 145 |
| 847 | #define ASN1_R_UNSUPPORTED_CIPHER 148 | 1075 | #define ASN1_R_PRIVATE_KEY_HEADER_MISSING 146 |
| 848 | #define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 149 | 1076 | #define ASN1_R_SECOND_NUMBER_TOO_LARGE 147 |
| 849 | #define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 150 | 1077 | #define ASN1_R_SEQUENCE_LENGTH_MISMATCH 148 |
| 850 | #define ASN1_R_UTCTIME_TOO_LONG 151 | 1078 | #define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149 |
| 851 | #define ASN1_R_WRONG_PRINTABLE_TYPE 152 | 1079 | #define ASN1_R_SHORT_LINE 150 |
| 852 | #define ASN1_R_WRONG_TAG 153 | 1080 | #define ASN1_R_STRING_TOO_LONG 151 |
| 853 | #define ASN1_R_WRONG_TYPE 154 | 1081 | #define ASN1_R_STRING_TOO_SHORT 152 |
| 854 | 1082 | #define ASN1_R_TAG_VALUE_TOO_HIGH 153 | |
| 1083 | #define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154 | ||
| 1084 | #define ASN1_R_TOO_LONG 155 | ||
| 1085 | #define ASN1_R_TYPE_NOT_CONSTRUCTED 156 | ||
| 1086 | #define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 157 | ||
| 1087 | #define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 158 | ||
| 1088 | #define ASN1_R_UNEXPECTED_EOC 159 | ||
| 1089 | #define ASN1_R_UNKNOWN_FORMAT 160 | ||
| 1090 | #define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161 | ||
| 1091 | #define ASN1_R_UNKNOWN_OBJECT_TYPE 162 | ||
| 1092 | #define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163 | ||
| 1093 | #define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164 | ||
| 1094 | #define ASN1_R_UNSUPPORTED_CIPHER 165 | ||
| 1095 | #define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 166 | ||
| 1096 | #define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167 | ||
| 1097 | #define ASN1_R_WRONG_TAG 168 | ||
| 1098 | #define ASN1_R_WRONG_TYPE 169 | ||
| 1099 | |||
| 855 | #ifdef __cplusplus | 1100 | #ifdef __cplusplus |
| 856 | } | 1101 | } |
| 857 | #endif | 1102 | #endif |
| 858 | #endif | 1103 | #endif |
| 859 | |||
