summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn/bn_mul.c
diff options
context:
space:
mode:
authorjsing <>2025-08-14 15:15:04 +0000
committerjsing <>2025-08-14 15:15:04 +0000
commit6dbe806d026a9b65d3decbcd23fb9b70559bf259 (patch)
treed0afe5bc55538052cd45c7476d88a196270c27f2 /src/lib/libcrypto/bn/bn_mul.c
parent07bac2b524750c4dfd196516fe31b97d149acde4 (diff)
downloadopenbsd-6dbe806d026a9b65d3decbcd23fb9b70559bf259.tar.gz
openbsd-6dbe806d026a9b65d3decbcd23fb9b70559bf259.tar.bz2
openbsd-6dbe806d026a9b65d3decbcd23fb9b70559bf259.zip
Add special handling for multiplication and squaring of BNs with six words.
In these cases make use of bn_mul_comba6() or bn_sqr_comba6(), which are faster than the normal path. ok tb@
Diffstat (limited to 'src/lib/libcrypto/bn/bn_mul.c')
-rw-r--r--src/lib/libcrypto/bn/bn_mul.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/libcrypto/bn/bn_mul.c b/src/lib/libcrypto/bn/bn_mul.c
index 70f6534b8f..a30d05fb02 100644
--- a/src/lib/libcrypto/bn/bn_mul.c
+++ b/src/lib/libcrypto/bn/bn_mul.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_mul.c,v 1.42 2025/08/05 15:06:13 jsing Exp $ */ 1/* $OpenBSD: bn_mul.c,v 1.43 2025/08/14 15:15:04 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -407,6 +407,8 @@ BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
407 407
408 if (a->top == 4 && b->top == 4) { 408 if (a->top == 4 && b->top == 4) {
409 bn_mul_comba4(rr->d, a->d, b->d); 409 bn_mul_comba4(rr->d, a->d, b->d);
410 } else if (a->top == 6 && b->top == 6) {
411 bn_mul_comba6(rr->d, a->d, b->d);
410 } else if (a->top == 8 && b->top == 8) { 412 } else if (a->top == 8 && b->top == 8) {
411 bn_mul_comba8(rr->d, a->d, b->d); 413 bn_mul_comba8(rr->d, a->d, b->d);
412 } else { 414 } else {