Initial support for delta CRLs. If "use deltas" flag is set attempt to find
[openssl.git] / crypto / x509 / x509.h
index f2574524620bede0231122be32bf03e2beb80f99..56d9e9f1ebb54654f3b1f9aa4d733708cb511dd2 100644 (file)
@@ -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;
@@ -205,6 +206,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)
 
@@ -291,6 +294,12 @@ struct x509_st
        AUTHORITY_KEYID *akid;
        X509_POLICY_CACHE *policy_cache;
        STACK_OF(DIST_POINT) *crldp;
+       STACK_OF(GENERAL_NAME) *altname;
+       NAME_CONSTRAINTS *nc;
+#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
@@ -425,6 +434,10 @@ struct x509_revoked_st
        ASN1_INTEGER *serialNumber;
        ASN1_TIME *revocationDate;
        STACK_OF(X509_EXTENSION) /* optional */ *extensions;
+       /* Set up if indirect CRL */
+       STACK_OF(GENERAL_NAME) *issuer;
+       /* Revocation reason */
+       int reason;
        int sequence; /* load sequence */
        };
 
@@ -457,9 +470,13 @@ struct X509_crl_st
        /* Convenient breakdown of IDP */
        int idp_flags;
        int idp_reasons;
+       /* CRL and base CRL numbers for delta processing */
+       ASN1_INTEGER *crl_number;
+       ASN1_INTEGER *base_crl_number;
 #ifndef OPENSSL_NO_SHA
        unsigned char sha1_hash[SHA_DIGEST_LENGTH];
 #endif
+       STACK_OF(GENERAL_NAMES) *issuers;
        const X509_CRL_METHOD *meth;
        void *meth_data;
        } /* X509_CRL */;
@@ -608,18 +625,14 @@ void X509_CRL_set_default_method(const X509_CRL_METHOD *meth);
 X509_CRL_METHOD *X509_CRL_METHOD_new(
        int (*crl_init)(X509_CRL *crl),
        int (*crl_free)(X509_CRL *crl),
-       int (*crl_lookup)(X509_CRL *crl, X509_REVOKED **ret, ASN1_INTEGER *ser),
+       int (*crl_lookup)(X509_CRL *crl, X509_REVOKED **ret,
+                               ASN1_INTEGER *ser, X509_NAME *issuer),
        int (*crl_verify)(X509_CRL *crl, EVP_PKEY *pk));
 void X509_CRL_METHOD_free(X509_CRL_METHOD *m);
 
 void X509_CRL_set_meth_data(X509_CRL *crl, void *dat);
 void *X509_CRL_get_meth_data(X509_CRL *crl);
 
-IMPLEMENT_STACK_OF(X509_REVOKED)
-IMPLEMENT_ASN1_SET_OF(X509_REVOKED)
-IMPLEMENT_STACK_OF(X509_CRL)
-IMPLEMENT_ASN1_SET_OF(X509_CRL)
-
 /* This one is only used so that a binary form can output, as in
  * i2d_X509_NAME(X509_get_X509_PUBKEY(x),&buf) */
 #define        X509_get_X509_PUBKEY(x) ((x)->cert_info->key)
@@ -751,8 +764,8 @@ void X509_ALGOR_get0(ASN1_OBJECT **paobj, int *pptype, void **ppval,
 X509_NAME *X509_NAME_dup(X509_NAME *xn);
 X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne);
 
-int            X509_cmp_time(ASN1_TIME *s, time_t *t);
-int            X509_cmp_current_time(ASN1_TIME *s);
+int            X509_cmp_time(const ASN1_TIME *s, time_t *t);
+int            X509_cmp_current_time(const ASN1_TIME *s);
 ASN1_TIME *    X509_time_adj(ASN1_TIME *s, long adj, time_t *t);
 ASN1_TIME *    X509_gmtime_adj(ASN1_TIME *s, long adj);
 
@@ -767,6 +780,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)
@@ -802,6 +816,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)
 
@@ -841,6 +856,7 @@ DECLARE_ASN1_FUNCTIONS(X509_CRL)
 int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev);
 int X509_CRL_get0_by_serial(X509_CRL *crl,
                X509_REVOKED **ret, ASN1_INTEGER *serial);
+int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x);
 
 X509_PKEY *    X509_PKEY_new(void );
 void           X509_PKEY_free(X509_PKEY *a);
@@ -884,8 +900,8 @@ int                 X509_set_issuer_name(X509 *x, X509_NAME *name);
 X509_NAME *    X509_get_issuer_name(X509 *a);
 int            X509_set_subject_name(X509 *x, X509_NAME *name);
 X509_NAME *    X509_get_subject_name(X509 *a);
-int            X509_set_notBefore(X509 *x, ASN1_TIME *tm);
-int            X509_set_notAfter(X509 *x, ASN1_TIME *tm);
+int            X509_set_notBefore(X509 *x, const ASN1_TIME *tm);
+int            X509_set_notAfter(X509 *x, const ASN1_TIME *tm);
 int            X509_set_pubkey(X509 *x, EVP_PKEY *pkey);
 EVP_PKEY *     X509_get_pubkey(X509 *x);
 ASN1_BIT_STRING * X509_get0_pubkey_bitstr(const X509 *x);
@@ -922,8 +938,8 @@ int X509_REQ_add1_attr_by_txt(X509_REQ *req,
 
 int X509_CRL_set_version(X509_CRL *x, long version);
 int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name);
-int X509_CRL_set_lastUpdate(X509_CRL *x, ASN1_TIME *tm);
-int X509_CRL_set_nextUpdate(X509_CRL *x, ASN1_TIME *tm);
+int X509_CRL_set_lastUpdate(X509_CRL *x, const ASN1_TIME *tm);
+int X509_CRL_set_nextUpdate(X509_CRL *x, const ASN1_TIME *tm);
 int X509_CRL_sort(X509_CRL *crl);
 
 int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial);
@@ -1078,6 +1094,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,
@@ -1121,7 +1139,11 @@ DECLARE_ASN1_FUNCTIONS(PBEPARAM)
 DECLARE_ASN1_FUNCTIONS(PBE2PARAM)
 DECLARE_ASN1_FUNCTIONS(PBKDF2PARAM)
 
-X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt, int saltlen);
+int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter,
+                               const unsigned char *salt, int saltlen);
+
+X509_ALGOR *PKCS5_pbe_set(int alg, int iter,
+                               const unsigned char *salt, int saltlen);
 X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
                                         unsigned char *salt, int saltlen);
 X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter,