Fix error codes.
[openssl.git] / crypto / asn1 / asn1.h
index b2dc58a0d757a371e5b53a35e568d43646a4f6ea..33a41d79b12777d4bfdf3e3915d14e74f40d4c24 100644 (file)
@@ -180,7 +180,7 @@ typedef struct asn1_ctx_st
        int inf;        /* constructed if 0x20, indefinite is 0x21 */
        int tag;        /* tag from last 'get object' */
        int xclass;     /* class from last 'get object' */
-       size_t slen;    /* length of last 'get object' */
+       long slen;      /* length of last 'get object' */
        unsigned char *max; /* largest value of p allowed */
        unsigned char *q;/* temporary variable */
        unsigned char **pp;/* variable */
@@ -195,7 +195,7 @@ typedef struct asn1_const_ctx_st
        int inf;        /* constructed if 0x20, indefinite is 0x21 */
        int tag;        /* tag from last 'get object' */
        int xclass;     /* class from last 'get object' */
-       size_t slen;    /* length of last 'get object' */
+       long slen;      /* length of last 'get object' */
        const unsigned char *max; /* largest value of p allowed */
        const unsigned char *q;/* temporary variable */
        const unsigned char **pp;/* variable */
@@ -212,7 +212,7 @@ typedef struct asn1_object_st
        {
        const char *sn,*ln;
        int nid;
-       size_t length;
+       int length;
        const unsigned char *data;      /* data remains const after init */
        int flags;      /* Should we free this one */
        } ASN1_OBJECT;
@@ -230,10 +230,14 @@ typedef struct asn1_object_st
  */
 
 #define ASN1_STRING_FLAG_CONT 0x020 
+/* This flag is used by ASN1 code to indicate an ASN1_STRING is an MSTRING
+ * type.
+ */
+#define ASN1_STRING_FLAG_MSTRING 0x040 
 /* This is the base type that holds just about everything :-) */
-typedef struct asn1_string_st
+struct asn1_string_st
        {
-       size_t length;
+       int length;
        int type;
        unsigned char *data;
        /* The value of the following field depends on the type being
@@ -241,7 +245,7 @@ typedef struct asn1_string_st
         * input data has a non-zero 'unused bits' value, it will be
         * handled correctly */
        long flags;
-       } ASN1_STRING;
+       };
 
 /* ASN1_ENCODING structure: this is used to save the received
  * encoding of an ASN1 type. This is useful to get round
@@ -251,7 +255,7 @@ typedef struct asn1_string_st
 typedef struct ASN1_ENCODING_st
        {
        unsigned char *enc;     /* DER encoding */
-       size_t len;             /* Length of encoding */
+       long len;               /* Length of encoding */
        int modified;            /* set to 1 if 'enc' is invalid */
        } ASN1_ENCODING;
 
@@ -289,7 +293,6 @@ DECLARE_STACK_OF(ASN1_STRING_TABLE)
  * see asn1t.h
  */
 typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE;
-typedef struct ASN1_ITEM_st ASN1_ITEM;
 typedef struct ASN1_TLC_st ASN1_TLC;
 /* This is just an opaque pointer */
 typedef struct ASN1_VALUE_st ASN1_VALUE;
@@ -310,12 +313,12 @@ typedef struct ASN1_VALUE_st ASN1_VALUE;
        DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name)
 
 #define        DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \
-       type *d2i_##name(type **a, const unsigned char **in, size_t len); \
+       type *d2i_##name(type **a, const unsigned char **in, long len); \
        int i2d_##name(type *a, unsigned char **out); \
        DECLARE_ASN1_ITEM(itname)
 
 #define        DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \
-       type *d2i_##name(type **a, const unsigned char **in, size_t len); \
+       type *d2i_##name(type **a, const unsigned char **in, long len); \
        int i2d_##name(const type *a, unsigned char **out); \
        DECLARE_ASN1_ITEM(name)
 
