Add 'flags' parameter to EVP_PKEY_asn1_meth_new() to set algorithm flags.
[openssl.git] / crypto / evp / evp.h
index f306887a20b03e3258cbd0ba0c6056dd05b11bfe..cff40ab99a99e85e92d94e918145b2f7b96824e1 100644 (file)
@@ -154,73 +154,6 @@ struct evp_pkey_st
 #define EVP_PKEY_MO_ENCRYPT    0x0004
 #define EVP_PKEY_MO_DECRYPT    0x0008
 
-#if 0
-/* This structure is required to tie the message digest and signing together.
- * The lookup can be done by md/pkey_method, oid, oid/pkey_method, or
- * oid, md and pkey.
- * This is required because for various smart-card perform the digest and
- * signing/verification on-board.  To handle this case, the specific
- * EVP_MD and EVP_PKEY_METHODs need to be closely associated.
- * When a PKEY is created, it will have a EVP_PKEY_METHOD associated with it.
- * This can either be software or a token to provide the required low level
- * routines.
- */
-typedef struct evp_pkey_md_st
-       {
-       int oid;
-       EVP_MD *md;
-       EVP_PKEY_METHOD *pkey;
-       } EVP_PKEY_MD;
-
-#define EVP_rsa_md2() \
-               EVP_PKEY_MD_add(NID_md2WithRSAEncryption,\
-                       EVP_rsa_pkcs1(),EVP_md2())
-#define EVP_rsa_md5() \
-               EVP_PKEY_MD_add(NID_md5WithRSAEncryption,\
-                       EVP_rsa_pkcs1(),EVP_md5())
-#define EVP_rsa_sha0() \
-               EVP_PKEY_MD_add(NID_shaWithRSAEncryption,\
-                       EVP_rsa_pkcs1(),EVP_sha())
-#define EVP_rsa_sha1() \
-               EVP_PKEY_MD_add(NID_sha1WithRSAEncryption,\
-                       EVP_rsa_pkcs1(),EVP_sha1())
-#define EVP_rsa_ripemd160() \
-               EVP_PKEY_MD_add(NID_ripemd160WithRSA,\
-                       EVP_rsa_pkcs1(),EVP_ripemd160())
-#define EVP_rsa_mdc2() \
-               EVP_PKEY_MD_add(NID_mdc2WithRSA,\
-                       EVP_rsa_octet_string(),EVP_mdc2())
-#define EVP_dsa_sha() \
-               EVP_PKEY_MD_add(NID_dsaWithSHA,\
-                       EVP_dsa(),EVP_sha())
-#define EVP_dsa_sha1() \
-               EVP_PKEY_MD_add(NID_dsaWithSHA1,\
-                       EVP_dsa(),EVP_sha1())
-
-typedef struct evp_pkey_method_st
-       {
-       char *name;
-       int flags;
-       int type;               /* RSA, DSA, an SSLeay specific constant */
-       int oid;                /* For the pub-key type */
-       int encrypt_oid;        /* pub/priv key encryption */
-
-       int (*sign)();
-       int (*verify)();
-       struct  {
-               int (*set)();   /* get and/or set the underlying type */
-               int (*get)();
-               int (*encrypt)();
-               int (*decrypt)();
-               int (*i2d)();
-               int (*d2i)();
-               int (*dup)();
-               } pub,priv;
-       int (*set_asn1_parameters)();
-       int (*get_asn1_parameters)();
-       } EVP_PKEY_METHOD;
-#endif
-
 #ifndef EVP_MD
 struct env_md_st
        {
@@ -255,6 +188,15 @@ typedef int evp_verify_method(int type,const unsigned char *m,
 #define EVP_MD_FLAG_ONESHOT    0x0001 /* digest can only handle a single
                                        * block */
 
+#define EVP_MD_FLAG_PKEY_DIGEST        0x0002 /* digest is a "clone" digest used
+                                       * which is a copy of an existing
+                                       * one for a specific public key type.
+                                       * EVP_dss1() etc */
+
+/* Digest uses EVP_PKEY_METHOD for signing instead of MD specific signing */
+
+#define EVP_MD_FLAG_PKEY_METHOD_SIGNATURE      0x0004
+
 #define EVP_PKEY_NULL_method   NULL,NULL,{0,0,0,0}
 
 #ifndef OPENSSL_NO_DSA
@@ -859,6 +801,7 @@ void EVP_PBE_cleanup(void);
 
 #define ASN1_PKEY_ALIAS                0x1
 #define ASN1_PKEY_DYNAMIC      0x2
+#define ASN1_PKEY_SIGPARAM_NULL        0x4
 
 #define ASN1_PKEY_CTRL_PKCS7_SIGN      0x1
 
@@ -872,7 +815,7 @@ int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id, int *ppkey_flags,
                                const char **pinfo, const char **ppem_str,
                                        const EVP_PKEY_ASN1_METHOD *ameth);
 
-EVP_PKEY_ASN1_METHOD* EVP_PKEY_asn1_new(int id,
+EVP_PKEY_ASN1_METHOD* EVP_PKEY_asn1_new(int id, int flags,
                                        const char *pem_str, const char *info);
 void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth);
 void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth,