Add type-safe STACKs and SETs.
[openssl.git] / crypto / x509 / x509.h
index c4677be1eecdb4e35f0059125e39dab7659b6422..0cb6c04f47c439d59ad2d1a74e4e29cc4495e72a 100644 (file)
@@ -66,6 +66,7 @@ extern "C" {
 
 #include "stack.h"
 #include "asn1.h"
+#include "safestack.h"
 
 #ifndef NO_RSA
 #include "rsa.h"
@@ -155,6 +156,8 @@ typedef struct X509_name_st
        unsigned long hash; /* Keep the hash around for lookups */
        } X509_NAME;
 
+DECLARE_STACK_OF(X509_NAME)
+
 #define X509_EX_V_NETSCAPE_HACK                0x8000
 #define X509_EX_V_INIT                 0x0001
 typedef struct X509_extension_st
@@ -228,6 +231,9 @@ typedef struct x509_st
        char *name;
        } X509;
 
+DECLARE_STACK_OF(X509)
+DECLARE_ASN1_SET_OF(X509)
+
 typedef struct X509_revoked_st
        {
        ASN1_INTEGER *serialNumber;
@@ -344,6 +350,21 @@ ASN1_OCTET_STRING *salt;
 ASN1_INTEGER *iter;
 } PBEPARAM;
 
+/* Password based encryption V2 structures */
+
+typedef struct PBE2PARAM_st {
+X509_ALGOR *keyfunc;
+X509_ALGOR *encryption;
+} PBE2PARAM;
+
+typedef struct PBKDF2PARAM_st {
+ASN1_OCTET_STRING *salt;
+ASN1_INTEGER *iter;
+ASN1_INTEGER *keylength;
+X509_ALGOR *prf;
+} PBKDF2PARAM;
+
+
 /* PKCS#8 private key info structure */
 
 typedef struct pkcs8_priv_key_info_st
@@ -855,14 +876,25 @@ ASN1_STRING *     X509v3_unpack_string(ASN1_STRING **ex,int type,
 int            X509_verify_cert(X509_STORE_CTX *ctx);
 
 /* lookup a cert from a X509 STACK */
-X509 *X509_find_by_issuer_and_serial(STACK *sk,X509_NAME *name,
-                ASN1_INTEGER *serial);
-X509 *X509_find_by_subject(STACK *sk,X509_NAME *name);
+X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk,X509_NAME *name,
+                                    ASN1_INTEGER *serial);
+X509 *X509_find_by_subject(STACK_OF(X509) *sk,X509_NAME *name);
 
 int i2d_PBEPARAM(PBEPARAM *a, unsigned char **pp);
 PBEPARAM *PBEPARAM_new(void);
 PBEPARAM *d2i_PBEPARAM(PBEPARAM **a, unsigned char **pp, long length);
 void PBEPARAM_free(PBEPARAM *a);
+X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt, int saltlen);
+
+int i2d_PBKDF2PARAM(PBKDF2PARAM *a, unsigned char **pp);
+PBKDF2PARAM *PBKDF2PARAM_new(void);
+PBKDF2PARAM *d2i_PBKDF2PARAM(PBKDF2PARAM **a, unsigned char **pp, long length);
+void PBKDF2PARAM_free(PBKDF2PARAM *a);
+
+int i2d_PBE2PARAM(PBE2PARAM *a, unsigned char **pp);
+PBE2PARAM *PBE2PARAM_new(void);
+PBE2PARAM *d2i_PBE2PARAM(PBE2PARAM **a, unsigned char **pp, long length);
+void PBE2PARAM_free(PBE2PARAM *a);
 
 /* PKCS#8 utilities */
 
@@ -882,6 +914,7 @@ int EVP_PBE_ALGOR_CipherInit(X509_ALGOR *algor, unsigned char *pass,
                                 int passlen, EVP_CIPHER_CTX *ctx, int en_de);
 int EVP_PBE_alg_add(int nid, EVP_CIPHER *cipher, EVP_MD *md,
                                                 EVP_PBE_KEYGEN *keygen);
+void EVP_PBE_cleanup(void);
 
 #else
 
@@ -1187,6 +1220,16 @@ PBEPARAM *PBEPARAM_new();
 PBEPARAM *d2i_PBEPARAM();
 void PBEPARAM_free();
 
+int i2d_PBKDF2PARAM();
+PBKDF2PARAM *PBKDF2PARAM_new();
+PBKDF2PARAM *d2i_PBKDF2PARAM();
+void PBKDF2PARAM_free();
+
+int i2d_PBE2PARAM();
+PBE2PARAM *PBE2PARAM_new();
+PBE2PARAM *d2i_PBE2PARAM();
+void PBE2PARAM_free();
+
 int i2d_PKCS8_PRIV_KEY_INFO();
 PKCS8_PRIV_KEY_INFO *PKCS8_PRIV_KEY_INFO_new();
 PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO();
@@ -1198,6 +1241,8 @@ PKCS8_PRIV_KEY_INFO *PKCS8_set_broken();
 
 int EVP_PBE_ALGOR_CipherInit();
 int EVP_PBE_alg_add();
+X509_ALGOR *PKCS5_pbe_set();
+void EVP_PBE_cleanup();
 
 #endif