diff options
| author | jsing <> | 2023-06-24 16:01:44 +0000 |
|---|---|---|
| committer | jsing <> | 2023-06-24 16:01:44 +0000 |
| commit | 7d512d54bfa4ced3119d0fe31adc99aa92bbc6ea (patch) | |
| tree | d032bf8af96bb9caac79fdb34b7d962c021ef65a /src/lib/libcrypto/bn/arch | |
| parent | 9e7af2e933573c645b1fd326082f5705781bac2b (diff) | |
| download | openbsd-7d512d54bfa4ced3119d0fe31adc99aa92bbc6ea.tar.gz openbsd-7d512d54bfa4ced3119d0fe31adc99aa92bbc6ea.tar.bz2 openbsd-7d512d54bfa4ced3119d0fe31adc99aa92bbc6ea.zip | |
Rewrite and simplify bn_sqr()/bn_sqr_normal().
Rework bn_sqr()/bn_sqr_normal() so that it is less convoluted and more
readable. Instead of recomputing values that the caller has already
computed, pass it as an argument. Avoid branching and remove duplication
of variables. Consistently use a_len and r_len naming for lengths.
ok tb@
Diffstat (limited to 'src/lib/libcrypto/bn/arch')
| -rw-r--r-- | src/lib/libcrypto/bn/arch/amd64/bn_arch.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/libcrypto/bn/arch/amd64/bn_arch.c b/src/lib/libcrypto/bn/arch/amd64/bn_arch.c index 55275aa14e..a377a05681 100644 --- a/src/lib/libcrypto/bn/arch/amd64/bn_arch.c +++ b/src/lib/libcrypto/bn/arch/amd64/bn_arch.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_arch.c,v 1.6 2023/02/22 05:46:37 jsing Exp $ */ | 1 | /* $OpenBSD: bn_arch.c,v 1.7 2023/06/24 16:01:44 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -96,9 +96,9 @@ bn_mul_comba8(BN_ULONG *rd, BN_ULONG *ad, BN_ULONG *bd) | |||
| 96 | 96 | ||
| 97 | #ifdef HAVE_BN_SQR | 97 | #ifdef HAVE_BN_SQR |
| 98 | int | 98 | int |
| 99 | bn_sqr(BIGNUM *r, const BIGNUM *a, int rn, BN_CTX *ctx) | 99 | bn_sqr(BIGNUM *r, const BIGNUM *a, int r_len, BN_CTX *ctx) |
| 100 | { | 100 | { |
| 101 | bignum_sqr(rn, (uint64_t *)r->d, a->top, (uint64_t *)a->d); | 101 | bignum_sqr(r_len, (uint64_t *)r->d, a->top, (uint64_t *)a->d); |
| 102 | 102 | ||
| 103 | return 1; | 103 | return 1; |
| 104 | } | 104 | } |
