epoc32/include/stdapis/openssl/asn1.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 0 061f57f2323e
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
/* crypto/asn1/asn1.h */
williamr@2
     2
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
williamr@2
     3
 * All rights reserved.
williamr@2
     4
 *
williamr@2
     5
 * This package is an SSL implementation written
williamr@2
     6
 * by Eric Young (eay@cryptsoft.com).
williamr@2
     7
 * The implementation was written so as to conform with Netscapes SSL.
williamr@2
     8
 * 
williamr@2
     9
 * This library is free for commercial and non-commercial use as long as
williamr@2
    10
 * the following conditions are aheared to.  The following conditions
williamr@2
    11
 * apply to all code found in this distribution, be it the RC4, RSA,
williamr@2
    12
 * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
williamr@2
    13
 * included with this distribution is covered by the same copyright terms
williamr@2
    14
 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
williamr@2
    15
 * 
williamr@2
    16
 * Copyright remains Eric Young's, and as such any Copyright notices in
williamr@2
    17
 * the code are not to be removed.
williamr@2
    18
 * If this package is used in a product, Eric Young should be given attribution
williamr@2
    19
 * as the author of the parts of the library used.
williamr@2
    20
 * This can be in the form of a textual message at program startup or
williamr@2
    21
 * in documentation (online or textual) provided with the package.
williamr@2
    22
 * 
williamr@2
    23
 * Redistribution and use in source and binary forms, with or without
williamr@2
    24
 * modification, are permitted provided that the following conditions
williamr@2
    25
 * are met:
williamr@2
    26
 * 1. Redistributions of source code must retain the copyright
williamr@2
    27
 *    notice, this list of conditions and the following disclaimer.
williamr@2
    28
 * 2. Redistributions in binary form must reproduce the above copyright
williamr@2
    29
 *    notice, this list of conditions and the following disclaimer in the
williamr@2
    30
 *    documentation and/or other materials provided with the distribution.
williamr@2
    31
 * 3. All advertising materials mentioning features or use of this software
williamr@2
    32
 *    must display the following acknowledgement:
williamr@2
    33
 *    "This product includes cryptographic software written by
williamr@2
    34
 *     Eric Young (eay@cryptsoft.com)"
williamr@2
    35
 *    The word 'cryptographic' can be left out if the rouines from the library
williamr@2
    36
 *    being used are not cryptographic related :-).
williamr@2
    37
 * 4. If you include any Windows specific code (or a derivative thereof) from 
williamr@2
    38
 *    the apps directory (application code) you must include an acknowledgement:
williamr@2
    39
 *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
williamr@2
    40
 * 
williamr@2
    41
 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
williamr@2
    42
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
williamr@2
    43
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
williamr@2
    44
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
williamr@2
    45
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
williamr@2
    46
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
williamr@2
    47
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
williamr@2
    48
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
williamr@2
    49
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
williamr@2
    50
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
williamr@2
    51
 * SUCH DAMAGE.
williamr@2
    52
 * 
williamr@2
    53
 * The licence and distribution terms for any publically available version or
williamr@2
    54
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
williamr@2
    55
 * copied and put under another distribution licence
williamr@2
    56
 * [including the GNU Public Licence.]
williamr@2
    57
 */
williamr@2
    58
 /*
williamr@2
    59
 © Portions copyright (c) 2006 Nokia Corporation.  All rights reserved.
williamr@2
    60
 */
williamr@2
    61
williamr@2
    62
williamr@2
    63
#ifndef HEADER_ASN1_H
williamr@2
    64
#define HEADER_ASN1_H
williamr@2
    65
williamr@2
    66
#if (defined(__SYMBIAN32__) && !defined(SYMBIAN))
williamr@2
    67
#define SYMBIAN
williamr@2
    68
#endif
williamr@2
    69
williamr@2
    70
#ifdef SYMBIAN
williamr@2
    71
#include <e32def.h>
williamr@2
    72
#endif
williamr@2
    73
#include <time.h>
williamr@2
    74
#include <openssl/e_os2.h>
williamr@2
    75
#ifndef OPENSSL_NO_BIO
williamr@2
    76
#include <openssl/bio.h>
williamr@2
    77
#endif
williamr@2
    78
#include <openssl/stack.h>
williamr@2
    79
#include <openssl/safestack.h>
williamr@2
    80
williamr@2
    81
#include <openssl/symhacks.h>
williamr@2
    82
williamr@2
    83
#include <openssl/ossl_typ.h>
williamr@2
    84
#ifndef OPENSSL_NO_DEPRECATED
williamr@2
    85
#include <openssl/bn.h>
williamr@2
    86
#endif
williamr@2
    87
williamr@2
    88
#ifdef OPENSSL_BUILD_SHLIBCRYPTO
williamr@2
    89
# undef OPENSSL_EXTERN
williamr@2
    90
# define OPENSSL_EXTERN OPENSSL_EXPORT
williamr@2
    91
#endif
williamr@2
    92
williamr@2
    93
#ifdef  __cplusplus
williamr@2
    94
