diff options
author | Nils Larsch <nils@openssl.org> | 2006-12-20 08:58:54 +0000 |
---|---|---|
committer | Nils Larsch <nils@openssl.org> | 2006-12-20 08:58:54 +0000 |
commit | 06e2dd037e29f82b92e1d1b9454f1595e602fb94 (patch) | |
tree | 9711ac003640b564cbc08c8a6b2be656a490d5e9 /crypto/ec | |
parent | 34f0a1930928bba6902b8b6d5217bc6bd667f5c7 (diff) |
add support for ecdsa-with-sha256 etc.
Diffstat (limited to 'crypto/ec')
-rw-r--r-- | crypto/ec/ec_ameth.c | 13 | ||||
-rw-r--r-- | crypto/ec/ec_pmeth.c | 6 |
2 files changed, 14 insertions, 5 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; diff --git a/crypto/ec/ec_pmeth.c b/crypto/ec/ec_pmeth.c index 4621e765ff..3f137b892a 100644 --- a/crypto/ec/ec_pmeth.c +++ b/crypto/ec/ec_pmeth.c @@ -220,7 +220,11 @@ static int pkey_ec_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) return 1; case EVP_PKEY_CTRL_MD: - if (EVP_MD_type((const EVP_MD *)p2) != NID_sha1) + if (EVP_MD_type((const EVP_MD *)p2) != NID_sha1 && + EVP_MD_type((const EVP_MD *)p2) != NID_sha224 && + EVP_MD_type((const EVP_MD *)p2) != NID_sha256 && + EVP_MD_type((const EVP_MD *)p2) != NID_sha384 && + EVP_MD_type((const EVP_MD *)p2) != NID_sha512) { ECerr(EC_F_PKEY_EC_CTRL, EC_R_INVALID_DIGEST_TYPE); return 0; |