Merge changes to build system from fips branch.
[oweals/openssl.git] / crypto / x509 / x509.h
index 46673fddd138493607a9d3ddf2bd33790c2bbd5c..e71b5257e576135c544e353ad86cc08a2d09ae54 100644 (file)
@@ -136,8 +136,8 @@ extern "C" {
 typedef struct X509_objects_st
        {
        int nid;
-       int (*a2i)();
-       int (*i2a)();
+       int (*a2i)(void);
+       int (*i2a)(void);
        } X509_OBJECTS;
 
 struct X509_algor_st
@@ -146,9 +146,10 @@ struct X509_algor_st
        ASN1_TYPE *parameter;
        } /* X509_ALGOR */;
 
-DECLARE_STACK_OF(X509_ALGOR)
 DECLARE_ASN1_SET_OF(X509_ALGOR)
 
+typedef STACK_OF(X509_ALGOR) X509_ALGORS;
+
 typedef struct X509_val_st
        {
        ASN1_TIME *notBefore;
@@ -203,6 +204,8 @@ typedef struct X509_extension_st
        ASN1_OCTET_STRING *value;
        } X509_EXTENSION;
 
+typedef STACK_OF(X509_EXTENSION) X509_EXTENSIONS;
+
 DECLARE_STACK_OF(X509_EXTENSION)
 DECLARE_ASN1_SET_OF(X509_EXTENSION)
 
@@ -288,6 +291,10 @@ struct x509_st
        ASN1_OCTET_STRING *skid;
        struct AUTHORITY_KEYID_st *akid;
        X509_POLICY_CACHE *policy_cache;
+#ifndef OPENSSL_NO_RFC3779
+       STACK_OF(IPAddressFamily) *rfc3779_addr;
+       struct ASIdentifiers_st *rfc3779_asid;
+#endif
 #ifndef OPENSSL_NO_SHA
        unsigned char sha1_hash[SHA_DIGEST_LENGTH];
 #endif
@@ -858,6 +865,10 @@ X509_EXTENSION *X509_EXTENSION_dup(X509_EXTENSION *ex);
 X509_CRL *X509_CRL_dup(X509_CRL *crl);
 X509_REQ *X509_REQ_dup(X509_REQ *req);
 X509_ALGOR *X509_ALGOR_dup(X509_ALGOR *xn);
+int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval);
+void X509_ALGOR_get0(ASN1_OBJECT **paobj, int *pptype, void **ppval,
+                                               X509_ALGOR *algor);
+
 X509_NAME *X509_NAME_dup(X509_NAME *xn);
 X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne);
 
@@ -879,6 +890,7 @@ X509_REQ *  X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);
 X509 *         X509_REQ_to_X509(X509_REQ *r, int days,EVP_PKEY *pkey);
 
 DECLARE_ASN1_FUNCTIONS(X509_ALGOR)
+DECLARE_ASN1_ENCODE_FUNCTIONS(X509_ALGORS, X509_ALGORS, X509_ALGORS)
 DECLARE_ASN1_FUNCTIONS(X509_VAL)
 
 DECLARE_ASN1_FUNCTIONS(X509_PUBKEY)
@@ -914,6 +926,7 @@ DECLARE_ASN1_FUNCTIONS(X509_ATTRIBUTE)
 X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value);
 
 DECLARE_ASN1_FUNCTIONS(X509_EXTENSION)
+DECLARE_ASN1_ENCODE_FUNCTIONS(X509_EXTENSIONS, X509_EXTENSIONS, X509_EXTENSIONS)
 
 DECLARE_ASN1_FUNCTIONS(X509_NAME_ENTRY)
 
@@ -966,15 +979,15 @@ X509_INFO *       X509_INFO_new(void);
 void           X509_INFO_free(X509_INFO *a);
 char *         X509_NAME_oneline(X509_NAME *a,char *buf,int size);
 
-int ASN1_verify(int (*i2d)(), X509_ALGOR *algor1,
-       ASN1_BIT_STRING *signature,char *data,EVP_PKEY *pkey);
+int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *algor1,
+               ASN1_BIT_STRING *signature,char *data,EVP_PKEY *pkey);
 
-int ASN1_digest(int (*i2d)(),const EVP_MD *type,char *data,
-       unsigned char *md,unsigned int *len);
+int ASN1_digest(i2d_of_void *i2d,const EVP_MD *type,char *data,
+               unsigned char *md,unsigned int *len);
 
-int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2,
-       ASN1_BIT_STRING *signature,
-       char *data,EVP_PKEY *pkey, const EVP_MD *type);
+int ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1,
+             X509_ALGOR *algor2, ASN1_BIT_STRING *signature,
+             char *data,EVP_PKEY *pkey, const EVP_MD *type);
 
 int ASN1_item_digest(const ASN1_ITEM *it,const EVP_MD *type,void *data,
        unsigned char *md,unsigned int *len);
@@ -1097,18 +1110,18 @@ int X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type,
 int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type,
                        unsigned char *bytes, int len, int loc, int set);
 X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne,