extern "C" {
williamr@2
    95
#endif
williamr@2
    96
williamr@2
    97
#define V_ASN1_UNIVERSAL		0x00
williamr@2
    98
#define	V_ASN1_APPLICATION		0x40
williamr@2
    99
#define V_ASN1_CONTEXT_SPECIFIC		0x80
williamr@2
   100
#define V_ASN1_PRIVATE			0xc0
williamr@2
   101
williamr@2
   102
#define V_ASN1_CONSTRUCTED		0x20
williamr@2
   103
#define V_ASN1_PRIMITIVE_TAG		0x1f
williamr@2
   104
#define V_ASN1_PRIMATIVE_TAG		0x1f
williamr@2
   105
williamr@2
   106
#define V_ASN1_APP_CHOOSE		-2	/* let the recipient choose */
williamr@2
   107
#define V_ASN1_OTHER			-3	/* used in ASN1_TYPE */
williamr@2
   108
#define V_ASN1_ANY			-4	/* used in ASN1 template code */
williamr@2
   109
williamr@2
   110
#define V_ASN1_NEG			0x100	/* negative flag */
williamr@2
   111
williamr@2
   112
#define V_ASN1_UNDEF			-1
williamr@2
   113
#define V_ASN1_EOC			0
williamr@2
   114
#define V_ASN1_BOOLEAN			1	/**/
williamr@2
   115
#define V_ASN1_INTEGER			2
williamr@2
   116
#define V_ASN1_NEG_INTEGER		(2 | V_ASN1_NEG)
williamr@2
   117
#define V_ASN1_BIT_STRING		3
williamr@2
   118
#define V_ASN1_OCTET_STRING		4
williamr@2
   119
#define V_ASN1_NULL			5
williamr@2
   120
#define V_ASN1_OBJECT			6
williamr@2
   121
#define V_ASN1_OBJECT_DESCRIPTOR	7
williamr@2
   122
#define V_ASN1_EXTERNAL			8
williamr@2
   123
#define V_ASN1_REAL			9
williamr@2
   124
#define V_ASN1_ENUMERATED		10
williamr@2
   125
#define V_ASN1_NEG_ENUMERATED		(10 | V_ASN1_NEG)
williamr@2
   126
#define V_ASN1_UTF8STRING		12
williamr@2
   127
#define V_ASN1_SEQUENCE			16
williamr@2
   128
#define V_ASN1_SET			17
williamr@2
   129
#define V_ASN1_NUMERICSTRING		18	/**/
williamr@2
   130
#define V_ASN1_PRINTABLESTRING		19
williamr@2
   131
#define V_ASN1_T61STRING		20
williamr@2
   132
#define V_ASN1_TELETEXSTRING		20	/* alias */
williamr@2
   133
#define V_ASN1_VIDEOTEXSTRING		21	/**/
williamr@2
   134
#define V_ASN1_IA5STRING		22
williamr@2
   135
#define V_ASN1_UTCTIME			23
williamr@2
   136
#define V_ASN1_GENERALIZEDTIME		24	/**/
williamr@2
   137
#define V_ASN1_GRAPHICSTRING		25	/**/
williamr@2
   138
#define V_ASN1_ISO64STRING		26	/**/
williamr@2
   139
#define V_ASN1_VISIBLESTRING		26	/* alias */
williamr@2
   140
#define V_ASN1_GENERALSTRING		27	/**/
williamr@2
   141
#define V_ASN1_UNIVERSALSTRING		28	/**/
williamr@2
   142
#define V_ASN1_BMPSTRING		30
williamr@2
   143
williamr@2
   144
/* For use with d2i_ASN1_type_bytes() */
williamr@2
   145
#define B_ASN1_NUMERICSTRING	0x0001
williamr@2
   146
#define B_ASN1_PRINTABLESTRING	0x0002
williamr@2
   147
#define B_ASN1_T61STRING	0x0004
williamr@2
   148
#define B_ASN1_TELETEXSTRING	0x0004
williamr@2
   149
#define B_ASN1_VIDEOTEXSTRING	0x0008
williamr@2
   150
#define B_ASN1_IA5STRING	0x0010
williamr@2
   151
#define B_ASN1_GRAPHICSTRING	0x0020
williamr@2
   152
#define B_ASN1_ISO64STRING	0x0040
williamr@2
   153
#define B_ASN1_VISIBLESTRING	0x0040
williamr@2
   154
#define B_ASN1_GENERALSTRING	0x0080
williamr@2
   155
#define B_ASN1_UNIVERSALSTRING	0x0100
williamr@2
   156
#define B_ASN1_OCTET_STRING	0x0200
williamr@2
   157
#define B_ASN1_BIT_STRING	0x0400
williamr@2
   158
#define B_ASN1_BMPSTRING	0x0800
williamr@2
   159
#define B_ASN1_UNKNOWN		0x1000
williamr@2
   160
#define B_ASN1_UTF8STRING	0x2000
williamr@2
   161
#define B_ASN1_UTCTIME		0x4000
williamr@2
   162
#define B_ASN1_GENERALIZEDTIME	0x8000
williamr@2
   163
#define B_ASN1_SEQUENCE		0x10000
williamr@2
   164
williamr@2
   165
/* For use with ASN1_mbstring_copy() */
williamr@2
   166
#define MBSTRING_FLAG		0x1000
williamr@2
   167
#define MBSTRING_UTF8		(MBSTRING_FLAG)
williamr@2
   168
#define MBSTRING_ASC		(MBSTRING_FLAG|1)
williamr@2
   169
#define MBSTRING_BMP		(MBSTRING_FLAG|2)
williamr@2
   170
#define MBSTRING_UNIV		(MBSTRING_FLAG|4)
williamr@2
   171
williamr@2
   172
struct X509_algor_st;
williamr@2
   173
williamr@2
   174
#define DECLARE_ASN1_SET_OF(type) /* filled in by mkstack.pl */
williamr@2
   175
#define IMPLEMENT_ASN1_SET_OF(type) /* nothing, no longer needed */
williamr@2
   176
williamr@2
   177
/* We MUST make sure that, except for constness, asn1_ctx_st and
williamr@2
   178
   asn1_const_ctx are exactly the same.  Fortunately, as soon as
williamr@2
   179
   the old ASN1 parsing macros are gone, we can throw this away
williamr@2
   180
   as well... */
williamr@2
   181
typedef struct asn1_ctx_st
williamr@2
   182
	{
williamr@2
   183
	unsigned char *p;/* work char pointer */
williamr@2
   184
	int eos;	/* end of sequence read for indefinite encoding */
williamr@2
   185
	int error;	/* error code to use when returning an error */
williamr@2
   186
	int inf;	/* constructed if 0x20, indefinite is 0x21 */
williamr@2
   187
	int tag;	/* tag from last 'get object' */
williamr@2
   188
	int xclass;	/* class from last 'get object' */
williamr@2
   189
	long slen;	/* length of last 'get object' */
williamr@2
   190
	unsigned char *max; /* largest value of p allowed */
williamr@2
   191
	unsigned char *q;/* temporary variable */
williamr@2
   192
	unsigned char **pp;/* variable */
williamr@2
   193
	int line;	/* used in error processing */
williamr@2
   194
	} ASN1_CTX;
williamr@2
   195
williamr@2
   196
typedef struct asn1_const_ctx_st
williamr@2
   197
	{
williamr@2
   198
	const unsigned char *p;/* work char pointer */
williamr@2
   199
	int eos;	/* end of sequence read for indefinite encoding */
williamr@2
   200
	int error;	/* error code to use when returning an error */
williamr@2
   201
	int inf;	/* constructed if 0x20, indefinite is 0x21 */
williamr@2
   202
	int tag;	/* tag from last 'get object' */
williamr@2
   203
	int xclass;	/* class from last 'get object' */
williamr@2
   204
	long slen;	/* length of last 'get object' */
williamr@2
   205
	const unsigned char *max; /* largest value of p allowed */
williamr@2
   206
	const unsigned char *q;/* temporary variable */
williamr@2
   207
	const unsigned char **pp;/* variable */
williamr@2
   208
	int line;	/* used in error processing */
williamr@2
   209
	} ASN1_const_CTX;
williamr@2
   210
williamr@2
   211
/* These are used internally in the ASN1_OBJECT to keep track of
williamr@2
   212
 * whether the names and data need to be free()ed */
williamr@2
   213
#define ASN1_OBJECT_FLAG_DYNAMIC	 0x01	/* internal use */
williamr@2
   214
#define ASN1_OBJECT_FLAG_CRITICAL	 0x02	/* critical x509v3 object id */
williamr@2
   215
#define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04	/* internal use */
williamr@2
   216
#define ASN1_OBJECT_FLAG_DYNAMIC_DATA 	 0x08	/* internal use */
williamr@2
   217
typedef struct asn1_object_st
williamr@2
   218
	{
williamr@2
   219
	const char *sn,*ln;
williamr@2
   220
	int nid;
williamr@2
   221
	int length;
williamr@2
   222
	unsigned char *data;
williamr@2
   223
	int flags;	/* Should we free this one */
williamr@2
   224
	} ASN1_OBJECT;
williamr@2
   225
williamr@2
   226
#define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */
williamr@2
   227
/* This indicates that the ASN1_STRING is not a real value but just a place
williamr@2
   228
 * holder for the location where indefinite length constructed data should
williamr@2
   229
 * be inserted in the memory buffer 
williamr@2
   230
 */
williamr@2
   231
#define ASN1_STRING_FLAG_NDEF 0x010 
williamr@2
   232
/* This is the base type that holds just about everything :-) */
williamr@2
   233
typedef struct asn1_string_st
williamr@2
   234
	{
williamr@2
   235
	int length;
williamr@2
   236
	int type;
williamr@2
   237
	unsigned char *data;
williamr@2
   238
	/* The value of the following field depends on the type being
williamr@2
   239
	 * held.  It is mostly being used for BIT_STRING so if the
williamr@2
   240
	 * input data has a non-zero 'unused bits' value, it will be
williamr@2
   241
	 * handled correctly */
williamr@2
   242
	long flags;
williamr@2
   243
	} ASN1_STRING;
williamr@2
   244
williamr@2
   245
/* ASN1_ENCODING structure: this is used to save the received
williamr@2
   246
 * encoding of an ASN1 type. This is useful to get round
williamr@2
   247
 * problems with invalid encodings which can break signatures.
williamr@2
   248
 */
williamr@2
   249
williamr@2
   250
typedef struct ASN1_ENCODING_st
williamr@2
   251
	{
williamr@2
   252
	unsigned char *enc;	/* DER encoding */
williamr@2
   253
	long len;		/* Length of encoding */
williamr@2
   254
	int modified;		 /* set to 1 if 'enc' is invalid */
williamr@2
   255
	} ASN1_ENCODING;
williamr@2
   256
williamr@2
   257
/* Used with ASN1 LONG type: if a long is set to this it is omitted */
williamr@2
   258
#define ASN1_LONG_UNDEF	0x7fffffffL
williamr@2
   259
williamr@2
   260
#define STABLE_FLAGS_MALLOC	0x01
williamr@2
   261
#define STABLE_NO_MASK		0x02
williamr@2
   262
#define DIRSTRING_TYPE	\
williamr@2
   263
 (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING)
williamr@2
   264
#define PKCS9STRING_TYPE (DIRSTRING_TYPE|B_ASN1_IA5STRING)
williamr@2
   265
williamr@2
   266
typedef struct asn1_string_table_st {
williamr@2
   267
	int nid;
williamr@2
   268
	long minsize;
williamr@2
   269
	long maxsize;
williamr@2
   270
	unsigned long mask;
williamr@2
   271
	unsigned long flags;
williamr@2
   272
} ASN1_STRING_TABLE;
williamr@2
   273
williamr@2
   274
DECLARE_STACK_OF(ASN1_STRING_TABLE)
williamr@2
   275
williamr@2
   276
/* size limits: this stuff is taken straight from RFC2459 */
williamr@2
   277
williamr@2
   278
#define ub_name				32768
williamr@2
   279
#define ub_common_name			64
williamr@2
   280
#define ub_locality_name		128
williamr@2
   281
#define ub_state_name			128
williamr@2
   282
#define ub_organization_name		64
williamr@2
   283
#define ub_organization_unit_name	64
williamr@2
   284
#define ub_title			64
williamr@2
   285
#define ub_email_address		128
williamr@2
   286
williamr@2
   287
/* Declarations for template structures: for full definitions
williamr@2
   288
 * see asn1t.h
williamr@2
   289
 */
williamr@2
   290
typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE;
williamr@2
   291
typedef struct ASN1_ITEM_st ASN1_ITEM;
williamr@2
   292
typedef struct ASN1_TLC_st ASN1_TLC;
williamr@2
   293
/* This is just an opaque pointer */
williamr@2
   294
typedef struct ASN1_VALUE_st ASN1_VALUE;
williamr@2
   295
williamr@2
   296
/* Declare ASN1 functions: the implement macro in in asn1t.h */
williamr@2
   297
williamr@2
   298
#define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type)
williamr@2
   299
williamr@2
   300
#define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \
williamr@2
   301
	DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type)
williamr@2
   302
williamr@2
   303
#define DECLARE_ASN1_FUNCTIONS_name(type, name) \
williamr@2
   304
	DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
williamr@2
   305
	DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name)
williamr@2
   306
williamr@2
   307
#define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \
williamr@2
   308
	DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
williamr@2
   309
	DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name)
williamr@2
   310
williamr@2
   311
#define	DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \
williamr@2
   312
  IMPORT_C type *d2i_##name(type **a, const unsigned char **in, long len); \
williamr@2
   313
  IMPORT_C int i2d_##name(type *a, unsigned char **out); \
williamr@2
   314
	DECLARE_ASN1_ITEM(itname)
williamr@2
   315
williamr@2
   316
#define	DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \
williamr@2
   317
	IMPORT_C type *d2i_##name(type **a, const unsigned char **in, long len); \
williamr@2
   318
	IMPORT_C int i2d_##name(const type *a, unsigned char **out); \
williamr@2
   319
	DECLARE_ASN1_ITEM(name)
williamr@2
   320
williamr@2
   321
#define	DECLARE_ASN1_NDEF_FUNCTION(name) \
williamr@2
   322
	 IMPORT_C int i2d_##name##_NDEF(name *a, unsigned char **out);
williamr@2
   323
williamr@2
   324
#define DECLARE_ASN1_FUNCTIONS_const(name) \
williamr@2
   325
	 IMPORT_C name *name##_new(void); \
williamr@2
   326
   IMPORT_C void name##_free(name *a);
williamr@2
   327
williamr@2
   328
#define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
williamr@2
   329
	IMPORT_C type *name##_new(void); \
williamr@2
   330
	IMPORT_C void name##_free(type *a);
williamr@2
   331
williamr@2
   332
#define D2I_OF(type) type *(*)(type **,const unsigned char **,long)
williamr@2
   333
#define I2D_OF(type) int (*)(type *,unsigned char **)
williamr@2
   334
#define I2D_OF_const(type) int (*)(const type *,unsigned char **)
williamr@2
   335
#define CHECKED_D2I_OF(type, d2i) \
williamr@2
   336
    ((d2i_of_void*) (1 ? d2i : ((D2I_OF(type))0)))
williamr@2
   337
#define CHECKED_I2D_OF(type, i2d) \
williamr@2
   338
    ((i2d_of_void*) (1 ? i2d : ((I2D_OF(type))0)))
williamr@2
   339
#define CHECKED_NEW_OF(type, xnew) \
williamr@2
   340
    ((void *(*)(void)) (1 ? xnew : ((type *(*)(void))0)))
williamr@2
   341
#define CHECKED_PTR_OF(type, p) \
williamr@2
   342
    ((void*) (1 ? p : (type*)0))
williamr@2
   343
#define CHECKED_PPTR_OF(type, p) \
williamr@2
   344
    ((void**) (1 ? p : (type**)0))
williamr@2
   345
williamr@2
   346
#define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long)
williamr@2
   347
#define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **)
williamr@2
   348
#define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type)
williamr@2
   349
williamr@2
   350
TYPEDEF_D2I2D_OF(void);
williamr@2
   351
williamr@2
   352
