CVSROOT: /cvs Module name: src Changes by: js...@cvs.openbsd.org 2023/02/02 11:39:26
Modified files: lib/libcrypto/bn: bn_add.c lib/libcrypto/bn/arch/amd64: bn_arch.c bn_arch.h Log message: Refactor BN_uadd() and BN_usub(). Unlike bn_add_words()/bn_sub_words(), the s2n-bignum bignum_add() and bignum_sub() functions correctly handle inputs with differing word lengths. This means that they can be called directly, without needing to fix up any remaining words manually. Split BN_uadd() in two - the default bn_add() implementation calls bn_add_words(), before handling the carry for any remaining words. Likewise split BN_usub() in two - the default bn_sub() implementation calls bn_sub_words(), before handling the borrow for any remaining words. On amd64, provide an implementation of bn_add() that calls s2n-bignum's bignum_add() directly, similarly with an implementation of bn_sub() that calls s2n-bignum's bignum_sub() directly. ok tb@