Allow digests to supply S/MIME micalg values from a ctrl.
[openssl.git] / crypto / evp / evp.h
index 833257a937aa21fefcbd258c0ed3bc45700c363e..be16b5eceee1b879e17350045cbc5975029355cf 100644 (file)
@@ -129,7 +129,7 @@ struct evp_pkey_st
        int save_type;
        int references;
        const EVP_PKEY_ASN1_METHOD *ameth;
-       const EVP_PKEY_METHOD *pmeth;
+       ENGINE *engine;
        union   {
                char *ptr;
 #ifndef OPENSSL_NO_RSA
@@ -218,6 +218,7 @@ typedef int evp_verify_method(int type,const unsigned char *m,
 /* Digest ctrls */
 
 #define        EVP_MD_CTRL_DIGALGID                    0x1
+#define        EVP_MD_CTRL_MICALG                      0x2
 
 /* Minimum Algorithm specific ctrl value */
 
@@ -455,6 +456,9 @@ typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
 #define EVP_SignDigestUpdate(a,b,c)    EVP_DigestUpdate(a,b,c)
 #define EVP_VerifyDigestUpdate(a,b,c)  EVP_DigestUpdate(a,b,c)
 
+#define EVP_DigestSignUpdate(a,b,c)            EVP_DigestUpdate(a,b,c)
+#define EVP_DigestVerifyUpdate(a,b,c)          EVP_DigestUpdate(a,b,c)
+
 #ifdef CONST_STRICT
 void BIO_set_md(BIO *,const EVP_MD *md);
 #else
@@ -734,6 +738,29 @@ const EVP_CIPHER *EVP_aes_256_ofb(void);
 const EVP_CIPHER *EVP_aes_256_ctr(void);
 #endif
 #endif
+#ifndef OPENSSL_NO_CAMELLIA
+const EVP_CIPHER *EVP_camellia_128_ecb(void);
+const EVP_CIPHER *EVP_camellia_128_cbc(void);
+const EVP_CIPHER *EVP_camellia_128_cfb1(void);
+const EVP_CIPHER *EVP_camellia_128_cfb8(void);
+const EVP_CIPHER *EVP_camellia_128_cfb128(void);
+# define EVP_camellia_128_cfb EVP_camellia_128_cfb128
+const EVP_CIPHER *EVP_camellia_128_ofb(void);
+const EVP_CIPHER *EVP_camellia_192_ecb(void);
+const EVP_CIPHER *EVP_camellia_192_cbc(void);
+const EVP_CIPHER *EVP_camellia_192_cfb1(void);
+const EVP_CIPHER *EVP_camellia_192_cfb8(void);
+const EVP_CIPHER *EVP_camellia_192_cfb128(void);
+# define EVP_camellia_192_cfb EVP_camellia_192_cfb128
+const EVP_CIPHER *EVP_camellia_192_ofb(void);
+const EVP_CIPHER *EVP_camellia_256_ecb(void);
+const EVP_CIPHER *EVP_camellia_256_cbc(void);
+const EVP_CIPHER *EVP_camellia_256_cfb1(void);
+const EVP_CIPHER *EVP_camellia_256_cfb8(void);
+const EVP_CIPHER *EVP_camellia_256_cfb128(void);
+# define EVP_camellia_256_cfb EVP_camellia_256_cfb128
+const EVP_CIPHER *EVP_camellia_256_ofb(void);
+#endif
 
 void OPENSSL_add_all_algorithms_noconf(void);
 void OPENSSL_add_all_algorithms_conf(void);
@@ -759,6 +786,16 @@ const EVP_CIPHER *EVP_get_cipherbyname(const char *name);
 const EVP_MD *EVP_get_digestbyname(const char *name);
 void EVP_cleanup(void);
 
+void EVP_CIPHER_do_all(void (*fn)(const EVP_CIPHER *ciph,
+               const char *from, const char *to, void *x), void *arg);
+void EVP_CIPHER_do_all_sorted(void (*fn)(const EVP_CIPHER *ciph,
+               const char *from, const char *to, void *x), void *arg);
+
+void EVP_MD_do_all(void (*fn)(const EVP_MD *ciph,
+               const char *from, const char *to, void *x), void *arg);
+void EVP_MD_do_all_sorted(void (*fn)(const EVP_MD *ciph,
+               const char *from, const char *to, void *x), void *arg);
+
 int            EVP_PKEY_decrypt_old(unsigned char *dec_key,
                        const unsigned char *enc_key,int enc_key_len,
                        EVP_PKEY *private_key);
@@ -770,6 +807,8 @@ int         EVP_PKEY_id(const EVP_PKEY *pkey);
 int            EVP_PKEY_base_id(const EVP_PKEY *pkey);
 int            EVP_PKEY_bits(EVP_PKEY *pkey);
 int            EVP_PKEY_size(EVP_PKEY *pkey);
+int            EVP_PKEY_set_type(EVP_PKEY *pkey,int type);
+int            EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len);
 int            EVP_PKEY_assign(EVP_PKEY *pkey,int type,void *key);
 void *         EVP_PKEY_get0(EVP_PKEY *pkey);
 
@@ -874,8 +913,9 @@ void EVP_PBE_cleanup(void);
 
 int EVP_PKEY_asn1_get_count(void);
 const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx);