/* The following macros and typedefs allow an ASN1_ITEM
williamr@2
   353
 * to be embedded in a structure and referenced. Since
williamr@2
   354
 * the ASN1_ITEM pointers need to be globally accessible
williamr@2
   355
 * (possibly from shared libraries) they may exist in
williamr@2
   356
 * different forms. On platforms that support it the
williamr@2
   357
 * ASN1_ITEM structure itself will be globally exported.
williamr@2
   358
 * Other platforms will export a function that returns
williamr@2
   359
 * an ASN1_ITEM pointer.
williamr@2
   360
 *
williamr@2
   361
 * To handle both cases transparently the macros below
williamr@2
   362
 * should be used instead of hard coding an ASN1_ITEM
williamr@2
   363
 * pointer in a structure.
williamr@2
   364
 *
williamr@2
   365
 * The structure will look like this:
williamr@2
   366
 *
williamr@2
   367
 * typedef struct SOMETHING_st {
williamr@2
   368
 *      ...
williamr@2
   369
 *      ASN1_ITEM_EXP *iptr;
williamr@2
   370
 *      ...
williamr@2
   371
 * } SOMETHING; 
williamr@2
   372
 *
williamr@2
   373
 * It would be initialised as e.g.:
williamr@2
   374
 *
williamr@2
   375
 * SOMETHING somevar = {...,ASN1_ITEM_ref(X509),...};
williamr@2
   376
 *
williamr@2
   377
 * and the actual pointer extracted with:
williamr@2
   378
 *
williamr@2
   379
 * const ASN1_ITEM *it = ASN1_ITEM_ptr(somevar.iptr);
williamr@2
   380
 *
williamr@2
   381
 * Finally an ASN1_ITEM pointer can be extracted from an
williamr@2
   382
 * appropriate reference with: ASN1_ITEM_rptr(X509). This
williamr@2
   383
 * would be used when a function takes an ASN1_ITEM * argument.
williamr@2
   384
 *
williamr@2
   385
 */
williamr@2
   386
williamr@2
   387
#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
williamr@2
   388
williamr@2
   389
/* ASN1_ITEM pointer exported type */
williamr@2
   390
typedef const ASN1_ITEM ASN1_ITEM_EXP;
williamr@2
   391
williamr@2
   392
/* Macro to obtain ASN1_ITEM pointer from exported type */
williamr@2
   393
#define ASN1_ITEM_ptr(iptr) (iptr)
williamr@2
   394
williamr@2
   395
/* Macro to include ASN1_ITEM pointer from base type */
williamr@2
   396
#define ASN1_ITEM_ref(iptr) (&(iptr##_it))
williamr@2
   397
williamr@2
   398
#define ASN1_ITEM_rptr(ref) (&(ref##_it))
williamr@2
   399
williamr@2
   400
#define DECLARE_ASN1_ITEM(name) \
williamr@2
   401
	OPENSSL_EXTERN const ASN1_ITEM name##_it;
williamr@2
   402
williamr@2
   403
#else
williamr@2
   404
williamr@2
   405
/* Platforms that can't easily handle shared global variables are declared
williamr@2
   406
 * as functions returning ASN1_ITEM pointers.
williamr@2
   407
 */
williamr@2
   408
williamr@2
   409
/* ASN1_ITEM pointer exported type */
williamr@2
   410
typedef const ASN1_ITEM * ASN1_ITEM_EXP(void);
williamr@2
   411
williamr@2
   412
/* Macro to obtain ASN1_ITEM pointer from exported type */
williamr@2
   413
#define ASN1_ITEM_ptr(iptr) (iptr())
williamr@2
   414
williamr@2
   415
/* Macro to include ASN1_ITEM pointer from base type */
williamr@2
   416
#define ASN1_ITEM_ref(iptr) (iptr##_it)
williamr@2
   417
williamr@2
   418
#define ASN1_ITEM_rptr(ref) (ref##_it())
williamr@2
   419
williamr@2
   420
#define DECLARE_ASN1_ITEM(name) \
williamr@2
   421
	IMPORT_C const ASN1_ITEM * name##_it(void);
williamr@2
   422
williamr@2
   423
#endif
williamr@2
   424
williamr@2
   425
/* Parameters used by ASN1_STRING_print_ex() */
williamr@2
   426
williamr@2
   427
/* These determine which characters to escape:
williamr@2
   428
 * RFC2253 special characters, control characters and
williamr@2
   429
 * MSB set characters
williamr@2
   430
 */
williamr@2
   431
williamr@2
   432
#define ASN1_STRFLGS_ESC_2253		1
williamr@2
   433
#define ASN1_STRFLGS_ESC_CTRL		2
williamr@2
   434
#define ASN1_STRFLGS_ESC_MSB		4
williamr@2
   435
williamr@2
   436
williamr@2
   437
/* This flag determines how we do escaping: normally
williamr@2
   438
 * RC2253 backslash only, set this to use backslash and
williamr@2
   439
 * quote.
williamr@2
   440
 */
williamr@2
   441
williamr@2
   442
#define ASN1_STRFLGS_ESC_QUOTE		8
williamr@2
   443
williamr@2
   444
williamr@2
   445
/* These three flags are internal use only. */
williamr@2
   446
williamr@2
   447
/* Character is a valid PrintableString character */
williamr@2
   448
#define CHARTYPE_PRINTABLESTRING	0x10
williamr@2
   449
/* Character needs escaping if it is the first character */
williamr@2
   450
#define CHARTYPE_FIRST_ESC_2253		0x20
williamr@2
   451
/* Character needs escaping if it is the last character */
williamr@2
   452
#define CHARTYPE_LAST_ESC_2253		0x40
williamr@2
   453
williamr@2
   454
/* NB the internal flags are safely reused below by flags
williamr@2
   455
 * handled at the top level.
williamr@2
   456
 */
williamr@2
   457
williamr@2
   458
/* If this is set we convert all character strings
williamr@2
   459
 * to UTF8 first 
williamr@2
   460
 */
williamr@2
   461
williamr@2
   462
#define ASN1_STRFLGS_UTF8_CONVERT	0x10
williamr@2
   463
williamr@2
   464
/* If this is set we don't attempt to interpret content:
williamr@2
   465
 * just assume all strings are 1 byte per character. This
williamr@2
   466
 * will produce some pretty odd looking output!
williamr@2
   467
 */
williamr@2
   468
williamr@2
   469
#define ASN1_STRFLGS_IGNORE_TYPE	0x20
williamr@2
   470
williamr@2
   471
/* If this is set we include the string type in the output */
williamr@2
   472
#define ASN1_STRFLGS_SHOW_TYPE		0x40
williamr@2
   473
williamr@2
   474
/* This determines which strings to display and which to
williamr@2
   475
 * 'dump' (hex dump of content octets or DER encoding). We can
williamr@2
   476
 * only dump non character strings or everything. If we
williamr@2
   477
 * don't dump 'unknown' they are interpreted as character
williamr@2
   478
 * strings with 1 octet per character and are subject to
williamr@2
   479
 * the usual escaping options.
williamr@2
   480
 */
williamr@2
   481
williamr@2
   482
#define ASN1_STRFLGS_DUMP_ALL		0x80
williamr@2
   483
#define ASN1_STRFLGS_DUMP_UNKNOWN	0x100
williamr@2
   484
williamr@2
   485
/* These determine what 'dumping' does, we can dump the
williamr@2
   486
 * content octets or the DER encoding: both use the
williamr@2
   487
 * RFC2253 #XXXXX notation.
williamr@2
   488
 */
williamr@2
   489
williamr@2
   490
#define ASN1_STRFLGS_DUMP_DER		0x200
williamr@2
   491
williamr@2
   492
/* All the string flags consistent with RFC2253,
williamr@2
   493
 * escaping control characters isn't essential in
williamr@2
   494
 * RFC2253 but it is advisable anyway.
williamr@2
   495
 */
williamr@2
   496
williamr@2
   497
#define ASN1_STRFLGS_RFC2253	(ASN1_STRFLGS_ESC_2253 | \
williamr@2
   498
				ASN1_STRFLGS_ESC_CTRL | \
williamr@2
   499
				ASN1_STRFLGS_ESC_MSB | \
williamr@2
   500
				ASN1_STRFLGS_UTF8_CONVERT | \
williamr@2
   501
				ASN1_STRFLGS_DUMP_UNKNOWN | \
williamr@2
   502
				ASN1_STRFLGS_DUMP_DER)
williamr@2
   503
williamr@2
   504
DECLARE_STACK_OF(ASN1_INTEGER)
williamr@2
   505
DECLARE_ASN1_SET_OF(ASN1_INTEGER)
williamr@2
   506
williamr@2
   507
DECLARE_STACK_OF(ASN1_GENERALSTRING)
williamr@2
   508
williamr@2
   509
typedef struct asn1_type_st
williamr@2
   510
	{
williamr@2
   511
	int type;
williamr@2
   512
	union	{
williamr@2
   513
		char *ptr;
williamr@2
   514
		ASN1_BOOLEAN		boolean;
williamr@2
   515
		ASN1_STRING *		asn1_string;
williamr@2
   516
		ASN1_OBJECT *		object;
williamr@2
   517
		ASN1_INTEGER *		integer;
williamr@2
   518
		ASN1_ENUMERATED *	enumerated;
williamr@2
   519
		ASN1_BIT_STRING *	bit_string;
williamr@2
   520
		ASN1_OCTET_STRING *	octet_string;
williamr@2
   521
		ASN1_PRINTABLESTRING *	printablestring;
williamr@2
   522
		ASN1_T61STRING *	t61string;
williamr@2
   523
		ASN1_IA5STRING *	ia5string;
williamr@2
   524
		ASN1_GENERALSTRING *	generalstring;
williamr@2
   525
		ASN1_BMPSTRING *	bmpstring;
williamr@2
   526
		ASN1_UNIVERSALSTRING *	universalstring;
williamr@2
   527
		ASN1_UTCTIME *		utctime;
williamr@2
   528
		ASN1_GENERALIZEDTIME *	generalizedtime;
williamr@2
   529
		ASN1_VISIBLESTRING *	visiblestring;
williamr@2
   530
		ASN1_UTF8STRING *	utf8string;
williamr@2
   531
		/* set and sequence are left complete and still
williamr@2
   532
		 * contain the set or sequence bytes */
williamr@2
   533
		ASN1_STRING *		set;
williamr@2
   534
		ASN1_STRING *		sequence;
williamr@2
   535
		} value;
williamr@2
   536
	} ASN1_TYPE;
williamr@2
   537
williamr@2
   538
DECLARE_STACK_OF(ASN1_TYPE)
williamr@2
   539
DECLARE_ASN1_SET_OF(ASN1_TYPE)
williamr@2
   540
williamr@2
   541
typedef struct asn1_method_st
williamr@2
   542
	{
williamr@2
   543
	i2d_of_void *i2d;
williamr@2
   544
	d2i_of_void *d2i;
williamr@2
   545
	void *(*create)(void);
williamr@2
   546
	void (*destroy)(void *);
williamr@2
   547
	} ASN1_METHOD;
williamr@2
   548
williamr@2
   549
/* This is used when parsing some Netscape objects */
williamr@2
   550
typedef struct asn1_header_st
williamr@2
   551
	{
williamr@2
   552
	ASN1_OCTET_STRING *header;
williamr@2
   553
	void *data;
williamr@2
   554
	ASN1_METHOD *meth;
williamr@2
   555
	} ASN1_HEADER;
