summaryrefslogtreecommitdiffstats
path: root/crypto/asn1/a_sign.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2006-05-07 17:09:39 +0000
committerDr. Stephen Henson <steve@openssl.org>2006-05-07 17:09:39 +0000
commit03919683f9bade36ef1b58e64638ac3ccbbf371a (patch)
tree27f5210878e9047e884930fdf7b5860e59048a8d /crypto/asn1/a_sign.c
parent5cda6c458211c2b5803f9616b192fd2e8c1c47f3 (diff)
Add support for default public key digest type ctrl.
Diffstat (limited to 'crypto/asn1/a_sign.c')
-rw-r--r--crypto/asn1/a_sign.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/crypto/asn1/a_sign.c b/crypto/asn1/a_sign.c
index c98dc7c332..ff63bfc7be 100644
--- a/crypto/asn1/a_sign.c
+++ b/crypto/asn1/a_sign.c
@@ -222,6 +222,19 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
int inl=0,outl=0,outll=0;
int signid, paramtype;
+ if (type == NULL)
+ {
+ int def_nid;
+ if (EVP_PKEY_get_default_digest_nid(pkey, &def_nid) > 0)
+ type = EVP_get_digestbynid(def_nid);
+ }
+
+ if (type == NULL)
+ {
+ ASN1err(ASN1_F_ASN1_ITEM_SIGN, ASN1_R_NO_DEFAULT_DIGEST);
+ return 0;
+ }
+
if (type->flags & EVP_MD_FLAG_PKEY_METHOD_SIGNATURE)
{
if (!pkey->ameth ||