More X509_ATTRIBUTE changes.
[openssl.git] / crypto / asn1 / asn1.h
index 2a7da6bf4b8fc0c90c9f49c3bd42c94c81e8a2f2..cebbcd37375277dce67cb8b0b3c1a53c18e3e751 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
@@ -208,6 +212,10 @@ typedef struct asn1_string_st
        } 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;
@@ -264,6 +272,8 @@ typedef struct asn1_string_st ASN1_VISIBLESTRING;
 typedef struct asn1_string_st ASN1_UTF8STRING;
 #endif
 
+typedef int ASN1_NULL;
+
 typedef struct asn1_type_st
        {
        int type;
@@ -311,6 +321,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)
@@ -531,6 +549,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);
@@ -580,6 +605,11 @@ int                i2d_ASN1_UTF8STRING(ASN1_UTF8STRING *a,unsigned char **pp);
 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);
@@ -598,6 +628,7 @@ ASN1_PRINTABLESTRING *      ASN1_PRINTABLESTRING_new(void);
 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);
@@ -744,6 +775,7 @@ void *ASN1_unpack_string(ASN1_STRING *oct, char *(*d2i)());
 ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_OCTET_STRING **oct);
 
 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);
@@ -753,7 +785,6 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
 
 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);
 
@@ -769,6 +800,7 @@ void ASN1_STRING_TABLE_cleanup(void);
 #define ASN1_F_A2I_ASN1_ENUMERATED                      236
 #define ASN1_F_A2I_ASN1_INTEGER                                 101
 #define ASN1_F_A2I_ASN1_STRING                          102
+#define ASN1_F_ACCESS_DESCRIPTION_NEW                   291
 #define ASN1_F_ASN1_COLLATE_PRIMITIVE                   103
 #define ASN1_F_ASN1_D2I_BIO                             104
 #define ASN1_F_ASN1_D2I_FP                              105
@@ -791,7 +823,6 @@ void ASN1_STRING_TABLE_cleanup(void);
 #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
@@ -803,6 +834,7 @@ void ASN1_STRING_TABLE_cleanup(void);
 #define ASN1_F_BASIC_CONSTRAINTS_NEW                    226
 #define ASN1_F_BN_TO_ASN1_ENUMERATED                    234
 #define ASN1_F_BN_TO_ASN1_INTEGER                       122
+#define ASN1_F_D2I_ACCESS_DESCRIPTION                   284
 #define ASN1_F_D2I_ASN1_BIT_STRING                      123
 #define ASN1_F_D2I_ASN1_BMPSTRING                       124
 #define ASN1_F_D2I_ASN1_BOOLEAN                                 125
@@ -811,6 +843,7 @@ void ASN1_STRING_TABLE_cleanup(void);
 #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
@@ -838,6 +871,7 @@ void ASN1_STRING_TABLE_cleanup(void);
 #define ASN1_F_D2I_NETSCAPE_SPKAC                       143
 #define ASN1_F_D2I_NETSCAPE_SPKI                        144
 #define ASN1_F_D2I_NOTICEREF                            268
+#define ASN1_F_D2I_OTHERNAME                            287
 #define ASN1_F_D2I_PBE2PARAM                            262
 #define ASN1_F_D2I_PBEPARAM                             249
 #define ASN1_F_D2I_PBKDF2PARAM                          263
@@ -869,6 +903,7 @@ void ASN1_STRING_TABLE_cleanup(void);
 #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
@@ -892,12 +927,14 @@ void ASN1_STRING_TABLE_cleanup(void);
 #define ASN1_F_I2D_DSAPARAMS                            178
 #define ASN1_F_I2D_DSAPRIVATEKEY                        179
 #define ASN1_F_I2D_DSAPUBLICKEY                                 180
+#define ASN1_F_I2D_DSA_PUBKEY                           290
 #define ASN1_F_I2D_NETSCAPE_RSA                                 181
 #define ASN1_F_I2D_PKCS7                                182
 #define ASN1_F_I2D_PRIVATEKEY                           183
 #define ASN1_F_I2D_PUBLICKEY                            184
 #define ASN1_F_I2D_RSAPRIVATEKEY                        185
 #define ASN1_F_I2D_RSAPUBLICKEY                                 186
+#define ASN1_F_I2D_RSA_PUBKEY                           289
 #define ASN1_F_I2D_X509_ATTRIBUTE                       187
 #define ASN1_F_I2T_ASN1_OBJECT                          188
 #define ASN1_F_NETSCAPE_CERT_SEQUENCE_NEW               229
@@ -905,6 +942,7 @@ void ASN1_STRING_TABLE_cleanup(void);
 #define ASN1_F_NETSCAPE_SPKAC_NEW                       190
 #define ASN1_F_NETSCAPE_SPKI_NEW                        191
 #define ASN1_F_NOTICEREF_NEW                            272
+#define ASN1_F_OTHERNAME_NEW                            288
 #define ASN1_F_PBE2PARAM_NEW                            264
 #define ASN1_F_PBEPARAM_NEW                             251
 #define ASN1_F_PBKDF2PARAM_NEW                          265
@@ -932,6 +970,7 @@ void ASN1_STRING_TABLE_cleanup(void);
 #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
@@ -962,6 +1001,7 @@ void ASN1_STRING_TABLE_cleanup(void);
 #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
@@ -975,6 +1015,7 @@ void ASN1_STRING_TABLE_cleanup(void);
 #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
@@ -992,6 +1033,7 @@ void ASN1_STRING_TABLE_cleanup(void);
 #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