williamr@2
   556
williamr@2
   557
/* This is used to contain a list of bit names */
williamr@2
   558
typedef struct BIT_STRING_BITNAME_st {
williamr@2
   559
	int bitnum;
williamr@2
   560
	const char *lname;
williamr@2
   561
	const char *sname;
williamr@2
   562
} BIT_STRING_BITNAME;
williamr@2
   563
williamr@2
   564
williamr@2
   565
#define M_ASN1_STRING_length(x)	((x)->length)
williamr@2
   566
#define M_ASN1_STRING_length_set(x, n)	((x)->length = (n))
williamr@2
   567
#define M_ASN1_STRING_type(x)	((x)->type)
williamr@2
   568
#define M_ASN1_STRING_data(x)	((x)->data)
williamr@2
   569
williamr@2
   570
/* Macros for string operations */
williamr@2
   571
#define M_ASN1_BIT_STRING_new()	(ASN1_BIT_STRING *)\
williamr@2
   572
		ASN1_STRING_type_new(V_ASN1_BIT_STRING)
williamr@2
   573
#define M_ASN1_BIT_STRING_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
williamr@2
   574
#define M_ASN1_BIT_STRING_dup(a) (ASN1_BIT_STRING *)\
williamr@2
   575
		ASN1_STRING_dup((ASN1_STRING *)a)
williamr@2
   576
#define M_ASN1_BIT_STRING_cmp(a,b) ASN1_STRING_cmp(\
williamr@2
   577
		(ASN1_STRING *)a,(ASN1_STRING *)b)
williamr@2
   578
#define M_ASN1_BIT_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c)
williamr@2
   579
williamr@2
   580
#define M_ASN1_INTEGER_new()	(ASN1_INTEGER *)\
williamr@2
   581
		ASN1_STRING_type_new(V_ASN1_INTEGER)
williamr@2
   582
#define M_ASN1_INTEGER_free(a)		ASN1_STRING_free((ASN1_STRING *)a)
williamr@2
   583
#define M_ASN1_INTEGER_dup(a) (ASN1_INTEGER *)ASN1_STRING_dup((ASN1_STRING *)a)
williamr@2
   584
#define M_ASN1_INTEGER_cmp(a,b)	ASN1_STRING_cmp(\
williamr@2
   585
		(ASN1_STRING *)a,(ASN1_STRING *)b)
williamr@2
   586
williamr@2
   587
#define M_ASN1_ENUMERATED_new()	(ASN1_ENUMERATED *)\
williamr@2
   588
		ASN1_STRING_type_new(V_ASN1_ENUMERATED)
williamr@2
   589
#define M_ASN1_ENUMERATED_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
williamr@2
   590
#define M_ASN1_ENUMERATED_dup(a) (ASN1_ENUMERATED *)ASN1_STRING_dup((ASN1_STRING *)a)
williamr@2
   591
#define M_ASN1_ENUMERATED_cmp(a,b)	ASN1_STRING_cmp(\
williamr@2
   592
		(ASN1_STRING *)a,(ASN1_STRING *)b)
williamr@2
   593
williamr@2
   594
#define M_ASN1_OCTET_STRING_new()	(ASN1_OCTET_STRING *)\
williamr@2
   595
		ASN1_STRING_type_new(V_ASN1_OCTET_STRING)
williamr@2
   596
#define M_ASN1_OCTET_STRING_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
williamr@2
   597
#define M_ASN1_OCTET_STRING_dup(a) (ASN1_OCTET_STRING *)\
williamr@2
   598
		ASN1_STRING_dup((ASN1_STRING *)a)
williamr@2
   599
#define M_ASN1_OCTET_STRING_cmp(a,b) ASN1_STRING_cmp(\
williamr@2
   600
		(ASN1_STRING *)a,(ASN1_STRING *)b)
williamr@2
   601
#define M_ASN1_OCTET_STRING_set(a,b,c)	ASN1_STRING_set((ASN1_STRING *)a,b,c)
williamr@2
   602
#define M_ASN1_OCTET_STRING_print(a,b)	ASN1_STRING_print(a,(ASN1_STRING *)b)
williamr@2
   603
#define M_i2d_ASN1_OCTET_STRING(a,pp) \
williamr@2
   604
		i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_OCTET_STRING,\
williamr@2
   605
		V_ASN1_UNIVERSAL)
williamr@2
   606
williamr@2
   607
#define B_ASN1_TIME \
williamr@2
   608
			B_ASN1_UTCTIME | \
williamr@2
   609
			B_ASN1_GENERALIZEDTIME
williamr@2
   610
williamr@2
   611
#define B_ASN1_PRINTABLE \
williamr@2
   612
			B_ASN1_PRINTABLESTRING| \
williamr@2
   613
			B_ASN1_T61STRING| \
williamr@2
   614
			B_ASN1_IA5STRING| \
williamr@2
   615
			B_ASN1_BIT_STRING| \
williamr@2
   616
			B_ASN1_UNIVERSALSTRING|\
williamr@2
   617
			B_ASN1_BMPSTRING|\
williamr@2
   618
			B_ASN1_UTF8STRING|\
williamr@2
   619
			B_ASN1_SEQUENCE|\
williamr@2
   620
			B_ASN1_UNKNOWN
williamr@2
   621
williamr@2
   622
#define B_ASN1_DIRECTORYSTRING \
williamr@2
   623
			B_ASN1_PRINTABLESTRING| \
williamr@2
   624
			B_ASN1_TELETEXSTRING|\
williamr@2
   625
			B_ASN1_BMPSTRING|\
williamr@2
   626
			B_ASN1_UNIVERSALSTRING|\
williamr@2
   627
			B_ASN1_UTF8STRING
williamr@2
   628
williamr@2
   629
#define B_ASN1_DISPLAYTEXT \
williamr@2
   630
			B_ASN1_IA5STRING| \
williamr@2
   631
			B_ASN1_VISIBLESTRING| \
williamr@2
   632
			B_ASN1_BMPSTRING|\
williamr@2
   633
			B_ASN1_UTF8STRING
williamr@2
   634
williamr@2
   635
#define M_ASN1_PRINTABLE_new()	ASN1_STRING_type_new(V_ASN1_T61STRING)
williamr@2
   636
#define M_ASN1_PRINTABLE_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
williamr@2
   637
#define M_i2d_ASN1_PRINTABLE(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\
williamr@2
   638
		pp,a->type,V_ASN1_UNIVERSAL)
williamr@2
   639
#define M_d2i_ASN1_PRINTABLE(a,pp,l) \
williamr@2
   640
		d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \
williamr@2
   641
			B_ASN1_PRINTABLE)
williamr@2
   642
williamr@2
   643
#define M_DIRECTORYSTRING_new() ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING)
williamr@2
   644
#define M_DIRECTORYSTRING_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
williamr@2
   645
#define M_i2d_DIRECTORYSTRING(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\
williamr@2
   646
						pp,a->type,V_ASN1_UNIVERSAL)
williamr@2
   647
#define M_d2i_DIRECTORYSTRING(a,pp,l) \
williamr@2
   648
		d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \
williamr@2
   649
			B_ASN1_DIRECTORYSTRING)
williamr@2
   650
williamr@2
   651
#define M_DISPLAYTEXT_new() ASN1_STRING_type_new(V_ASN1_VISIBLESTRING)
williamr@2
   652
#define M_DISPLAYTEXT_free(a) ASN1_STRING_free((ASN1_STRING *)a)
williamr@2
   653
#define M_i2d_DISPLAYTEXT(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\
williamr@2
   654
						pp,a->type,V_ASN1_UNIVERSAL)
williamr@2
   655
#define M_d2i_DISPLAYTEXT(a,pp,l) \
williamr@2
   656
		d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \
williamr@2
   657
			B_ASN1_DISPLAYTEXT)
williamr@2
   658
williamr@2
   659
#define M_ASN1_PRINTABLESTRING_new() (ASN1_PRINTABLESTRING *)\
williamr@2
   660
		ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING)
williamr@2
   661
#define M_ASN1_PRINTABLESTRING_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
williamr@2
   662
#define M_i2d_ASN1_PRINTABLESTRING(a,pp) \
williamr@2
   663
		i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_PRINTABLESTRING,\
williamr@2
   664
		V_ASN1_UNIVERSAL)
williamr@2
   665
#define M_d2i_ASN1_PRINTABLESTRING(a,pp,l) \
williamr@2
   666
		(ASN1_PRINTABLESTRING *)d2i_ASN1_type_bytes\
williamr@2
   667
		((ASN1_STRING **)a,pp,l,B_ASN1_PRINTABLESTRING)
williamr@2
   668
williamr@2
   669
#define M_ASN1_T61STRING_new()	(ASN1_T61STRING *)\
williamr@2
   670
		ASN1_STRING_type_new(V_ASN1_T61STRING)
williamr@2
   671
#define M_ASN1_T61STRING_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
williamr@2
   672
#define M_i2d_ASN1_T61STRING(a,pp) \
williamr@2
   673
		i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_T61STRING,\
williamr@2
   674
		V_ASN1_UNIVERSAL)
williamr@2
   675
#define M_d2i_ASN1_T61STRING(a,pp,l) \
williamr@2
   676
		(ASN1_T61STRING *)d2i_ASN1_type_bytes\
williamr@2
   677
		((ASN1_STRING **)a,pp,l,B_ASN1_T61STRING)
williamr@2
   678
williamr@2
   679
#define M_ASN1_IA5STRING_new()	(ASN1_IA5STRING *)\
williamr@2
   680
		ASN1_STRING_type_new(V_ASN1_IA5STRING)
williamr@2
   681
#define M_ASN1_IA5STRING_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
williamr@2
   682
#define M_ASN1_IA5STRING_dup(a)	\
williamr@2
   683
			(ASN1_IA5STRING *)ASN1_STRING_dup((ASN1_STRING *)a)
williamr@2
   684
#define M_i2d_ASN1_IA5STRING(a,pp) \
williamr@2
   685
		i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_IA5STRING,\
williamr@2
   686
			V_ASN1_UNIVERSAL)
williamr@2
   687
#define M_d2i_ASN1_IA5STRING(a,pp,l) \
williamr@2
   688
		(ASN1_IA5STRING *)d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l,\
williamr@2
   689
			B_ASN1_IA5STRING)
williamr@2
   690
williamr@2
   691
#define M_ASN1_UTCTIME_new()	(ASN1_UTCTIME *)\
williamr@2
   692
		ASN1_STRING_type_new(V_ASN1_UTCTIME)
williamr@2
   693
#define M_ASN1_UTCTIME_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
williamr@2
   694
#define M_ASN1_UTCTIME_dup(a) (ASN1_UTCTIME *)ASN1_STRING_dup((ASN1_STRING *)a)
williamr@2
   695
williamr@2
   696