@@ -337,7 +340,7 @@ typedef struct ASN1_VALUE_st ASN1_VALUE;
        int fname##_print_ctx(BIO *out, stname *x, int indent, \
                                         const ASN1_PCTX *pctx);
 
-#define D2I_OF(type) type *(*)(type **,const unsigned char **,size_t)
+#define D2I_OF(type) type *(*)(type **,const unsigned char **,long)
 #define I2D_OF(type) int (*)(type *,unsigned char **)
 #define I2D_OF_const(type) int (*)(const type *,unsigned char **)
 
@@ -352,7 +355,7 @@ typedef struct ASN1_VALUE_st ASN1_VALUE;
 #define CHECKED_PPTR_OF(type, p) \
     ((void**) (1 ? p : (type**)0))
 
-#define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,size_t)
+#define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long)
 #define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **)
 #define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type)
 
@@ -616,6 +619,7 @@ typedef struct BIT_STRING_BITNAME_st {
                        B_ASN1_GENERALIZEDTIME
 
 #define B_ASN1_PRINTABLE \
+                       B_ASN1_NUMERICSTRING| \
                        B_ASN1_PRINTABLESTRING| \
                        B_ASN1_T61STRING| \
                        B_ASN1_IA5STRING| \
@@ -778,9 +782,9 @@ ASN1_OBJECT *       ASN1_OBJECT_new(void );
 void           ASN1_OBJECT_free(ASN1_OBJECT *a);
 int            i2d_ASN1_OBJECT(ASN1_OBJECT *a,unsigned char **pp);
 ASN1_OBJECT *  c2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp,
-                               size_t length);
+                       long length);
 ASN1_OBJECT *  d2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp,
-                               size_t length);
+                       long length);
 
 DECLARE_ASN1_ITEM(ASN1_OBJECT)
 
@@ -795,24 +799,23 @@ ASN1_STRING *     ASN1_STRING_type_new(int type );
 int            ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b);
   /* Since this is used to store all sorts of things, via macros, for now, make
      its data void * */
-int            ASN1_STRING_set(ASN1_STRING *str, const void *data, size_t len);
-void           ASN1_STRING_set0(ASN1_STRING *str, void *data, size_t len);
-size_t ASN1_STRING_length(const ASN1_STRING *x);
-void ASN1_STRING_length_set(ASN1_STRING *x, size_t n);
+int            ASN1_STRING_set(ASN1_STRING *str, const void *data, int len);
+void           ASN1_STRING_set0(ASN1_STRING *str, void *data, int len);
+int ASN1_STRING_length(const ASN1_STRING *x);
+void ASN1_STRING_length_set(ASN1_STRING *x, int n);
 int ASN1_STRING_type(ASN1_STRING *x);
 unsigned char * ASN1_STRING_data(ASN1_STRING *x);
 
 DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING)
 int            i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp);
-ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
-                                    const unsigned char **pp, size_t length);
+ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,const unsigned char **pp,
+                       long length);
 int            ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d,
-                                   size_t length);
-int            ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, size_t n,
-                                       int value);
-int            ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, size_t n);
-int             ASN1_BIT_STRING_check(ASN1_BIT_STRING *a,
-                                     unsigned char *flags, size_t flags_len);
+                       int length );
+int            ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);
+int            ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n);
+int            ASN1_BIT_STRING_check(ASN1_BIT_STRING *a,
+                                     unsigned char *flags, int flags_len);
 
 #ifndef OPENSSL_NO_BIO
 int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
@@ -822,21 +825,21 @@ int ASN1_BIT_STRING_num_asc(char *name, BIT_STRING_BITNAME *tbl);
 int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value,
                                BIT_STRING_BITNAME *tbl);
 
