aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/ec/ec_ameth.c
diff options
context:
space:
mode:
authorNils Larsch <nils@openssl.org>2006-12-20 08:58:54 +0000
committerNils Larsch <nils@openssl.org>2006-12-20 08:58:54 +0000
commit06e2dd037e29f82b92e1d1b9454f1595e602fb94 (patch)
tree9711ac003640b564cbc08c8a6b2be656a490d5e9 /crypto/ec/ec_ameth.c
parent34f0a1930928bba6902b8b6d5217bc6bd667f5c7 (diff)
downloadopenssl-06e2dd037e29f82b92e1d1b9454f1595e602fb94.tar.gz
add support for ecdsa-with-sha256 etc.
Diffstat (limited to 'crypto/ec/ec_ameth.c')
-rw-r--r--crypto/ec/ec_ameth.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/crypto/ec/ec_ameth.c b/crypto/ec/ec_ameth.c
index e52a347c86..6c46afb503 100644
--- a/crypto/ec/ec_ameth.c
+++ b/crypto/ec/ec_ameth.c
@@ -577,12 +577,17 @@ static int ec_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
case ASN1_PKEY_CTRL_PKCS7_SIGN:
if (arg1 == 0)
{
+ int snid, hnid;
X509_ALGOR *alg1, *alg2;
PKCS7_SIGNER_INFO_get0_algs(arg2, NULL, &alg1, &alg2);
- X509_ALGOR_set0(alg1, OBJ_nid2obj(NID_sha1),
- V_ASN1_NULL, 0);
- X509_ALGOR_set0(alg2, OBJ_nid2obj(NID_ecdsa_with_SHA1),
- V_ASN1_NULL, 0);
+ if (alg1 == NULL || alg1->algorithm == NULL)
+ return -1;
+ hnid = OBJ_obj2nid(alg1->algorithm);
+ if (hnid == NID_undef)
+ return -1;
+ if (!OBJ_find_sigid_by_algs(&snid, hnid, EVP_PKEY_id(pkey)))
+ return -1;
+ X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF, 0);
}
return 1;