#define M_ASN1_GENERALIZEDTIME_new()	(ASN1_GENERALIZEDTIME *)\
williamr@2
   697
		ASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME)
williamr@2
   698
#define M_ASN1_GENERALIZEDTIME_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
williamr@2
   699
#define M_ASN1_GENERALIZEDTIME_dup(a) (ASN1_GENERALIZEDTIME *)ASN1_STRING_dup(\
williamr@2
   700
	(ASN1_STRING *)a)
williamr@2
   701
williamr@2
   702
#define M_ASN1_TIME_new()	(ASN1_TIME *)\
williamr@2
   703
		ASN1_STRING_type_new(V_ASN1_UTCTIME)
williamr@2
   704
#define M_ASN1_TIME_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
williamr@2
   705
#define M_ASN1_TIME_dup(a) (ASN1_TIME *)ASN1_STRING_dup((ASN1_STRING *)a)
williamr@2
   706
williamr@2
   707
#define M_ASN1_GENERALSTRING_new()	(ASN1_GENERALSTRING *)\
williamr@2
   708
		ASN1_STRING_type_new(V_ASN1_GENERALSTRING)
williamr@2
   709
#define M_ASN1_GENERALSTRING_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
williamr@2
   710
#define M_i2d_ASN1_GENERALSTRING(a,pp) \
williamr@2
   711
		i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_GENERALSTRING,\
williamr@2
   712
			V_ASN1_UNIVERSAL)
williamr@2
   713
#define M_d2i_ASN1_GENERALSTRING(a,pp,l) \
williamr@2
   714
		(ASN1_GENERALSTRING *)d2i_ASN1_type_bytes\
williamr@2
   715
		((ASN1_STRING **)a,pp,l,B_ASN1_GENERALSTRING)
williamr@2
   716
williamr@2
   717
#define M_ASN1_UNIVERSALSTRING_new()	(ASN1_UNIVERSALSTRING *)\
williamr@2
   718
		ASN1_STRING_type_new(V_ASN1_UNIVERSALSTRING)
williamr@2
   719
#define M_ASN1_UNIVERSALSTRING_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
williamr@2
   720
#define M_i2d_ASN1_UNIVERSALSTRING(a,pp) \
williamr@2
   721
		i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UNIVERSALSTRING,\
williamr@2
   722
			V_ASN1_UNIVERSAL)
williamr@2
   723
#define M_d2i_ASN1_UNIVERSALSTRING(a,pp,l) \
williamr@2
   724
		(ASN1_UNIVERSALSTRING *)d2i_ASN1_type_bytes\
williamr@2
   725
		((ASN1_STRING **)a,pp,l,B_ASN1_UNIVERSALSTRING)
williamr@2
   726
williamr@2
   727
#define M_ASN1_BMPSTRING_new()	(ASN1_BMPSTRING *)\
williamr@2
   728
		ASN1_STRING_type_new(V_ASN1_BMPSTRING)
williamr@2
   729
#define M_ASN1_BMPSTRING_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
williamr@2
   730
#define M_i2d_ASN1_BMPSTRING(a,pp) \
williamr@2
   731
		i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_BMPSTRING,\
williamr@2
   732
			V_ASN1_UNIVERSAL)
williamr@2
   733
#define M_d2i_ASN1_BMPSTRING(a,pp,l) \
williamr@2
   734
		(ASN1_BMPSTRING *)d2i_ASN1_type_bytes\
williamr@2
   735
		((ASN1_STRING **)a,pp,l,B_ASN1_BMPSTRING)
williamr@2
   736
williamr@2
   737
#define M_ASN1_VISIBLESTRING_new()	(ASN1_VISIBLESTRING *)\
williamr@2
   738
		ASN1_STRING_type_new(V_ASN1_VISIBLESTRING)
williamr@2
   739
#define M_ASN1_VISIBLESTRING_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
williamr@2
   740
#define M_i2d_ASN1_VISIBLESTRING(a,pp) \
williamr@2
   741
		i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_VISIBLESTRING,\
williamr@2
   742
			V_ASN1_UNIVERSAL)
williamr@2
   743
#define M_d2i_ASN1_VISIBLESTRING(a,pp,l) \
williamr@2
   744
		(ASN1_VISIBLESTRING *)d2i_ASN1_type_bytes\
williamr@2
   745
		((ASN1_STRING **)a,pp,l,B_ASN1_VISIBLESTRING)
williamr@2
   746
williamr@2
   747
#define M_ASN1_UTF8STRING_new()	(ASN1_UTF8STRING *)\
williamr@2
   748
		ASN1_STRING_type_new(V_ASN1_UTF8STRING)
williamr@2
   749
#define M_ASN1_UTF8STRING_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
williamr@2
   750
#define M_i2d_ASN1_UTF8STRING(a,pp) \
williamr@2
   751
		i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UTF8STRING,\
williamr@2
   752
			V_ASN1_UNIVERSAL)
williamr@2
   753
#define M_d2i_ASN1_UTF8STRING(a,pp,l) \
williamr@2
   754
		(ASN1_UTF8STRING *)d2i_ASN1_type_bytes\
williamr@2
   755
		((ASN1_STRING **)a,pp,l,B_ASN1_UTF8STRING)
williamr@2
   756
williamr@2
   757
  /* for the is_set parameter to i2d_ASN1_SET */
williamr@2
   758
#define IS_SEQUENCE	0
williamr@2
   759
#define IS_SET		1
williamr@2
   760
williamr@2
   761
DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE)
williamr@2
   762
williamr@2
   763
IMPORT_C int ASN1_TYPE_get(ASN1_TYPE *a);
williamr@2
   764
IMPORT_C void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);
williamr@2
   765
williamr@2
   766
IMPORT_C ASN1_OBJECT *	ASN1_OBJECT_new(void );
williamr@2
   767
IMPORT_C void		ASN1_OBJECT_free(ASN1_OBJECT *a);
williamr@2
   768
IMPORT_C int		i2d_ASN1_OBJECT(ASN1_OBJECT *a,unsigned char **pp);
williamr@2
   769
IMPORT_C ASN1_OBJECT *	c2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp,
williamr@2
   770
			long length);
williamr@2
   771
IMPORT_C ASN1_OBJECT *	d2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp,
williamr@2
   772
			long length);
williamr@2
   773
williamr@2
   774
DECLARE_ASN1_ITEM(ASN1_OBJECT)
williamr@2
   775
williamr@2
   776
DECLARE_STACK_OF(ASN1_OBJECT)
williamr@2
   777
DECLARE_ASN1_SET_OF(ASN1_OBJECT)
williamr@2
   778
williamr@2
   779
IMPORT_C ASN1_STRING *	ASN1_STRING_new(void);
williamr@2
   780
IMPORT_C void		ASN1_STRING_free(ASN1_STRING *a);
williamr@2
   781
IMPORT_C ASN1_STRING *	ASN1_STRING_dup(ASN1_STRING *a);
williamr@2
   782
IMPORT_C ASN1_STRING *	ASN1_STRING_type_new(int type );
williamr@2
   783
IMPORT_C int 		ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b);
williamr@2
   784
  /* Since this is used to store all sorts of things, via macros, for now, make
williamr@2
   785
     its data void * */
williamr@2
   786
IMPORT_C int 		ASN1_STRING_set(ASN1_STRING *str, const void *data, int len);
williamr@2
   787
IMPORT_C int ASN1_STRING_length(ASN1_STRING *x);
williamr@2
   788
IMPORT_C void ASN1_STRING_length_set(ASN1_STRING *x, int n);
williamr@2
   789
IMPORT_C int ASN1_STRING_type(ASN1_STRING *x);
williamr@2
   790
IMPORT_C unsigned char * ASN1_STRING_data(ASN1_STRING *x);
williamr@2
   791
williamr@2
   792
DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING)
williamr@2
   793
IMPORT_C int		i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp);
williamr@2
   794
IMPORT_C ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,const unsigned char **pp,
williamr@2
   795
			long length);
williamr@2
   796
IMPORT_C int		ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d,
williamr@2
   797
			int length );
williamr@2
   798
IMPORT_C int		ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);
williamr@2
   799
IMPORT_C int		ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n);
williamr@2
   800
williamr@2
   801
#ifndef OPENSSL_NO_BIO
williamr@2
   802
IMPORT_C int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
williamr@2
   803
				BIT_STRING_BITNAME *tbl, int indent);
williamr@2
   804
#endif
williamr@2
   805
IMPORT_C int ASN1_BIT_STRING_num_asc(char *name, BIT_STRING_BITNAME *tbl);
williamr@2
   806
IMPORT_C int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value,
williamr@2
   807
				BIT_STRING_BITNAME *tbl);
williamr@2
   808
williamr@2
   809
IMPORT_C int		i2d_ASN1_BOOLEAN(int a,unsigned char **pp);
williamr@2
   810
IMPORT_C int 		d2i_ASN1_BOOLEAN(int *a,const unsigned char **pp,long length);
williamr@2
   811
williamr@2
   812
DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER)
williamr@2
   813
IMPORT_C int		i2c_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp);
williamr@2
   814
IMPORT_C ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,const unsigned char **pp,
williamr@2
   815
			long length);
williamr@2
   816
IMPORT_C ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,const unsigned char **pp,
williamr@2
   817
			long length);
williamr@2
   818
IMPORT_C ASN1_INTEGER *	ASN1_INTEGER_dup(ASN1_INTEGER *x);
williamr@2
   819
IMPORT_C int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y);
williamr@2
   820
williamr@2
   821
DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED)
williamr@2
   822
williamr@2
   823
IMPORT_C int ASN1_UTCTIME_check(ASN1_UTCTIME *a);
williamr@2
   824
IMPORT_C ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t);
williamr@2
   825
IMPORT_C int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str);
williamr@2
   826
IMPORT_C int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t);
williamr@2
   827
#if 0
williamr@2
   828
time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s);
williamr@2
   829
#endif
williamr@2
   830
williamr@2
   831
IMPORT_C int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a);
williamr@2
   832
IMPORT_C ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t);
williamr@2
   833
IMPORT_C int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str);
williamr@2
   834
williamr@2
   835
DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING)
williamr@2
   836
IMPORT_C ASN1_OCTET_STRING *	ASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *a);
williamr@2
   837
IMPORT_C int 	ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b);
williamr@2
   838
IMPORT_C int 	ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, int len);
williamr@2
   839
williamr@2
   840
DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING)
williamr@2
   841
DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING)
williamr@2
   842
DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING)
williamr@2
   843
DECLARE_ASN1_FUNCTIONS(ASN1_NULL)
williamr@2
   844
DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING)
williamr@2
   845
williamr@2
   846
IMPORT_C int UTF8_getc(const unsigned char *str, int len, unsigned long *val);
williamr@2
   847
IMPORT_C int UTF8_putc(unsigned char *str, int len, unsigned long value);
williamr@2
   848
williamr@2
   849
DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE)
williamr@2
   850