-int i2d_ASN1_BOOLEAN(int a, unsigned char **pp);
-int d2i_ASN1_BOOLEAN(int *a, const unsigned char **pp, size_t length);
+int            i2d_ASN1_BOOLEAN(int a,unsigned char **pp);
+int            d2i_ASN1_BOOLEAN(int *a,const unsigned char **pp,long length);
 
 DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER)
 int            i2c_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp);
 ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,const unsigned char **pp,
-                              size_t length);
+                       long length);
 ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,const unsigned char **pp,
-                               size_t length);
+                       long length);
 ASN1_INTEGER * ASN1_INTEGER_dup(const ASN1_INTEGER *x);
 int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y);
 
 DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED)
 
-int ASN1_UTCTIME_check(ASN1_UTCTIME *a);
+int ASN1_UTCTIME_check(const ASN1_UTCTIME *a);
 ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t);
 ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
                                int offset_day, long offset_sec);
@@ -846,7 +849,7 @@ int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t);
 time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s);
 #endif
 
-int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a);
+int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *a);
 ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t);
 ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,
             time_t t, int offset_day, long offset_sec);
@@ -855,8 +858,7 @@ int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str);
 DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING)
 ASN1_OCTET_STRING *    ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a);
 int    ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, const ASN1_OCTET_STRING *b);
-int    ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data,
-                             size_t len);
+int    ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, int len);
 
 DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING)
 DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING)
@@ -864,8 +866,8 @@ DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING)
 DECLARE_ASN1_FUNCTIONS(ASN1_NULL)
 DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING)
 
-int UTF8_getc(const unsigned char *str, size_t len, unsigned long *val);
-int UTF8_putc(unsigned char *str, size_t len, unsigned long value);
+int UTF8_getc(const unsigned char *str, int len, unsigned long *val);
+int UTF8_putc(unsigned char *str, int len, unsigned long value);
 
 DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE)
 
@@ -884,15 +886,17 @@ DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF)
 ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t);
 ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s,time_t t,
                                int offset_day, long offset_sec);
-int ASN1_TIME_check(ASN1_TIME *t);
+int ASN1_TIME_check(const ASN1_TIME *t);
 ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out);
-
-size_t i2d_ASN1_SET(STACK_OF(BLOCK) *a, unsigned char **pp,
-                   i2d_of_void *i2d, int ex_tag, int ex_class,
-                   int is_set);
-STACK_OF(BLOCK) *d2i_ASN1_SET(STACK_OF(BLOCK) **a, const unsigned char **pp,
-                             size_t length, d2i_of_void *d2i,
-                             void (*free_func)(BLOCK), int ex_tag,
+int ASN1_TIME_set_string(ASN1_TIME *s, const char *str);
+
+int i2d_ASN1_SET(STACK_OF(OPENSSL_BLOCK) *a, unsigned char **pp,
+                i2d_of_void *i2d, int ex_tag, int ex_class,
+                int is_set);
+STACK_OF(OPENSSL_BLOCK) *d2i_ASN1_SET(STACK_OF(OPENSSL_BLOCK) **a,
+                             const unsigned char **pp,
+                             long length, d2i_of_void *d2i,
+                             void (*free_func)(OPENSSL_BLOCK), int ex_tag,
                              int ex_class);
 
 #ifndef OPENSSL_NO_BIO
@@ -904,12 +908,11 @@ int i2a_ASN1_OBJECT(BIO *bp,ASN1_OBJECT *a);
 int a2i_ASN1_STRING(BIO *bp,ASN1_STRING *bs,char *buf,int size);
 int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type);
 #endif
-int i2t_ASN1_OBJECT(char *buf,size_t buf_len,ASN1_OBJECT *a);
+int i2t_ASN1_OBJECT(char *buf,int buf_len,ASN1_OBJECT *a);
 