-const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(int type);
-const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(const char *str, int len);
+const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type);
+const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe,
+                                       const char *str, int len);
 int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth);
 int EVP_PKEY_asn1_add_alias(int to, int from);
 int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id, int *ppkey_flags,
@@ -945,10 +985,12 @@ void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth,
                                        EVP_PKEY_CTRL_MD, 0, (void *)md)
 
 #define EVP_PKEY_CTRL_MD               1
-#define EVP_PKEY_CTRL_PEER_KEY         2       
+#define EVP_PKEY_CTRL_PEER_KEY         2
+
+#define EVP_PKEY_CTRL_PKCS7_ENCRYPT    3
+#define EVP_PKEY_CTRL_PKCS7_DECRYPT    4
 
-#define EVP_PKEY_CTRL_PKCS7_ENCRYPT    3       
-#define EVP_PKEY_CTRL_PKCS7_DECRYPT    4       
+#define EVP_PKEY_CTRL_PKCS7_SIGN       5
 
 #define EVP_PKEY_ALG_CTRL              0x1000
 
@@ -1088,6 +1130,7 @@ void ERR_load_EVP_strings(void);
 
 /* Function codes. */
 #define EVP_F_AES_INIT_KEY                              133
+#define EVP_F_CAMELLIA_INIT_KEY                                 159
 #define EVP_F_D2I_PKEY                                  100
 #define EVP_F_DSAPKEY2PKCS8                             134
 #define EVP_F_DSA_PKEY2PKCS8                            135
@@ -1142,6 +1185,7 @@ void ERR_load_EVP_strings(void);
 #define EVP_F_PKCS5_PBE_KEYIVGEN                        117
 #define EVP_F_PKCS5_V2_PBE_KEYIVGEN                     118
 #define EVP_F_PKCS8_SET_BROKEN                          112
+#define EVP_F_PKEY_SET_TYPE                             158
 #define EVP_F_RC2_MAGIC_TO_METH                                 109
 #define EVP_F_RC5_CTRL                                  125
 
@@ -1154,6 +1198,7 @@ void ERR_load_EVP_strings(void);
 #define EVP_R_BN_DECODE_ERROR                           112
 #define EVP_R_BN_PUBKEY_ERROR                           113
 #define EVP_R_BUFFER_TOO_SMALL                          155
+#define EVP_R_CAMELLIA_KEY_SETUP_FAILED                         157
 #define EVP_R_CIPHER_PARAMETER_ERROR                    122
 #define EVP_R_COMMAND_NOT_SUPPORTED                     147
 #define EVP_R_CTRL_NOT_IMPLEMENTED                      132
@@ -1193,6 +1238,7 @@ void ERR_load_EVP_strings(void);
 #define EVP_R_PUBLIC_KEY_NOT_RSA                        106
 #define EVP_R_UNKNOWN_PBE_ALGORITHM                     121
 #define EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS               135
+#define EVP_R_UNSUPPORTED_ALGORITHM                     156
 #define EVP_R_UNSUPPORTED_CIPHER                        107
 #define EVP_R_UNSUPPORTED_KEYLENGTH                     123
 #define EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION       124