-               char *field, int type, unsigned char *bytes, int len);
+               const char *field, int type, const unsigned char *bytes, int len);
 X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid,
                        int type,unsigned char *bytes, int len);
-int X509_NAME_add_entry_by_txt(X509_NAME *name, char *field, int type,
-                       unsigned char *bytes, int len, int loc, int set);
+int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type,
+                       const unsigned char *bytes, int len, int loc, int set);
 X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne,
-                       ASN1_OBJECT *obj, int type,unsigned char *bytes,
+                       ASN1_OBJECT *obj, int type,const unsigned char *bytes,
                        int len);
 int            X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne,
                        ASN1_OBJECT *obj);
 int            X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type,
-                       unsigned char *bytes, int len);
+                       const unsigned char *bytes, int len);
 ASN1_OBJECT *  X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne);
 ASN1_STRING *  X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne);
 
@@ -1187,6 +1200,8 @@ STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE) **x,
 STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE) **x,
                        const char *attrname, int type,
                        const unsigned char *bytes, int len);
+void *X509at_get0_data_by_OBJ(STACK_OF(X509_ATTRIBUTE) *x,
+                               ASN1_OBJECT *obj, int lastpos, int type);
 X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid,
             int atrtype, const void *data, int len);
 X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr,
@@ -1201,6 +1216,24 @@ int X509_ATTRIBUTE_count(X509_ATTRIBUTE *attr);
 ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr);
 ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx);
 
+int EVP_PKEY_get_attr_count(const EVP_PKEY *key);
+int EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid,
+                         int lastpos);
+int EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, ASN1_OBJECT *obj,
+                         int lastpos);
+X509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc);
+X509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc);
+int EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr);
+int EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key,
+                       const ASN1_OBJECT *obj, int type,
+                       const unsigned char *bytes, int len);
+int EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key,
+                       int nid, int type,
+                       const unsigned char *bytes, int len);
+int EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key,
+                       const char *attrname, int type,
+                       const unsigned char *bytes, int len);
+
 int            X509_verify_cert(X509_STORE_CTX *ctx);
 
 /* lookup a cert from a X509 STACK */
@@ -1247,18 +1280,20 @@ void ERR_load_X509_strings(void);
 /* Function codes. */
 #define X509_F_ADD_CERT_DIR                             100
 #define X509_F_BY_FILE_CTRL                             101
+#define X509_F_CHECK_POLICY                             145
 #define X509_F_DIR_CTRL                                         102
 #define X509_F_GET_CERT_BY_SUBJECT                      103
 #define X509_F_NETSCAPE_SPKI_B64_DECODE                         129
 #define X509_F_NETSCAPE_SPKI_B64_ENCODE                         130
+#define X509_F_X509AT_ADD1_ATTR                                 135
 #define X509_F_X509V3_ADD_EXT                           104
-#define X509_F_X509_ADD_ATTR                            135
 #define X509_F_X509_ATTRIBUTE_CREATE_BY_NID             136
 #define X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ             137
 #define X509_F_X509_ATTRIBUTE_CREATE_BY_TXT             140
 #define X509_F_X509_ATTRIBUTE_GET0_DATA                         139
 #define X509_F_X509_ATTRIBUTE_SET1_DATA                         138
 #define X509_F_X509_CHECK_PRIVATE_KEY                   128
+#define X509_F_X509_CRL_PRINT_FP                        147
 #define X509_F_X509_EXTENSION_CREATE_BY_NID             108
 #define X509_F_X509_EXTENSION_CREATE_BY_OBJ             109
 #define X509_F_X509_GET_PUBKEY_PARAMETERS               110
@@ -1271,15 +1306,16 @@ void ERR_load_X509_strings(void);
 #define X509_F_X509_NAME_ENTRY_SET_OBJECT               115
 #define X509_F_X509_NAME_ONELINE                        116
 #define X509_F_X509_NAME_PRINT                          117
-#define X509_F_X509_PRINT_FP                            118
+#define X509_F_X509_PRINT_EX_FP                                 118
 #define X509_F_X509_PUBKEY_GET                          119
 #define X509_F_X509_PUBKEY_SET                          120
 #define X509_F_X509_REQ_CHECK_PRIVATE_KEY               144
-#define X509_F_X509_REQ_PRINT                           121
+#define X509_F_X509_REQ_PRINT_EX                        121
 #define X509_F_X509_REQ_PRINT_FP                        122
 #define X509_F_X509_REQ_TO_X509                                 123
 #define X509_F_X509_STORE_ADD_CERT                      124
 #define X509_F_X509_STORE_ADD_CRL                       125
+#define X509_F_X509_STORE_CTX_GET1_ISSUER               146
 #define X509_F_X509_STORE_CTX_INIT                      143
 #define X509_F_X509_STORE_CTX_NEW                       142
 #define X509_F_X509_STORE_CTX_PURPOSE_INHERIT           134