-size_t a2d_ASN1_OBJECT(unsigned char *out, size_t olen, const char *buf,
-                      int num);
-ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, size_t len,
-                               const char *sn, const char *ln);
+int a2d_ASN1_OBJECT(unsigned char *out,int olen, const char *buf, int num);
+ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len,
+       const char *sn, const char *ln);
 
 int ASN1_INTEGER_set(ASN1_INTEGER *a, long v);
 long ASN1_INTEGER_get(const ASN1_INTEGER *a);
@@ -923,32 +926,32 @@ BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai,BIGNUM *bn);
 
 /* General */
 /* given a string, return the correct type, max is the maximum length */
-int ASN1_PRINTABLE_type(const unsigned char *s, size_t max);
+int ASN1_PRINTABLE_type(const unsigned char *s, int max);
 
 int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass);
 ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp,
-                           size_t length, int Ptag, int Pclass);
+       long length, int Ptag, int Pclass);
 unsigned long ASN1_tag2bit(int tag);
 /* type is one or more of the B_ASN1_ values. */
 ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a,const unsigned char **pp,
-                                size_t length,int type);
+               long length,int type);
 
 /* PARSING */
 int asn1_Finish(ASN1_CTX *c);
 int asn1_const_Finish(ASN1_const_CTX *c);
 
 /* SPECIALS */
-int ASN1_get_object(const unsigned char **pp, size_t *plength, int *ptag,
-                   int *pclass, size_t omax);
-int ASN1_check_infinite_end(unsigned char **p, size_t len);
-int ASN1_const_check_infinite_end(const unsigned char **p, size_t len);
-void ASN1_put_object(unsigned char **pp, int constructed, size_t length,
-                    int tag, int xclass);
+int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
+       int *pclass, long omax);
+int ASN1_check_infinite_end(unsigned char **p,long len);
+int ASN1_const_check_infinite_end(const unsigned char **p,long len);
+void ASN1_put_object(unsigned char **pp, int constructed, int length,
+       int tag, int xclass);
 int ASN1_put_eoc(unsigned char **pp);
-size_t ASN1_object_size(int constructed, size_t length, int tag);
+int ASN1_object_size(int constructed, int length, int tag);
 
 /* Used to implement other functions */
-void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x);
+void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x);
 
 #define ASN1_dup_of(type,i2d,d2i,x) \
     ((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \
@@ -1026,9 +1029,8 @@ int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v);
 int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags);
 int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num,
                                unsigned char *buf, int off);
-int ASN1_parse(BIO *bp, const unsigned char *pp, size_t len, int indent);
-int ASN1_parse_dump(BIO *bp, const unsigned char *pp, size_t len, int indent,
-                   int dump);
+int ASN1_parse(BIO *bp,const unsigned char *pp,long len,int indent);
+int ASN1_parse_dump(BIO *bp,const unsigned char *pp,long len,int indent,int dump);
 #endif
 const char *ASN1_tag2str(int tag);
 
@@ -1039,24 +1041,24 @@ DECLARE_ASN1_FUNCTIONS(NETSCAPE_X509)
 int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s);
 
 int ASN1_TYPE_set_octetstring(ASN1_TYPE *a,
-       unsigned char *data, size_t len);
+       unsigned char *data, int len);
 int ASN1_TYPE_get_octetstring(ASN1_TYPE *a,
-       unsigned char *data, size_t max_len);
+       unsigned char *data, int max_len);
 int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num,
-       unsigned char *data, size_t len);
-int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num,
-       unsigned char *data, size_t max_len);
-
-STACK_OF(BLOCK) *ASN1_seq_unpack(const unsigned char *buf, size_t len,
-                                d2i_of_void *d2i, void (*free_func)(BLOCK));
-unsigned char *ASN1_seq_pack(STACK_OF(BLOCK) *safes, i2d_of_void *i2d,
-                            unsigned char **buf, size_t *len);
+       unsigned char *data, int len);
+int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num,
+       unsigned char *data, int max_len);
+
+STACK_OF(OPENSSL_BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len,
+                                d2i_of_void *d2i, void (*free_func)(OPENSSL_BLOCK));
+unsigned char *ASN1_seq_pack(STACK_OF(OPENSSL_BLOCK) *safes, i2d_of_void *i2d,
+                            unsigned char **buf, int *len );
 void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i);
 void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it);
 ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d,
                              ASN1_OCTET_STRING **oct);
 
