Rewrite and simplify bn_sqr()/bn_sqr_normal().
authorjsing <jsing@openbsd.org>
Sat, 24 Jun 2023 16:01:43 +0000 (16:01 +0000)
committerjsing <jsing@openbsd.org>
Sat, 24 Jun 2023 16:01:43 +0000 (16:01 +0000)
commit89b63e67c9599df152379da0271869384a946834
treeb5a6d1f6a63eb4f923be309052c9f305c0082024
parent9f358229f560da5f55a5f334c28bd543d12a1476
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@
lib/libcrypto/bn/arch/amd64/bn_arch.c
lib/libcrypto/bn/bn_local.h
lib/libcrypto/bn/bn_sqr.c