#ifndef HEADER_ASN1_H
#define HEADER_ASN1_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include <time.h>
#include <openssl/bn.h>
#include <openssl/stack.h>
#include <openssl/vms_idhacks.h>
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define V_ASN1_UNIVERSAL 0x00
#define V_ASN1_APPLICATION 0x40
#define V_ASN1_CONTEXT_SPECIFIC 0x80
#define V_ASN1_PRIMITIVE_TAG 0x1f
#define V_ASN1_PRIMATIVE_TAG 0x1f
-#define V_ASN1_APP_CHOOSE -2 /* let the recipent choose */
+#define V_ASN1_APP_CHOOSE -2 /* let the recipient choose */
#define V_ASN1_UNDEF -1
#define V_ASN1_EOC 0
#define MBSTRING_UNIV (MBSTRING_FLAG|3)
#define MBSTRING_UTF8 (MBSTRING_FLAG|4)
+struct X509_algor_st;
+
#define DECLARE_ASN1_SET_OF(type) \
int i2d_ASN1_SET_OF_##type(STACK_OF(type) *a,unsigned char **pp, \
int (*func)(type *,unsigned char **), int ex_tag, \
type *(*func)(type **, \
unsigned char **,long), \
void (*free_func)(type *), \
- int ex_tag,int ex_class);
+ int ex_tag,int ex_class); \
+unsigned char *ASN1_seq_pack_##type(STACK_OF(type) *st, \
+ int (*i2d)(type *,unsigned char **), \
+ unsigned char **buf,int *len); \
+STACK_OF(type) *ASN1_seq_unpack_##type(unsigned char *buf,int len, \
+ type *(*d2i)(type **,unsigned char **, \
+ long), \
+ void (*free_func)(type *));
#define IMPLEMENT_ASN1_SET_OF(type) \
int i2d_ASN1_SET_OF_##type(STACK_OF(type) *a,unsigned char **pp, \
{ return (STACK_OF(type) *)d2i_ASN1_SET((STACK **)a,pp,length, \
(char *(*)())func, \
(void (*)())free_func, \
- ex_tag,ex_class); }
+ ex_tag,ex_class); } \
+unsigned char *ASN1_seq_pack_##type(STACK_OF(type) *st, \
+ int (*i2d)(type *,unsigned char **), \
+ unsigned char **buf,int *len) \
+ { return ASN1_seq_pack((STACK *)st,i2d,buf,len); } \
+STACK_OF(type) *ASN1_seq_unpack_##type(unsigned char *buf,int len, \
+ type *(*d2i)(type **,unsigned char **, \
+ long), \
+ void (*free_func)(type *)) \
+ { return (STACK_OF(type) *)ASN1_seq_unpack(buf,len,(char *(*)())d2i, \
+ (void(*)(void *))free_func); }
typedef struct asn1_ctx_st
{
int tag; /* tag from last 'get object' */
int xclass; /* class from last 'get object' */
long slen; /* length of last 'get object' */
- unsigned char *max; /* largest value of p alowed */
+ unsigned char *max; /* largest value of p allowed */
unsigned char *q;/* temporary variable */
unsigned char **pp;/* variable */
int line; /* used in error processing */
} ASN1_STRING;
#define STABLE_FLAGS_MALLOC 0x01
+#define STABLE_NO_MASK 0x02
+#define DIRSTRING_TYPE \
+ (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING)
+#define PKCS9STRING_TYPE (DIRSTRING_TYPE|B_ASN1_IA5STRING)
typedef struct asn1_string_table_st {
int nid;
} ASN1_STRING_TABLE;
DECLARE_STACK_OF(ASN1_STRING_TABLE)
+/* This block of defines is updated by a perl script, please do not touch! */
+#ifndef DEBUG_SAFESTACK
+ #define sk_ASN1_STRING_TABLE_new(a) sk_new((int (*) \
+ (const char * const *, const char * const *))(a))
+ #define sk_ASN1_STRING_TABLE_new_null() sk_new_null()
+ #define sk_ASN1_STRING_TABLE_free(a) sk_free(a)
+ #define sk_ASN1_STRING_TABLE_num(a) sk_num(a)
+ #define sk_ASN1_STRING_TABLE_value(a,b) ((ASN1_STRING_TABLE *) \
+ sk_value((a),(b)))
+ #define sk_ASN1_STRING_TABLE_set(a,b,c) ((ASN1_STRING_TABLE *) \
+ sk_set((a),(b),(char *)(c)))
+ #define sk_ASN1_STRING_TABLE_zero(a) sk_zero(a)
+ #define sk_ASN1_STRING_TABLE_push(a,b) sk_push((a),(char *)(b))
+ #define sk_ASN1_STRING_TABLE_unshift(a,b) sk_unshift((a),(b))
+ #define sk_ASN1_STRING_TABLE_find(a,b) sk_find((a), (char *)(b))
+ #define sk_ASN1_STRING_TABLE_delete(a,b) ((ASN1_STRING_TABLE *) \
+ sk_delete((a),(b)))
+ #define sk_ASN1_STRING_TABLE_delete_ptr(a,b) ((ASN1_STRING_TABLE *) \
+ sk_delete_ptr((a),(char *)(b)))
+ #define sk_ASN1_STRING_TABLE_insert(a,b,c) sk_insert((a),(char *)(b),(c))
+ #define sk_ASN1_STRING_TABLE_set_cmp_func(a,b) ((int (*) \
+ (const ASN1_STRING_TABLE * const *,const ASN1_STRING_TABLE * const *)) \
+ sk_set_cmp_func((a),(int (*) \
+ (const char * const *, const char * const *))(b)))
+ #define sk_ASN1_STRING_TABLE_dup(a) sk_dup(a)
+ #define sk_ASN1_STRING_TABLE_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b))
+ #define sk_ASN1_STRING_TABLE_shift(a) ((ASN1_STRING_TABLE *)sk_shift(a))
+ #define sk_ASN1_STRING_TABLE_pop(a) ((ASN1_STRING_TABLE *)sk_pop(a))
+ #define sk_ASN1_STRING_TABLE_sort(a) sk_sort(a)
+#endif /* !DEBUG_SAFESTACK */
+/* End of perl script block, you may now edit :-) */
/* size limits: this stuff is taken straight from RFC2459 */
#define ub_title 64
#define ub_email_address 128
-#ifndef DEBUG
+#ifdef NO_ASN1_TYPEDEFS
#define ASN1_INTEGER ASN1_STRING
#define ASN1_ENUMERATED ASN1_STRING
#define ASN1_BIT_STRING ASN1_STRING
typedef struct asn1_string_st ASN1_UTF8STRING;
#endif
+typedef int ASN1_NULL;
+
+DECLARE_STACK_OF(ASN1_INTEGER)
+/* This block of defines is updated by a perl script, please do not touch! */
+#ifndef DEBUG_SAFESTACK
+ #define sk_ASN1_INTEGER_new(a) sk_new((int (*) \
+ (const char * const *, const char * const *))(a))
+ #define sk_ASN1_INTEGER_new_null() sk_new_null()
+ #define sk_ASN1_INTEGER_free(a) sk_free(a)
+ #define sk_ASN1_INTEGER_num(a) sk_num(a)
+ #define sk_ASN1_INTEGER_value(a,b) ((ASN1_INTEGER *) \
+ sk_value((a),(b)))
+ #define sk_ASN1_INTEGER_set(a,b,c) ((ASN1_INTEGER *) \
+ sk_set((a),(b),(char *)(c)))
+ #define sk_ASN1_INTEGER_zero(a) sk_zero(a)
+ #define sk_ASN1_INTEGER_push(a,b) sk_push((a),(char *)(b))
+ #define sk_ASN1_INTEGER_unshift(a,b) sk_unshift((a),(b))
+ #define sk_ASN1_INTEGER_find(a,b) sk_find((a), (char *)(b))
+ #define sk_ASN1_INTEGER_delete(a,b) ((ASN1_INTEGER *) \
+ sk_delete((a),(b)))
+ #define sk_ASN1_INTEGER_delete_ptr(a,b) ((ASN1_INTEGER *) \
+ sk_delete_ptr((a),(char *)(b)))
+ #define sk_ASN1_INTEGER_insert(a,b,c) sk_insert((a),(char *)(b),(c))
+ #define sk_ASN1_INTEGER_set_cmp_func(a,b) ((int (*) \
+ (const ASN1_INTEGER * const *,const ASN1_INTEGER * const *)) \
+ sk_set_cmp_func((a),(int (*) \
+ (const char * const *, const char * const *))(b)))
+ #define sk_ASN1_INTEGER_dup(a) sk_dup(a)
+ #define sk_ASN1_INTEGER_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b))
+ #define sk_ASN1_INTEGER_shift(a) ((ASN1_INTEGER *)sk_shift(a))
+ #define sk_ASN1_INTEGER_pop(a) ((ASN1_INTEGER *)sk_pop(a))
+ #define sk_ASN1_INTEGER_sort(a) sk_sort(a)
+#endif /* !DEBUG_SAFESTACK */
+/* End of perl script block, you may now edit :-) */
+DECLARE_ASN1_SET_OF(ASN1_INTEGER)
+
typedef struct asn1_type_st
{
int type;
} ASN1_TYPE;
DECLARE_STACK_OF(ASN1_TYPE)
+/* This block of defines is updated by a perl script, please do not touch! */
+#ifndef DEBUG_SAFESTACK
+ #define sk_ASN1_TYPE_new(a) sk_new((int (*) \
+ (const char * const *, const char * const *))(a))
+ #define sk_ASN1_TYPE_new_null() sk_new_null()
+ #define sk_ASN1_TYPE_free(a) sk_free(a)
+ #define sk_ASN1_TYPE_num(a) sk_num(a)
+ #define sk_ASN1_TYPE_value(a,b) ((ASN1_TYPE *) \
+ sk_value((a),(b)))
+ #define sk_ASN1_TYPE_set(a,b,c) ((ASN1_TYPE *) \
+ sk_set((a),(b),(char *)(c)))
+ #define sk_ASN1_TYPE_zero(a) sk_zero(a)
+ #define sk_ASN1_TYPE_push(a,b) sk_push((a),(char *)(b))
+ #define sk_ASN1_TYPE_unshift(a,b) sk_unshift((a),(b))
+ #define sk_ASN1_TYPE_find(a,b) sk_find((a), (char *)(b))
+ #define sk_ASN1_TYPE_delete(a,b) ((ASN1_TYPE *) \
+ sk_delete((a),(b)))
+ #define sk_ASN1_TYPE_delete_ptr(a,b) ((ASN1_TYPE *) \
+ sk_delete_ptr((a),(char *)(b)))
+ #define sk_ASN1_TYPE_insert(a,b,c) sk_insert((a),(char *)(b),(c))
+ #define sk_ASN1_TYPE_set_cmp_func(a,b) ((int (*) \
+ (const ASN1_TYPE * const *,const ASN1_TYPE * const *)) \
+ sk_set_cmp_func((a),(int (*) \
+ (const char * const *, const char * const *))(b)))
+ #define sk_ASN1_TYPE_dup(a) sk_dup(a)
+ #define sk_ASN1_TYPE_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b))
+ #define sk_ASN1_TYPE_shift(a) ((ASN1_TYPE *)sk_shift(a))
+ #define sk_ASN1_TYPE_pop(a) ((ASN1_TYPE *)sk_pop(a))
+ #define sk_ASN1_TYPE_sort(a) sk_sort(a)
+#endif /* !DEBUG_SAFESTACK */
+/* End of perl script block, you may now edit :-) */
DECLARE_ASN1_SET_OF(ASN1_TYPE)
typedef struct asn1_method_st
long length);
DECLARE_STACK_OF(ASN1_OBJECT)
+/* This block of defines is updated by a perl script, please do not touch! */
+#ifndef DEBUG_SAFESTACK
+ #define sk_ASN1_OBJECT_new(a) sk_new((int (*) \
+ (const char * const *, const char * const *))(a))
+ #define sk_ASN1_OBJECT_new_null() sk_new_null()
+ #define sk_ASN1_OBJECT_free(a) sk_free(a)
+ #define sk_ASN1_OBJECT_num(a) sk_num(a)
+ #define sk_ASN1_OBJECT_value(a,b) ((ASN1_OBJECT *) \
+ sk_value((a),(b)))
+ #define sk_ASN1_OBJECT_set(a,b,c) ((ASN1_OBJECT *) \
+ sk_set((a),(b),(char *)(c)))
+ #define sk_ASN1_OBJECT_zero(a) sk_zero(a)
+ #define sk_ASN1_OBJECT_push(a,b) sk_push((a),(char *)(b))
+ #define sk_ASN1_OBJECT_unshift(a,b) sk_unshift((a),(b))
+ #define sk_ASN1_OBJECT_find(a,b) sk_find((a), (char *)(b))
+ #define sk_ASN1_OBJECT_delete(a,b) ((ASN1_OBJECT *) \
+ sk_delete((a),(b)))
+ #define sk_ASN1_OBJECT_delete_ptr(a,b) ((ASN1_OBJECT *) \
+ sk_delete_ptr((a),(char *)(b)))
+ #define sk_ASN1_OBJECT_insert(a,b,c) sk_insert((a),(char *)(b),(c))
+ #define sk_ASN1_OBJECT_set_cmp_func(a,b) ((int (*) \
+ (const ASN1_OBJECT * const *,const ASN1_OBJECT * const *)) \
+ sk_set_cmp_func((a),(int (*) \
+ (const char * const *, const char * const *))(b)))
+ #define sk_ASN1_OBJECT_dup(a) sk_dup(a)
+ #define sk_ASN1_OBJECT_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b))
+ #define sk_ASN1_OBJECT_shift(a) ((ASN1_OBJECT *)sk_shift(a))
+ #define sk_ASN1_OBJECT_pop(a) ((ASN1_OBJECT *)sk_pop(a))
+ #define sk_ASN1_OBJECT_sort(a) sk_sort(a)
+#endif /* !DEBUG_SAFESTACK */
+/* End of perl script block, you may now edit :-) */
DECLARE_ASN1_SET_OF(ASN1_OBJECT)
ASN1_STRING * ASN1_STRING_new(void);
int ASN1_UTCTIME_check(ASN1_UTCTIME *a);
ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t);
int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, char *str);
+time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s);
int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a);
ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t);
ASN1_UTF8STRING *d2i_ASN1_UTF8STRING(ASN1_UTF8STRING **a,
unsigned char **pp,long length);
+ASN1_NULL * ASN1_NULL_new(void);
+void ASN1_NULL_free(ASN1_NULL *a);
+int i2d_ASN1_NULL(ASN1_NULL *a,unsigned char **pp);
+ASN1_NULL *d2i_ASN1_NULL(ASN1_NULL **a, unsigned char **pp,long length);
+
ASN1_BMPSTRING * ASN1_BMPSTRING_new(void);
void ASN1_BMPSTRING_free(ASN1_BMPSTRING *a);
int i2d_ASN1_BMPSTRING(ASN1_BMPSTRING *a, unsigned char **pp);
void ASN1_PRINTABLESTRING_free(ASN1_PRINTABLESTRING *a);
ASN1_PRINTABLESTRING *d2i_ASN1_PRINTABLESTRING(ASN1_PRINTABLESTRING **a,
unsigned char **pp, long l);
+int i2d_ASN1_PRINTABLESTRING(ASN1_PRINTABLESTRING *a, unsigned char **pp);
ASN1_STRING * DIRECTORYSTRING_new(void);
void DIRECTORYSTRING_free(ASN1_STRING *a);
STACK *ASN1_seq_unpack(unsigned char *buf, int len, char *(*d2i)(),
void (*free_func)() );
unsigned char *ASN1_seq_pack(STACK *safes, int (*i2d)(), unsigned char **buf,
- int *len );
+ int *len );
void *ASN1_unpack_string(ASN1_STRING *oct, char *(*d2i)());
ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_OCTET_STRING **oct);
ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out,
const unsigned char *in, int inlen, int inform, int nid);
ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid);
+int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long);
void ASN1_STRING_TABLE_cleanup(void);
/* BEGIN ERROR CODES */
#define ASN1_F_D2I_ASN1_GENERALIZEDTIME 223
#define ASN1_F_D2I_ASN1_HEADER 127
#define ASN1_F_D2I_ASN1_INTEGER 128
+#define ASN1_F_D2I_ASN1_NULL 292
#define ASN1_F_D2I_ASN1_OBJECT 129
#define ASN1_F_D2I_ASN1_OCTET_STRING 130
#define ASN1_F_D2I_ASN1_PRINT_TYPE 131
#define ASN1_R_BN_LIB 107
#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 108
#define ASN1_R_BUFFER_TOO_SMALL 109
+#define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 166
#define ASN1_R_DATA_IS_WRONG 110
#define ASN1_R_DECODE_ERROR 155
#define ASN1_R_DECODING_ERROR 111
#define ASN1_R_EXPECTING_A_BIT_STRING 116
#define ASN1_R_EXPECTING_A_BOOLEAN 117
#define ASN1_R_EXPECTING_A_GENERALIZEDTIME 151
+#define ASN1_R_EXPECTING_A_NULL 164
#define ASN1_R_EXPECTING_A_TIME 152
#define ASN1_R_EXPECTING_A_UTCTIME 118
#define ASN1_R_FIRST_NUM_TOO_LARGE 119
#define ASN1_R_MISSING_SECOND_NUMBER 126
#define ASN1_R_NON_HEX_CHARACTERS 127
#define ASN1_R_NOT_ENOUGH_DATA 128
+#define ASN1_R_NULL_IS_WRONG_LENGTH 165
#define ASN1_R_ODD_NUMBER_OF_CHARS 129
#define ASN1_R_PARSING 130
#define ASN1_R_PRIVATE_KEY_HEADER_MISSING 131