-#define ASN1_pack_string_of(type,obj,i2d,oct)   \
+#define ASN1_pack_string_of(type,obj,i2d,oct) \
     (ASN1_pack_string(CHECKED_PTR_OF(type, obj), \
                      CHECKED_I2D_OF(type, i2d), \
                      oct))
@@ -1064,17 +1066,16 @@ ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d,
 ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct);
 
 void ASN1_STRING_set_default_mask(unsigned long mask);
-int ASN1_STRING_set_default_mask_asc(char *p);
+int ASN1_STRING_set_default_mask_asc(const char *p);
 unsigned long ASN1_STRING_get_default_mask(void);
-int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, size_t len,
+int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len,
                                        int inform, unsigned long mask);
-int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, size_t len,
+int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
                                        int inform, unsigned long mask, 
-                                       size_t minsize, size_t maxsize);
+                                       long minsize, long maxsize);
 
 ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, 
-                                   const unsigned char *in, size_t inlen,
-                                   int inform, int nid);
+               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);
@@ -1084,11 +1085,9 @@ void ASN1_STRING_TABLE_cleanup(void);
 /* Old API compatible functions */
 ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it);
 void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it);
-ASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in,
-                          size_t len, const ASN1_ITEM *it);
+ASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, long len, const ASN1_ITEM *it);
 int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
-int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out,
-                      const ASN1_ITEM *it);
+int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
 
 void ASN1_add_oid_module(void);
 
@@ -1131,6 +1130,14 @@ void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags);
 unsigned long ASN1_PCTX_get_str_flags(ASN1_PCTX *p);
 void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags);
 
+ASN1_SCTX *ASN1_SCTX_new(int (*scan_cb)(ASN1_SCTX *ctx));
+void ASN1_SCTX_free(ASN1_SCTX *p);
+const ASN1_ITEM *ASN1_SCTX_get_item(ASN1_SCTX *p);
+const ASN1_TEMPLATE * ASN1_SCTX_get_template(ASN1_SCTX *p);
+unsigned long ASN1_SCTX_get_flags(ASN1_SCTX *p);
+void ASN1_SCTX_set_app_data(ASN1_SCTX *p, void *data);
+void *ASN1_SCTX_get_app_data(ASN1_SCTX *p);
+
 BIO_METHOD *BIO_f_asn1(void);
 
 BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it);
@@ -1177,6 +1184,7 @@ void ERR_load_ASN1_strings(void);
 #define ASN1_F_ASN1_ENUMERATED_TO_BN                    113
 #define ASN1_F_ASN1_EX_C2I                              204
 #define ASN1_F_ASN1_FIND_END                            190
+#define ASN1_F_ASN1_GENERALIZEDTIME_ADJ                         216
 #define ASN1_F_ASN1_GENERALIZEDTIME_SET                         185
 #define ASN1_F_ASN1_GENERATE_V3                                 178
 #define ASN1_F_ASN1_GET_OBJECT                          114
@@ -1193,6 +1201,7 @@ void ERR_load_ASN1_strings(void);
 #define ASN1_F_ASN1_ITEM_I2D_FP                                 193
 #define ASN1_F_ASN1_ITEM_PACK                           198
 #define ASN1_F_ASN1_ITEM_SIGN                           195
+#define ASN1_F_ASN1_ITEM_SIGN_CTX                       220
 #define ASN1_F_ASN1_ITEM_UNPACK                                 199
 #define ASN1_F_ASN1_ITEM_VERIFY                                 197
 #define ASN1_F_ASN1_MBSTRING_NCOPY                      122
