summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/ecdsa/ecs_ossl.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lib/libcrypto/ecdsa/ecs_ossl.c b/src/lib/libcrypto/ecdsa/ecs_ossl.c
index 6f45e173b8..f169b06bd5 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.27 2023/03/04 21:37:37 tb Exp $ */ 1/* $OpenBSD: ecs_ossl.c,v 1.28 2023/03/04 21:39:34 tb Exp $ */
2/* 2/*
3 * Written by Nils Larsch for the OpenSSL project 3 * Written by Nils Larsch for the OpenSSL project
4 */ 4 */
@@ -168,8 +168,13 @@ ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)
168 goto err; 168 goto err;
169 } 169 }
170 170
171 /* Reject curves with an order that is smaller than 80 bits. */
172 if ((order_bits = BN_num_bits(order)) < 80) {
173 ECDSAerror(EC_R_INVALID_GROUP_ORDER);
174 goto err;
175 }
176
171 /* Preallocate space. */ 177 /* Preallocate space. */
172 order_bits = BN_num_bits(order);
173 if (!BN_set_bit(k, order_bits) || 178 if (!BN_set_bit(k, order_bits) ||
174 !BN_set_bit(r, order_bits) || 179 !BN_set_bit(r, order_bits) ||
175 !BN_set_bit(X, order_bits)) 180 !BN_set_bit(X, order_bits))