williamr@2
   851
DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING)
williamr@2
   852
DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT)
williamr@2
   853
DECLARE_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING)
williamr@2
   854
DECLARE_ASN1_FUNCTIONS(ASN1_T61STRING)
williamr@2
   855
DECLARE_ASN1_FUNCTIONS(ASN1_IA5STRING)
williamr@2
   856
DECLARE_ASN1_FUNCTIONS(ASN1_GENERALSTRING)
williamr@2
   857
DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME)
williamr@2
   858
DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME)
williamr@2
   859
DECLARE_ASN1_FUNCTIONS(ASN1_TIME)
williamr@2
   860
williamr@2
   861
DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF)
williamr@2
   862
williamr@2
   863
IMPORT_C ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t);
williamr@2
   864
IMPORT_C int ASN1_TIME_check(ASN1_TIME *t);
williamr@2
   865
IMPORT_C ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out);
williamr@2
   866
williamr@2
   867
IMPORT_C int i2d_ASN1_SET(STACK *a, unsigned char **pp,
williamr@2
   868
		 i2d_of_void *i2d, int ex_tag, int ex_class, int is_set);
williamr@2
   869
IMPORT_C STACK *	d2i_ASN1_SET(STACK **a, const unsigned char **pp, long length,
williamr@2
   870
		     d2i_of_void *d2i, void (*free_func)(void *),
williamr@2
   871
		     int ex_tag, int ex_class);
williamr@2
   872
williamr@2
   873
#ifndef OPENSSL_NO_BIO
williamr@2
   874
IMPORT_C int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a);
williamr@2
   875
IMPORT_C int a2i_ASN1_INTEGER(BIO *bp,ASN1_INTEGER *bs,char *buf,int size);
williamr@2
   876
IMPORT_C int i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a);
williamr@2
   877
IMPORT_C int a2i_ASN1_ENUMERATED(BIO *bp,ASN1_ENUMERATED *bs,char *buf,int size);
williamr@2
   878
IMPORT_C int i2a_ASN1_OBJECT(BIO *bp,ASN1_OBJECT *a);
williamr@2
   879
IMPORT_C int a2i_ASN1_STRING(BIO *bp,ASN1_STRING *bs,char *buf,int size);
williamr@2
   880
IMPORT_C int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type);
williamr@2
   881
#endif
williamr@2
   882
IMPORT_C int i2t_ASN1_OBJECT(char *buf,int buf_len,ASN1_OBJECT *a);
williamr@2
   883
williamr@2
   884
IMPORT_C int a2d_ASN1_OBJECT(unsigned char *out,int olen, const char *buf, int num);
williamr@2
   885
IMPORT_C ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len,
williamr@2
   886
	const char *sn, const char *ln);
williamr@2
   887
williamr@2
   888
IMPORT_C int ASN1_INTEGER_set(ASN1_INTEGER *a, long v);
williamr@2
   889
IMPORT_C long ASN1_INTEGER_get(ASN1_INTEGER *a);
williamr@2
   890
IMPORT_C ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai);
williamr@2
   891
IMPORT_C BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai,BIGNUM *bn);
williamr@2
   892
williamr@2
   893
IMPORT_C int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v);
williamr@2
   894
IMPORT_C long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a);
williamr@2
   895
IMPORT_C ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai);
williamr@2
   896
IMPORT_C BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai,BIGNUM *bn);
williamr@2
   897
williamr@2
   898
/* General */
williamr@2
   899
/* given a string, return the correct type, max is the maximum length */
williamr@2
   900
IMPORT_C int ASN1_PRINTABLE_type(const unsigned char *s, int max);
williamr@2
   901
williamr@2
   902
IMPORT_C int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass);
williamr@2
   903
IMPORT_C ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp,
williamr@2
   904
	long length, int Ptag, int Pclass);
williamr@2
   905
IMPORT_C unsigned long ASN1_tag2bit(int tag);
williamr@2
   906
/* type is one or more of the B_ASN1_ values. */
williamr@2
   907
IMPORT_C ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a,const unsigned char **pp,
williamr@2
   908
		long length,int type);
williamr@2
   909
williamr@2
   910
/* PARSING */
williamr@2
   911
IMPORT_C int asn1_Finish(ASN1_CTX *c);
williamr@2
   912
IMPORT_C int asn1_const_Finish(ASN1_const_CTX *c);
williamr@2
   913
williamr@2
   914
/* SPECIALS */
williamr@2
   915
IMPORT_C int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
williamr@2
   916
	int *pclass, long omax);
williamr@2
   917
IMPORT_C int ASN1_check_infinite_end(unsigned char **p,long len);
williamr@2
   918
IMPORT_C int ASN1_const_check_infinite_end(const unsigned char **p,long len);
williamr@2
   919
IMPORT_C void ASN1_put_object(unsigned char **pp, int constructed, int length,
williamr@2
   920
	int tag, int xclass);
williamr@2
   921
IMPORT_C int ASN1_put_eoc(unsigned char **pp);
williamr@2
   922
IMPORT_C int ASN1_object_size(int constructed, int length, int tag);
williamr@2
   923
williamr@2
   924
/* Used to implement other functions */
williamr@2
   925
IMPORT_C void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x);
williamr@2
   926
#define ASN1_dup_of(type,i2d,d2i,x) \
williamr@2
   927
    ((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \
williamr@2
   928
		     CHECKED_D2I_OF(type, d2i), \
williamr@2
   929
		     CHECKED_PTR_OF(type, x)))
williamr@2
   930
#define ASN1_dup_of_const(type,i2d,d2i,x) \
williamr@2
   931
    ((type*)ASN1_dup(CHECKED_I2D_OF(const type, i2d), \
williamr@2
   932
		     CHECKED_D2I_OF(type, d2i), \
williamr@2
   933
		     CHECKED_PTR_OF(const type, x)))
williamr@2
   934
williamr@2
   935
IMPORT_C void *ASN1_item_dup(const ASN1_ITEM *it, void *x);
williamr@2
   936
williamr@2
   937
#ifndef OPENSSL_NO_FP_API
williamr@2
   938
IMPORT_C void *ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x);
williamr@2
   939
#define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \
williamr@2
   940
    ((type*)ASN1_d2i_fp(CHECKED_NEW_OF(type, xnew), \
williamr@2
   941
			CHECKED_D2I_OF(type, d2i), \
williamr@2
   942
			in, \
williamr@2
   943
			CHECKED_PPTR_OF(type, x)))
williamr@2
   944
IMPORT_C void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x);
williamr@2
   945
IMPORT_C int ASN1_i2d_fp(i2d_of_void *i2d,FILE *out,void *x);
williamr@2
   946
#define ASN1_i2d_fp_of(type,i2d,out,x) \
williamr@2
   947
    (ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \
williamr@2
   948
		 out, \
williamr@2
   949
		 CHECKED_PTR_OF(type, x)))
williamr@2
   950
#define ASN1_i2d_fp_of_const(type,i2d,out,x) \
williamr@2
   951
    (ASN1_i2d_fp(CHECKED_I2D_OF(const type, i2d), \
williamr@2
   952
		 out, \
williamr@2
   953
		 CHECKED_PTR_OF(const type, x)))
williamr@2
   954
IMPORT_C int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x);
williamr@2
   955
IMPORT_C int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags);
williamr@2
   956
#endif
williamr@2
   957
williamr@2
   958
IMPORT_C int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in);
williamr@2
   959
williamr@2
   960
#ifndef OPENSSL_NO_BIO
williamr@2
   961
IMPORT_C void *ASN1_d2i_bio(void *(*xnew)(void), d2i_of_void *d2i, BIO *in, void **x);
williamr@2
   962
#define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \
williamr@2
   963
    ((type*)ASN1_d2i_bio( CHECKED_NEW_OF(type, xnew), \
williamr@2
   964
			  CHECKED_D2I_OF(type, d2i), \
williamr@2
   965
			  in, \
williamr@2
   966
			  CHECKED_PPTR_OF(type, x)))
williamr@2
   967
IMPORT_C void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x);
williamr@2
   968
IMPORT_C int ASN1_i2d_bio(i2d_of_void *i2d,BIO *out, unsigned char *x);
williamr@2
   969
#define ASN1_i2d_bio_of(type,i2d,out,x) \
williamr@2
   970
    (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \
williamr@2
   971
		  out, \
williamr@2
   972
		  CHECKED_PTR_OF(type, x)))
williamr@2
   973
#define ASN1_i2d_bio_of_const(type,i2d,out,x) \
williamr@2
   974
    (ASN1_i2d_bio(CHECKED_I2D_OF(const type, i2d), \
williamr@2
   975
		  out, \
williamr@2
   976
		  CHECKED_PTR_OF(const type, x)))
williamr@2
   977
IMPORT_C int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x);
williamr@2
   978
IMPORT_C int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a);
williamr@2
   979
IMPORT_C int ASN1_GENERALIZEDTIME_print(BIO *fp,ASN1_GENERALIZEDTIME *a);
williamr@2
   980
IMPORT_C int ASN1_TIME_print(BIO *fp,ASN1_TIME *a);
williamr@2
   981
IMPORT_C int ASN1_STRING_print(BIO *bp,ASN1_STRING *v);
williamr@2
   982
IMPORT_C int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags);
williamr@2
   983
IMPORT_C int ASN1_parse(BIO *bp,const unsigned char *pp,long len,int indent);
williamr@2
   984
IMPORT_C int ASN1_parse_dump(BIO *bp,const unsigned char *pp,long len,int indent,int dump);
williamr@2
   985
#endif
williamr@2
   986
IMPORT_C const char *ASN1_tag2str(int tag);
williamr@2
   987
williamr@2
   988
/* Used to load and write netscape format cert/key */
williamr@2
   989
IMPORT_C int i2d_ASN1_HEADER(ASN1_HEADER *a,unsigned char **pp);
williamr@2
   990
IMPORT_C ASN1_HEADER *d2i_ASN1_HEADER(ASN1_HEADER **a,const unsigned char **pp, long length);
williamr@2
   991
IMPORT_C ASN1_HEADER *ASN1_HEADER_new(void );
williamr@2
   992
IMPORT_C void ASN1_HEADER_free(ASN1_HEADER *a);
williamr@2
   993
williamr@2
   994
IMPORT_C int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s);
williamr@2
   995
williamr@2
   996
/* Not used that much at this point, except for the first two */
williamr@2
   997
IMPORT_C ASN1_METHOD *X509_asn1_meth(void);
williamr@2
   998
IMPORT_C ASN1_METHOD *RSAPrivateKey_asn1_meth(void);
williamr@2
   999
IMPORT_C ASN1_METHOD *ASN1_IA5STRING_asn1_meth(void);
williamr@2
  1000
IMPORT_C ASN1_METHOD *ASN1_BIT_STRING_asn1_meth(void);
williamr@2
  1001
williamr@2
  1002
