summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2024-10-19 14:41:03 +0000
committertb <>2024-10-19 14:41:03 +0000
commit1a5acb1b1fd2ab9eae1e453383537b4a9ac34758 (patch)
tree626ff35bb6fd7fdadbdeafd6d80dbf42afab6626 /src
parent22b1f3513b26822408c126cddac5ac67e5f0dada (diff)
downloadopenbsd-1a5acb1b1fd2ab9eae1e453383537b4a9ac34758.tar.gz
openbsd-1a5acb1b1fd2ab9eae1e453383537b4a9ac34758.tar.bz2
openbsd-1a5acb1b1fd2ab9eae1e453383537b4a9ac34758.zip
Make ec EVP_PKEY_CTRL_MD handler match dsa/rsa more closely
This makes the thing a bit easier on the eyes and improves greppability. ok joshua jsing
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/ec/ec_pmeth.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/lib/libcrypto/ec/ec_pmeth.c b/src/lib/libcrypto/ec/ec_pmeth.c
index d422765b00..424d1896b2 100644
--- a/src/lib/libcrypto/ec/ec_pmeth.c
+++ b/src/lib/libcrypto/ec/ec_pmeth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_pmeth.c,v 1.22 2024/08/26 22:01:28 op Exp $ */ 1/* $OpenBSD: ec_pmeth.c,v 1.23 2024/10/19 14:41:03 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -381,16 +381,19 @@ pkey_ec_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
381 381
382 case EVP_PKEY_CTRL_MD: 382 case EVP_PKEY_CTRL_MD:
383 /* RFC 3279, RFC 5758 and NIST CSOR. */ 383 /* RFC 3279, RFC 5758 and NIST CSOR. */
384 if (EVP_MD_type((const EVP_MD *) p2) != NID_sha1 && 384 switch (EVP_MD_type(p2)) {
385 EVP_MD_type((const EVP_MD *) p2) != NID_ecdsa_with_SHA1 && 385 case NID_sha1:
386 EVP_MD_type((const EVP_MD *) p2) != NID_sha224 && 386 case NID_ecdsa_with_SHA1:
387 EVP_MD_type((const EVP_MD *) p2) != NID_sha256 && 387 case NID_sha224:
388 EVP_MD_type((const EVP_MD *) p2) != NID_sha384 && 388 case NID_sha256:
389 EVP_MD_type((const EVP_MD *) p2) != NID_sha512 && 389 case NID_sha384:
390 EVP_MD_type((const EVP_MD *) p2) != NID_sha3_224 && 390 case NID_sha512:
391 EVP_MD_type((const EVP_MD *) p2) != NID_sha3_256 && 391 case NID_sha3_224:
392 EVP_MD_type((const EVP_MD *) p2) != NID_sha3_384 && 392 case NID_sha3_256:
393 EVP_MD_type((const EVP_MD *) p2) != NID_sha3_512) { 393 case NID_sha3_384:
394 case NID_sha3_512:
395 break;
396 default:
394 ECerror(EC_R_INVALID_DIGEST_TYPE); 397 ECerror(EC_R_INVALID_DIGEST_TYPE);
395 return 0; 398 return 0;
396 } 399 }