Some new names in asn1.h are longer than 31 chars, which disturbs the VMS C compilers...
[openssl.git] / crypto / asn1 / asn1.h
index 832611b7138f88657ec8a840f2d241625f84223a..1c3a4600cded0c762a7de7b082096647d03b0ab1 100644 (file)
@@ -68,6 +68,10 @@ extern "C" {
 #include <openssl/stack.h>
 #include <openssl/safestack.h>
 
+#ifdef VMS
+#include <openssl/vms_idhacks.h>
+#endif
+
 #define V_ASN1_UNIVERSAL               0x00
 #define        V_ASN1_APPLICATION              0x40
 #define V_ASN1_CONTEXT_SPECIFIC                0x80
@@ -130,10 +134,11 @@ extern "C" {
 #define B_ASN1_UTF8STRING      0x2000
 
 /* For use with ASN1_mbstring_copy() */
-#define MBSTRING_ASC           1
-#define MBSTRING_BMP           2
-#define MBSTRING_UNIV          3
-#define MBSTRING_UTF8          4
+#define MBSTRING_FLAG          0x1000
+#define MBSTRING_ASC           (MBSTRING_FLAG|1)
+#define MBSTRING_BMP           (MBSTRING_FLAG|2)
+#define MBSTRING_UNIV          (MBSTRING_FLAG|3)
+#define MBSTRING_UTF8          (MBSTRING_FLAG|4)
 
 #define DECLARE_ASN1_SET_OF(type) \
 int i2d_ASN1_SET_OF_##type(STACK_OF(type) *a,unsigned char **pp, \
@@ -206,6 +211,29 @@ typedef struct asn1_string_st
        long flags;
        } ASN1_STRING;
 
+#define STABLE_FLAGS_MALLOC    0x01
+
+typedef struct asn1_string_table_st {
+       int nid;
+       long minsize;
+       long maxsize;
+       unsigned long mask;
+       unsigned long flags;
+} ASN1_STRING_TABLE;
+
+DECLARE_STACK_OF(ASN1_STRING_TABLE)
+
+/* size limits: this stuff is taken straight from RFC2459 */
+
+#define ub_name                                32768
+#define ub_common_name                 64
+#define ub_locality_name               128
+#define ub_state_name                  128
+#define ub_organization_name           64
+#define ub_organization_unit_name      64
+#define ub_title                       64
+#define ub_email_address               128
+
 #ifndef DEBUG
 #define ASN1_INTEGER           ASN1_STRING
 #define ASN1_ENUMERATED                ASN1_STRING
@@ -287,6 +315,14 @@ typedef struct asn1_header_st
        ASN1_METHOD *meth;
        } ASN1_HEADER;
 
+/* This is used to contain a list of bit names */
+typedef struct BIT_STRING_BITNAME_st {
+       int bitnum;
+       const char *lname;
+       const char *sname;
+} BIT_STRING_BITNAME;
+
+
 #define M_ASN1_STRING_length(x)        ((x)->length)
 #define M_ASN1_STRING_length_set(x, n) ((x)->length = (n))
 #define M_ASN1_STRING_type(x)  ((x)->type)
@@ -507,6 +543,13 @@ int                ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d,
 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);
 
+#ifdef HEADER_BIO_H
+int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
+                               BIT_STRING_BITNAME *tbl, int indent);
+#endif
+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,unsigned char **pp,long length);
@@ -563,7 +606,7 @@ ASN1_BMPSTRING *d2i_ASN1_BMPSTRING(ASN1_BMPSTRING **a, unsigned char **pp,
        long length);
 
 
-int UTF8_getc(unsigned char *str, int len, unsigned long *val);
+int UTF8_getc(const unsigned char *str, int len, unsigned long *val);
 int UTF8_putc(unsigned char *str, int len, unsigned long value);
 
 int i2d_ASN1_PRINTABLE(ASN1_STRING *a,unsigned char **pp);
@@ -718,8 +761,21 @@ unsigned char *ASN1_seq_pack(STACK *safes, int (*i2d)(), unsigned char **buf,
                                                                 int *len );
 void *ASN1_unpack_string(ASN1_STRING *oct, char *(*d2i)());
 ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_OCTET_STRING **oct);
-int ASN1_mbstring_copy(ASN1_STRING **out, unsigned char *in, int len,
+
+void ASN1_STRING_set_default_mask(unsigned long mask);
+int ASN1_STRING_set_default_mask_asc(char *p);
+unsigned long ASN1_STRING_get_default_mask(void);
+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, int len,
+                                       int inform, unsigned long mask, 
+                                       long minsize, long maxsize);
+
+ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, 
+               const unsigned char *in, int inlen, int inform, int nid);
+int ASN1_STRING_TABLE_add_standard(void);
+ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid);
+void ASN1_STRING_TABLE_cleanup(void);
 
 /* BEGIN ERROR CODES */
 /* The following lines are auto generated by the script mkerr.pl. Any changes
@@ -754,6 +810,8 @@ int ASN1_mbstring_copy(ASN1_STRING **out, unsigned char *in, int len,
 #define ASN1_F_ASN1_SEQ_UNPACK                          247
 #define ASN1_F_ASN1_SIGN                                114
 #define ASN1_F_ASN1_STRING_NEW                          115
+#define ASN1_F_ASN1_STRING_TABLE_ADD                    283
+#define ASN1_F_ASN1_STRING_TABLE_ADD_STANDARD           284
 #define ASN1_F_ASN1_STRING_TYPE_NEW                     116
 #define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING            117
 #define ASN1_F_ASN1_TYPE_GET_OCTETSTRING                118
@@ -831,6 +889,7 @@ int ASN1_mbstring_copy(ASN1_STRING **out, unsigned char *in, int len,
 #define ASN1_F_D2I_X509                                         159
 #define ASN1_F_D2I_X509_ALGOR                           160
 #define ASN1_F_D2I_X509_ATTRIBUTE                       161
+#define ASN1_F_D2I_X509_CERT_AUX                        285
 #define ASN1_F_D2I_X509_CINF                            162
 #define ASN1_F_D2I_X509_CRL                             163
 #define ASN1_F_D2I_X509_CRL_INFO                        164
@@ -894,6 +953,7 @@ int ASN1_mbstring_copy(ASN1_STRING **out, unsigned char *in, int len,
 #define ASN1_F_USERNOTICE_NEW                           275
 #define ASN1_F_X509_ALGOR_NEW                           202
 #define ASN1_F_X509_ATTRIBUTE_NEW                       203
+#define ASN1_F_X509_CERT_AUX_NEW                        286
 #define ASN1_F_X509_CINF_NEW                            204
 #define ASN1_F_X509_CRL_INFO_NEW                        205
 #define ASN1_F_X509_CRL_NEW                             206
@@ -959,6 +1019,7 @@ int ASN1_mbstring_copy(ASN1_STRING **out, unsigned char *in, int len,
 #define ASN1_R_PRIVATE_KEY_HEADER_MISSING               131
 #define ASN1_R_SECOND_NUMBER_TOO_LARGE                  132
 #define ASN1_R_SHORT_LINE                               133
+#define ASN1_R_STRING_TOO_LONG                          163
 #define ASN1_R_STRING_TOO_SHORT                                 134
 #define ASN1_R_TAG_VALUE_TOO_HIGH                       135
 #define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 136