IMPORT_C int ASN1_TYPE_set_octetstring(ASN1_TYPE *a,
williamr@2
  1003
	unsigned char *data, int len);
williamr@2
  1004
IMPORT_C int ASN1_TYPE_get_octetstring(ASN1_TYPE *a,
williamr@2
  1005
	unsigned char *data, int max_len);
williamr@2
  1006
IMPORT_C int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num,
williamr@2
  1007
	unsigned char *data, int len);
williamr@2
  1008
IMPORT_C int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num,
williamr@2
  1009
	unsigned char *data, int max_len);
williamr@2
  1010
williamr@2
  1011
IMPORT_C STACK *ASN1_seq_unpack(const unsigned char *buf, int len,
williamr@2
  1012
		       d2i_of_void *d2i, void (*free_func)(void *));
williamr@2
  1013
IMPORT_C unsigned char *ASN1_seq_pack(STACK *safes, i2d_of_void *i2d,
williamr@2
  1014
			     unsigned char **buf, int *len );
williamr@2
  1015
IMPORT_C void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i);
williamr@2
  1016
IMPORT_C void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it);
williamr@2
  1017
IMPORT_C ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d,
williamr@2
  1018
			      ASN1_OCTET_STRING **oct);
williamr@2
  1019
#define ASN1_pack_string_of(type,obj,i2d,oct) \
williamr@2
  1020
    (ASN1_pack_string(CHECKED_PTR_OF(type, obj), \
williamr@2
  1021
		      CHECKED_I2D_OF(type, i2d), \
williamr@2
  1022
		      oct))
williamr@2
  1023
IMPORT_C ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct);
williamr@2
  1024
williamr@2
  1025
IMPORT_C void ASN1_STRING_set_default_mask(unsigned long mask);
williamr@2
  1026
IMPORT_C int ASN1_STRING_set_default_mask_asc(char *p);
williamr@2
  1027
IMPORT_C unsigned long ASN1_STRING_get_default_mask(void);
williamr@2
  1028
IMPORT_C int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len,
williamr@2
  1029
					int inform, unsigned long mask);
williamr@2
  1030
IMPORT_C int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
williamr@2
  1031
					int inform, unsigned long mask, 
williamr@2
  1032
					long minsize, long maxsize);
williamr@2
  1033
williamr@2
  1034
IMPORT_C ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, 
williamr@2
  1035
		const unsigned char *in, int inlen, int inform, int nid);
williamr@2
  1036
IMPORT_C ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid);
williamr@2
  1037
IMPORT_C int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long);
williamr@2
  1038
IMPORT_C void ASN1_STRING_TABLE_cleanup(void);
williamr@2
  1039
williamr@2
  1040
/* ASN1 template functions */
williamr@2
  1041
williamr@2
  1042
/* Old API compatible functions */
williamr@2
  1043
IMPORT_C ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it);
williamr@2
  1044
IMPORT_C void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it);
williamr@2
  1045
IMPORT_C ASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, long len, const ASN1_ITEM *it);
williamr@2
  1046
IMPORT_C int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
williamr@2
  1047
IMPORT_C int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
williamr@2
  1048
williamr@2
  1049
IMPORT_C void ASN1_add_oid_module(void);
williamr@2
  1050
williamr@2
  1051
IMPORT_C ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf);
williamr@2
  1052
IMPORT_C ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf);
williamr@2
  1053
	
williamr@2
  1054
/* BEGIN ERROR CODES */
williamr@2
  1055
/* The following lines are auto generated by the script mkerr.pl. Any changes
williamr@2
  1056
 * made after this point may be overwritten when the script is next run.
williamr@2
  1057
 */
williamr@2
  1058
IMPORT_C void ERR_load_ASN1_strings(void);
williamr@2
  1059
williamr@2
  1060
/* Error codes for the ASN1 functions. */
williamr@2
  1061
williamr@2
  1062
/* Function codes. */
williamr@2
  1063
#define ASN1_F_A2D_ASN1_OBJECT				 100
williamr@2
  1064
#define ASN1_F_A2I_ASN1_ENUMERATED			 101
williamr@2
  1065
#define ASN1_F_A2I_ASN1_INTEGER				 102
williamr@2
  1066
#define ASN1_F_A2I_ASN1_STRING				 103
williamr@2
  1067
#define ASN1_F_APPEND_EXP				 176
williamr@2
  1068
#define ASN1_F_ASN1_BIT_STRING_SET_BIT			 183
williamr@2
  1069
#define ASN1_F_ASN1_CB					 177
williamr@2
  1070
#define ASN1_F_ASN1_CHECK_TLEN				 104
williamr@2
  1071
#define ASN1_F_ASN1_COLLATE_PRIMITIVE			 105
williamr@2
  1072
#define ASN1_F_ASN1_COLLECT				 106
williamr@2
  1073
#define ASN1_F_ASN1_D2I_EX_PRIMITIVE			 108
williamr@2
  1074
#define ASN1_F_ASN1_D2I_FP				 109
williamr@2
  1075
#define ASN1_F_ASN1_D2I_READ_BIO			 107
williamr@2
  1076
#define ASN1_F_ASN1_DIGEST				 184
williamr@2
  1077
#define ASN1_F_ASN1_DO_ADB				 110
williamr@2
  1078
#define ASN1_F_ASN1_DUP					 111
williamr@2
  1079
#define ASN1_F_ASN1_ENUMERATED_SET			 112
williamr@2
  1080
#define ASN1_F_ASN1_ENUMERATED_TO_BN			 113
williamr@2
  1081
#define ASN1_F_ASN1_EX_C2I				 204
williamr@2
  1082
#define ASN1_F_ASN1_FIND_END				 190
williamr@2
  1083
#define ASN1_F_ASN1_GENERALIZEDTIME_SET			 185
williamr@2
  1084
#define ASN1_F_ASN1_GENERATE_V3				 178
williamr@2
  1085
#define ASN1_F_ASN1_GET_OBJECT				 114
williamr@2
  1086
#define ASN1_F_ASN1_HEADER_NEW				 115
williamr@2
  1087
#define ASN1_F_ASN1_I2D_BIO				 116
williamr@2
  1088
#define ASN1_F_ASN1_I2D_FP				 117
williamr@2
  1089
#define ASN1_F_ASN1_INTEGER_SET				 118
williamr@2
  1090
#define ASN1_F_ASN1_INTEGER_TO_BN			 119
williamr@2
  1091
#define ASN1_F_ASN1_ITEM_D2I_FP				 206
williamr@2
  1092
#define ASN1_F_ASN1_ITEM_DUP				 191
williamr@2
  1093
#define ASN1_F_ASN1_ITEM_EX_COMBINE_NEW			 121
williamr@2
  1094
#define ASN1_F_ASN1_ITEM_EX_D2I				 120
williamr@2
  1095
#define ASN1_F_ASN1_ITEM_I2D_BIO			 192
williamr@2
  1096
#define ASN1_F_ASN1_ITEM_I2D_FP				 193
williamr@2
  1097
#define ASN1_F_ASN1_ITEM_PACK				 198
williamr@2
  1098
#define ASN1_F_ASN1_ITEM_SIGN				 195
williamr@2
  1099
#define ASN1_F_ASN1_ITEM_UNPACK				 199
williamr@2
  1100
#define ASN1_F_ASN1_ITEM_VERIFY				 197
williamr@2
  1101
#define ASN1_F_ASN1_MBSTRING_NCOPY			 122
williamr@2
  1102
#define ASN1_F_ASN1_OBJECT_NEW				 123
williamr@2
  1103
#define ASN1_F_ASN1_PACK_STRING				 124
williamr@2
  1104
#define ASN1_F_ASN1_PCTX_NEW				 205
williamr@2
  1105
#define ASN1_F_ASN1_PKCS5_PBE_SET			 125
williamr@2
  1106
#define ASN1_F_ASN1_SEQ_PACK				 126
williamr@2
  1107
#define ASN1_F_ASN1_SEQ_UNPACK				 127
williamr@2
  1108
#define ASN1_F_ASN1_SIGN				 128
williamr@2
  1109
#define ASN1_F_ASN1_STR2TYPE				 179
williamr@2
  1110
#define ASN1_F_ASN1_STRING_SET				 186
williamr@2
  1111
#define ASN1_F_ASN1_STRING_TABLE_ADD			 129
williamr@2
  1112
#define ASN1_F_ASN1_STRING_TYPE_NEW			 130
williamr@2
  1113
#define ASN1_F_ASN1_TEMPLATE_EX_D2I			 132
williamr@2
  1114
#define ASN1_F_ASN1_TEMPLATE_NEW			 133
williamr@2
  1115
#define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I			 131
williamr@2
  1116
#define ASN1_F_ASN1_TIME_SET				 175
williamr@2
  1117
#define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING		 134
williamr@2
  1118
#define ASN1_F_ASN1_TYPE_GET_OCTETSTRING		 135
williamr@2
  1119
#define ASN1_F_ASN1_UNPACK_STRING			 136
williamr@2
  1120
#define ASN1_F_ASN1_UTCTIME_SET				 187
williamr@2
  1121
#define ASN1_F_ASN1_VERIFY				 137
williamr@2
  1122
#define ASN1_F_BITSTR_CB				 180
williamr@2
  1123
#define ASN1_F_BN_TO_ASN1_ENUMERATED			 138
williamr@2
  1124
#define ASN1_F_BN_TO_ASN1_INTEGER			 139
williamr@2
  1125
#define ASN1_F_C2I_ASN1_BIT_STRING			 189
williamr@2
  1126
#define ASN1_F_C2I_ASN1_INTEGER				 194
williamr@2
  1127
#define ASN1_F_C2I_ASN1_OBJECT				 196
williamr@2
  1128
#define ASN1_F_COLLECT_DATA				 140
williamr@2
  1129
#define ASN1_F_D2I_ASN1_BIT_STRING			 141
williamr@2
  1130
#define ASN1_F_D2I_ASN1_BOOLEAN				 142
williamr@2
  1131
#define ASN1_F_D2I_ASN1_BYTES				 143
williamr@2
  1132
#define ASN1_F_D2I_ASN1_GENERALIZEDTIME			 144
williamr@2
  1133
#define ASN1_F_D2I_ASN1_HEADER				 145
williamr@2
  1134
#define ASN1_F_D2I_ASN1_INTEGER				 146
williamr@2
  1135
#define ASN1_F_D2I_ASN1_OBJECT				 147
williamr@2
  1136
#define ASN1_F_D2I_ASN1_SET				 148
williamr@2
  1137
#define ASN1_F_D2I_ASN1_TYPE_BYTES			 149
williamr@2
  1138
#define ASN1_F_D2I_ASN1_UINTEGER			 150
williamr@2
  1139
#define ASN1_F_D2I_ASN1_UTCTIME				 151
williamr@2
  1140
#define ASN1_F_D2I_NETSCAPE_RSA				 152
williamr@2
  1141