@@ -1201,6 +1210,7 @@ void ERR_load_ASN1_strings(void);
 #define ASN1_F_ASN1_PACK_STRING                                 124
 #define ASN1_F_ASN1_PCTX_NEW                            205
 #define ASN1_F_ASN1_PKCS5_PBE_SET                       125
+#define ASN1_F_ASN1_SCTX_NEW                            221
 #define ASN1_F_ASN1_SEQ_PACK                            126
 #define ASN1_F_ASN1_SEQ_UNPACK                          127
 #define ASN1_F_ASN1_SIGN                                128
@@ -1211,10 +1221,12 @@ void ERR_load_ASN1_strings(void);
 #define ASN1_F_ASN1_TEMPLATE_EX_D2I                     132
 #define ASN1_F_ASN1_TEMPLATE_NEW                        133
 #define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I                  131
+#define ASN1_F_ASN1_TIME_ADJ                            217
 #define ASN1_F_ASN1_TIME_SET                            175
 #define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING            134
 #define ASN1_F_ASN1_TYPE_GET_OCTETSTRING                135
 #define ASN1_F_ASN1_UNPACK_STRING                       136
+#define ASN1_F_ASN1_UTCTIME_ADJ                                 218
 #define ASN1_F_ASN1_UTCTIME_SET                                 187
 #define ASN1_F_ASN1_VERIFY                              137
 #define ASN1_F_B64_READ_ASN1                            209
@@ -1263,6 +1275,7 @@ void ERR_load_ASN1_strings(void);
 #define ASN1_F_PKCS5_PBE2_SET_IV                        167
 #define ASN1_F_PKCS5_PBE_SET                            202
 #define ASN1_F_PKCS5_PBE_SET0_ALGOR                     215
+#define ASN1_F_PKCS5_PBKDF2_SET                                 219
 #define ASN1_F_SMIME_READ_ASN1                          212
 #define ASN1_F_SMIME_TEXT                               213
 #define ASN1_F_X509_CINF_NEW                            168
@@ -1283,10 +1296,12 @@ void ERR_load_ASN1_strings(void);
 #define ASN1_R_BAD_OBJECT_HEADER                        102
 #define ASN1_R_BAD_PASSWORD_READ                        103
 #define ASN1_R_BAD_TAG                                  104
+#define ASN1_R_BMPSTRING_IS_WRONG_LENGTH                214
 #define ASN1_R_BN_LIB                                   105
 #define ASN1_R_BOOLEAN_IS_WRONG_LENGTH                  106
 #define ASN1_R_BUFFER_TOO_SMALL                                 107
 #define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER          108
+#define ASN1_R_CONTEXT_NOT_INITIALISED                  217
 #define ASN1_R_DATA_IS_WRONG                            109
 #define ASN1_R_DECODE_ERROR                             110
 #define ASN1_R_DECODING_ERROR                           111
@@ -1328,6 +1343,7 @@ void ERR_load_ASN1_strings(void);
 #define ASN1_R_INVALID_MIME_TYPE                        205
 #define ASN1_R_INVALID_MODIFIER                                 186
 #define ASN1_R_INVALID_NUMBER                           187
+#define ASN1_R_INVALID_OBJECT_ENCODING                  216
 #define ASN1_R_INVALID_SEPARATOR                        131
 #define ASN1_R_INVALID_TIME_FORMAT                      132
 #define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH           133
@@ -1374,6 +1390,7 @@ void ERR_load_ASN1_strings(void);
 #define ASN1_R_UNABLE_TO_DECODE_RSA_KEY                         157
 #define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY                 158
 #define ASN1_R_UNEXPECTED_EOC                           159
+#define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH          215
 #define ASN1_R_UNKNOWN_FORMAT                           160
 #define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM                 161
 #define ASN1_R_UNKNOWN_OBJECT_TYPE                      162