summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authortb <>2023-07-03 10:19:52 +0000
committertb <>2023-07-03 10:19:52 +0000
commit094db396b7bc3dec23cc6b9bfda2ab7919e94f1e (patch)
treef687a2d461f2a0ef1f6341afe631b02ffe17444d /src/lib
parent0026b7ca5bbba5106dd393b716300a418e28c654 (diff)
downloadopenbsd-094db396b7bc3dec23cc6b9bfda2ab7919e94f1e.tar.gz
openbsd-094db396b7bc3dec23cc6b9bfda2ab7919e94f1e.tar.bz2
openbsd-094db396b7bc3dec23cc6b9bfda2ab7919e94f1e.zip
Switch a couple of test from ucmp to cmp
This is confusing, as both sides involved should be unsigned. The ec code is undecided on whether the group order can be negative. It should never be, so lets see what happen with this slightly stricter check. discussed with jsing
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/ecdsa/ecs_ossl.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/libcrypto/ecdsa/ecs_ossl.c b/src/lib/libcrypto/ecdsa/ecs_ossl.c
index 509bcc7625..e52cacbf12 100644
--- a/src/lib/libcrypto/ecdsa/ecs_ossl.c
+++ b/src/lib/libcrypto/ecdsa/ecs_ossl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ecs_ossl.c,v 1.55 2023/07/03 10:16:14 tb Exp $ */ 1/* $OpenBSD: ecs_ossl.c,v 1.56 2023/07/03 10:19:52 tb Exp $ */
2/* 2/*
3 * Written by Nils Larsch for the OpenSSL project 3 * Written by Nils Larsch for the OpenSSL project
4 */ 4 */
@@ -499,8 +499,8 @@ ossl_ecdsa_verify_sig(const unsigned char *dgst, int dgst_len, const ECDSA_SIG *
499 } 499 }
500 500
501 /* Verify that r and s are in the range [1, order). */ 501 /* Verify that r and s are in the range [1, order). */
502 if (BN_cmp(sig->r, BN_value_one()) < 0 || BN_ucmp(sig->r, order) >= 0 || 502 if (BN_cmp(sig->r, BN_value_one()) < 0 || BN_cmp(sig->r, order) >= 0 ||
503 BN_cmp(sig->s, BN_value_one()) < 0 || BN_ucmp(sig->s, order) >= 0) { 503 BN_cmp(sig->s, BN_value_one()) < 0 || BN_cmp(sig->s, order) >= 0) {
504 ECDSAerror(ECDSA_R_BAD_SIGNATURE); 504 ECDSAerror(ECDSA_R_BAD_SIGNATURE);
505 ret = 0; 505 ret = 0;
506 goto err; 506 goto err;
@@ -541,7 +541,7 @@ ossl_ecdsa_verify_sig(const unsigned char *dgst, int dgst_len, const ECDSA_SIG *
541 } 541 }
542 542
543 /* If the signature is correct, the x-coordinate is equal to sig->r. */ 543 /* If the signature is correct, the x-coordinate is equal to sig->r. */
544 ret = (BN_ucmp(u1, sig->r) == 0); 544 ret = (BN_cmp(u1, sig->r) == 0);
545 545
546 err: 546 err:
547 BN_CTX_end(ctx); 547 BN_CTX_end(ctx);