#define ASN1_F_D2I_NETSCAPE_RSA_2			 153
williamr@2
  1142
#define ASN1_F_D2I_PRIVATEKEY				 154
williamr@2
  1143
#define ASN1_F_D2I_PUBLICKEY				 155
williamr@2
  1144
#define ASN1_F_D2I_RSA_NET				 200
williamr@2
  1145
#define ASN1_F_D2I_RSA_NET_2				 201
williamr@2
  1146
#define ASN1_F_D2I_X509					 156
williamr@2
  1147
#define ASN1_F_D2I_X509_CINF				 157
williamr@2
  1148
#define ASN1_F_D2I_X509_PKEY				 159
williamr@2
  1149
#define ASN1_F_I2D_ASN1_SET				 188
williamr@2
  1150
#define ASN1_F_I2D_ASN1_TIME				 160
williamr@2
  1151
#define ASN1_F_I2D_DSA_PUBKEY				 161
williamr@2
  1152
#define ASN1_F_I2D_EC_PUBKEY				 181
williamr@2
  1153
#define ASN1_F_I2D_PRIVATEKEY				 163
williamr@2
  1154
#define ASN1_F_I2D_PUBLICKEY				 164
williamr@2
  1155
#define ASN1_F_I2D_RSA_NET				 162
williamr@2
  1156
#define ASN1_F_I2D_RSA_PUBKEY				 165
williamr@2
  1157
#define ASN1_F_LONG_C2I					 166
williamr@2
  1158
#define ASN1_F_OID_MODULE_INIT				 174
williamr@2
  1159
#define ASN1_F_PARSE_TAGGING				 182
williamr@2
  1160
#define ASN1_F_PKCS5_PBE2_SET				 167
williamr@2
  1161
#define ASN1_F_PKCS5_PBE_SET				 202
williamr@2
  1162
#define ASN1_F_X509_CINF_NEW				 168
williamr@2
  1163
#define ASN1_F_X509_CRL_ADD0_REVOKED			 169
williamr@2
  1164
#define ASN1_F_X509_INFO_NEW				 170
williamr@2
  1165
#define ASN1_F_X509_NAME_ENCODE				 203
williamr@2
  1166
#define ASN1_F_X509_NAME_EX_D2I				 158
williamr@2
  1167
#define ASN1_F_X509_NAME_EX_NEW				 171
williamr@2
  1168
#define ASN1_F_X509_NEW					 172
williamr@2
  1169
#define ASN1_F_X509_PKEY_NEW				 173
williamr@2
  1170
williamr@2
  1171
/* Reason codes. */
williamr@2
  1172
#define ASN1_R_ADDING_OBJECT				 171
williamr@2
  1173
#define ASN1_R_AUX_ERROR				 100
williamr@2
  1174
#define ASN1_R_BAD_CLASS				 101
williamr@2
  1175
#define ASN1_R_BAD_OBJECT_HEADER			 102
williamr@2
  1176
#define ASN1_R_BAD_PASSWORD_READ			 103
williamr@2
  1177
#define ASN1_R_BAD_TAG					 104
williamr@2
  1178
#define ASN1_R_BN_LIB					 105
williamr@2
  1179
#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH			 106
williamr@2
  1180
#define ASN1_R_BUFFER_TOO_SMALL				 107
williamr@2
  1181
#define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER		 108
williamr@2
  1182
#define ASN1_R_DATA_IS_WRONG				 109
williamr@2
  1183
#define ASN1_R_DECODE_ERROR				 110
williamr@2
  1184
#define ASN1_R_DECODING_ERROR				 111
williamr@2
  1185
#define ASN1_R_DEPTH_EXCEEDED				 174
williamr@2
  1186
#define ASN1_R_ENCODE_ERROR				 112
williamr@2
  1187
#define ASN1_R_ERROR_GETTING_TIME			 173
williamr@2
  1188
#define ASN1_R_ERROR_LOADING_SECTION			 172
williamr@2
  1189
#define ASN1_R_ERROR_PARSING_SET_ELEMENT		 113
williamr@2
  1190
#define ASN1_R_ERROR_SETTING_CIPHER_PARAMS		 114
williamr@2
  1191
#define ASN1_R_EXPECTING_AN_INTEGER			 115
williamr@2
  1192
#define ASN1_R_EXPECTING_AN_OBJECT			 116
williamr@2
  1193
#define ASN1_R_EXPECTING_A_BOOLEAN			 117
williamr@2
  1194
#define ASN1_R_EXPECTING_A_TIME				 118
williamr@2
  1195
#define ASN1_R_EXPLICIT_LENGTH_MISMATCH			 119
williamr@2
  1196
#define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED		 120
williamr@2
  1197
#define ASN1_R_FIELD_MISSING				 121
williamr@2
  1198
#define ASN1_R_FIRST_NUM_TOO_LARGE			 122
williamr@2
  1199
#define ASN1_R_HEADER_TOO_LONG				 123
williamr@2
  1200
#define ASN1_R_ILLEGAL_BITSTRING_FORMAT			 175
williamr@2
  1201
#define ASN1_R_ILLEGAL_BOOLEAN				 176
williamr@2
  1202
#define ASN1_R_ILLEGAL_CHARACTERS			 124
williamr@2
  1203
#define ASN1_R_ILLEGAL_FORMAT				 177
williamr@2
  1204
#define ASN1_R_ILLEGAL_HEX				 178
williamr@2
  1205
#define ASN1_R_ILLEGAL_IMPLICIT_TAG			 179
williamr@2
  1206
#define ASN1_R_ILLEGAL_INTEGER				 180
williamr@2
  1207
#define ASN1_R_ILLEGAL_NESTED_TAGGING			 181
williamr@2
  1208
#define ASN1_R_ILLEGAL_NULL				 125
williamr@2
  1209
#define ASN1_R_ILLEGAL_NULL_VALUE			 182
williamr@2
  1210
#define ASN1_R_ILLEGAL_OBJECT				 183
williamr@2
  1211
#define ASN1_R_ILLEGAL_OPTIONAL_ANY			 126
williamr@2
  1212
#define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE		 170
williamr@2
  1213
#define ASN1_R_ILLEGAL_TAGGED_ANY			 127
williamr@2
  1214
#define ASN1_R_ILLEGAL_TIME_VALUE			 184
williamr@2
  1215
#define ASN1_R_INTEGER_NOT_ASCII_FORMAT			 185
williamr@2
  1216
#define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG		 128
williamr@2
  1217
#define ASN1_R_INVALID_BMPSTRING_LENGTH			 129
williamr@2
  1218
#define ASN1_R_INVALID_DIGIT				 130
williamr@2
  1219
#define ASN1_R_INVALID_MODIFIER				 186
williamr@2
  1220
#define ASN1_R_INVALID_NUMBER				 187
williamr@2
  1221
#define ASN1_R_INVALID_SEPARATOR			 131
williamr@2
  1222
#define ASN1_R_INVALID_TIME_FORMAT			 132
williamr@2
  1223
#define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH		 133
williamr@2
  1224
#define ASN1_R_INVALID_UTF8STRING			 134
williamr@2
  1225
#define ASN1_R_IV_TOO_LARGE				 135
williamr@2
  1226
#define ASN1_R_LENGTH_ERROR				 136
williamr@2
  1227
#define ASN1_R_LIST_ERROR				 188
williamr@2
  1228
#define ASN1_R_MISSING_EOC				 137
williamr@2
  1229
#define ASN1_R_MISSING_SECOND_NUMBER			 138
williamr@2
  1230
#define ASN1_R_MISSING_VALUE				 189
williamr@2
  1231
#define ASN1_R_MSTRING_NOT_UNIVERSAL			 139
williamr@2
  1232
#define ASN1_R_MSTRING_WRONG_TAG			 140
williamr@2
  1233
#define ASN1_R_NESTED_ASN1_STRING			 197
williamr@2
  1234
#define ASN1_R_NON_HEX_CHARACTERS			 141
williamr@2
  1235
#define ASN1_R_NOT_ASCII_FORMAT				 190
williamr@2
  1236
#define ASN1_R_NOT_ENOUGH_DATA				 142
williamr@2
  1237
#define ASN1_R_NO_MATCHING_CHOICE_TYPE			 143
williamr@2
  1238
#define ASN1_R_NULL_IS_WRONG_LENGTH			 144
williamr@2
  1239
#define ASN1_R_OBJECT_NOT_ASCII_FORMAT			 191
williamr@2
  1240
#define ASN1_R_ODD_NUMBER_OF_CHARS			 145
williamr@2
  1241
#define ASN1_R_PRIVATE_KEY_HEADER_MISSING		 146
williamr@2
  1242
#define ASN1_R_SECOND_NUMBER_TOO_LARGE			 147
williamr@2
  1243
#define ASN1_R_SEQUENCE_LENGTH_MISMATCH			 148
williamr@2
  1244
#define ASN1_R_SEQUENCE_NOT_CONSTRUCTED			 149
williamr@2
  1245
#define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG		 192
williamr@2
  1246
#define ASN1_R_SHORT_LINE				 150
williamr@2
  1247
#define ASN1_R_STRING_TOO_LONG				 151
williamr@2
  1248
#define ASN1_R_STRING_TOO_SHORT				 152
williamr@2
  1249
#define ASN1_R_TAG_VALUE_TOO_HIGH			 153
williamr@2
  1250
#define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154
williamr@2
  1251
#define ASN1_R_TIME_NOT_ASCII_FORMAT			 193
williamr@2
  1252
#define ASN1_R_TOO_LONG					 155
williamr@2
  1253
#define ASN1_R_TYPE_NOT_CONSTRUCTED			 156
williamr@2
  1254
#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY			 157
williamr@2
  1255
#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY		 158
williamr@2
  1256
#define ASN1_R_UNEXPECTED_EOC				 159
williamr@2
  1257
#define ASN1_R_UNKNOWN_FORMAT				 160
williamr@2
  1258
#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM		 161
williamr@2
  1259
#define ASN1_R_UNKNOWN_OBJECT_TYPE			 162
williamr@2
  1260
#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE			 163
williamr@2
  1261
#define ASN1_R_UNKNOWN_TAG				 194
williamr@2
  1262
#define ASN1_R_UNKOWN_FORMAT				 195
williamr@2
  1263
#define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE		 164
williamr@2
  1264
#define ASN1_R_UNSUPPORTED_CIPHER			 165
williamr@2
  1265
#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM		 166
williamr@2
  1266
#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE		 167
williamr@2
  1267
#define ASN1_R_UNSUPPORTED_TYPE				 196
williamr@2
  1268
#define ASN1_R_WRONG_TAG				 168
williamr@2
  1269
#define ASN1_R_WRONG_TYPE				 169
williamr@2
  1270
williamr@2
  1271
#ifdef  __cplusplus
williamr@2
  1272
}
williamr@2
  1273
#endif
williamr@2
  1274
#endif