Handle ASN1_SET_OF and PKCS12_STACK_OF using function
[openssl.git] / crypto / x509 / x509.h
index d2ad77815e343601902c7fd489c2a6db89701594..bbf9a10ad5084ba6cb623522db51067e6f2a0a6d 100644 (file)
 #define X509_REVOKED_get_ext_by_critical X509_REVOKED_get_ext_by_critic
 #endif
 
+#ifndef NO_BUFFER
+#include <openssl/buffer.h>
+#endif
+#ifndef NO_EVP
+#include <openssl/evp.h>
+#endif
+#ifndef NO_BIO
+#include <openssl/bio.h>
+#endif
 #include <openssl/stack.h>
 #include <openssl/asn1.h>
 #include <openssl/safestack.h>
@@ -93,26 +102,8 @@ extern "C" {
 #endif
 
   /* If placed in pkcs12.h, we end up with a circular depency with pkcs7.h */
-#define DECLARE_PKCS12_STACK_OF(type) \
-STACK_OF(type) *PKCS12_decrypt_d2i_##type(struct X509_algor_st *algor, \
-                                         type *(*d2i)(type **, \
-                                                      unsigned char **, \
-                                                      long), \
-                                         void (*free_func)(type *), \
-                                         const char *pass, int passlen, \
-                                         ASN1_STRING *oct, int seq);
-
-#define IMPLEMENT_PKCS12_STACK_OF(type) \
-STACK_OF(type) *PKCS12_decrypt_d2i_##type(struct X509_algor_st *algor, \
-                                         type *(*d2i)(type **, \
-                                                      unsigned char **, \
-                                                      long), \
-                                         void (*free_func)(type *), \
-                                         const char *pass, int passlen, \
-                                         ASN1_STRING *oct, int seq) \
-    { return (STACK_OF(type) *)PKCS12_decrypt_d2i(algor,(char *(*)())d2i, \
-                                                 (void(*)(void *))free_func, \
-                                                 pass,passlen,oct,seq); }
+#define DECLARE_PKCS12_STACK_OF(type) /* Nothing */
+#define IMPLEMENT_PKCS12_STACK_OF(type) /* Nothing */
 
 #define X509_FILETYPE_PEM      1
 #define X509_FILETYPE_ASN1     2
@@ -180,7 +171,7 @@ typedef struct X509_name_st
        {
        STACK_OF(X509_NAME_ENTRY) *entries;
        int modified;   /* true if 'bytes' needs to be built */
-#ifdef HEADER_BUFFER_H
+#ifndef NO_BUFFER
        BUF_MEM *bytes;
 #else
        char *bytes;
@@ -384,7 +375,7 @@ typedef struct private_key_st
        int references;
        } X509_PKEY;
 
-#ifdef HEADER_ENVELOPE_H
+#ifndef NO_EVP
 typedef struct X509_info_st
        {
        X509 *x509;
@@ -640,7 +631,7 @@ extern "C" {
 const char *X509_verify_cert_error_string(long n);
 
 #ifndef SSLEAY_MACROS
-#ifdef HEADER_ENVELOPE_H
+#ifndef NO_EVP
 int X509_verify(X509 *a, EVP_PKEY *r);
 
 int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r);
@@ -659,9 +650,14 @@ int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md);
 int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md);
 int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md);
 
-int X509_digest(X509 *data,const EVP_MD *type,unsigned char *md,unsigned int *len);
-int X509_NAME_digest(X509_NAME *data,const EVP_MD *type,
-       unsigned char *md,unsigned int *len);
+int X509_digest(const X509 *data,const EVP_MD *type,
+               unsigned char *md, unsigned int *len);
+int X509_CRL_digest(const X509_CRL *data,const EVP_MD *type,
+               unsigned char *md, unsigned int *len);
+int X509_REQ_digest(const X509_REQ *data,const EVP_MD *type,
+               unsigned char *md, unsigned int *len);
+int X509_NAME_digest(const X509_NAME *data,const EVP_MD *type,
+               unsigned char *md, unsigned int *len);
 #endif
 
 #ifndef NO_FP_API
@@ -695,7 +691,7 @@ int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey);
 EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a);
 #endif
 
-#ifdef HEADER_BIO_H
+#ifndef NO_BIO
 X509 *d2i_X509_bio(BIO *bp,X509 **x509);
 int i2d_X509_bio(BIO *bp,X509 *x509);
 X509_CRL *d2i_X509_CRL_bio(BIO *bp,X509_CRL **crl);
@@ -901,7 +897,7 @@ NETSCAPE_CERT_SEQUENCE *NETSCAPE_CERT_SEQUENCE_new(void);
 NETSCAPE_CERT_SEQUENCE *d2i_NETSCAPE_CERT_SEQUENCE(NETSCAPE_CERT_SEQUENCE **a, unsigned char **pp, long length);
 void NETSCAPE_CERT_SEQUENCE_free(NETSCAPE_CERT_SEQUENCE *a);
 
-#ifdef HEADER_ENVELOPE_H
+#ifndef NO_EVP
 X509_INFO *    X509_INFO_new(void);
 void           X509_INFO_free(X509_INFO *a);
 char *         X509_NAME_oneline(X509_NAME *a,char *buf,int size);
@@ -961,27 +957,27 @@ int X509_REQ_add1_attr_by_txt(X509_REQ *req,
 
 int            X509_check_private_key(X509 *x509,EVP_PKEY *pkey);
 
-int            X509_issuer_and_serial_cmp(X509 *a, X509 *b);
+int            X509_issuer_and_serial_cmp(const X509 *a, const X509 *b);
 unsigned long  X509_issuer_and_serial_hash(X509 *a);
 
-int            X509_issuer_name_cmp(X509 *a, X509 *b);
+int            X509_issuer_name_cmp(const X509 *a, const X509 *b);
 unsigned long  X509_issuer_name_hash(X509 *a);
 
-int            X509_subject_name_cmp(X509 *a,X509 *b);
+int            X509_subject_name_cmp(const X509 *a, const X509 *b);
 unsigned long  X509_subject_name_hash(X509 *x);
 
-int            X509_cmp (X509 *a, X509 *b);
-int            X509_NAME_cmp (X509_NAME *a, X509_NAME *b);
+int            X509_cmp(const X509 *a, const X509 *b);
+int            X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b);
 unsigned long  X509_NAME_hash(X509_NAME *x);
 
-int            X509_CRL_cmp(X509_CRL *a,X509_CRL *b);
+int            X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b);
 #ifndef NO_FP_API
 int            X509_print_fp(FILE *bp,X509 *x);
 int            X509_CRL_print_fp(FILE *bp,X509_CRL *x);
 int            X509_REQ_print_fp(FILE *bp,X509_REQ *req);
 #endif
 
-#ifdef HEADER_BIO_H
+#ifndef NO_BIO
 int            X509_NAME_print(BIO *bp, X509_NAME *name, int obase);
 int            X509_print(BIO *bp,X509 *x);
 int            X509_CERT_AUX_print(BIO *bp,X509_CERT_AUX *x, int indent);