summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/recallocarray.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2023-02-22Replace bn_sub_part_words() with bn_sub().jsing4-370/+19
Now that bn_sub() handles word arrays with potentially different lengths, we no longer need bn_sub_part_words() - call bn_sub() instead. This allows us to entirely remove the unnecessarily complex bn_sub_part_words() code. ok tb@
2023-02-22Rework bn_add()/bn_sub() to operate on word arrays.jsing3-82/+99
Rather than working on BIGNUMs, change bn_add()/bn_sub() to operate on word arrays that potentially differ in length. This matches the behaviour of s2n-bignum's bignum_add() and bignum_sub(). ok tb@
2023-02-22Rewrite and simplify BN_MONT_CTX_set()jsing2-98/+76
OpenSSL commit 4d524040bc8 changed BN_MONT_CTX_set() so that it computed a 64 bit N^-1 on both BN_BITS2 == 32 and BN_BITS2 == 64 platforms. However, the way in which this was done was to duplicate half the code and wrap it in #ifdef. Rewrite this code to use a single code path on all platforms, with #ifdef being limited to setting an additional word in the temporary N and storing the result on BN_BITS2 == 32 platforms. Also remove stack based BIGNUM in favour of using the already present BN_CTX. ok tb@
2023-02-21perlasm: properly spell .rodata for macOS on inteltb1-0/+3
ok jsing
2023-02-21remove extra argumentbcook1-2/+2
ok tb@
2023-02-21Unifdef MONT_WORD.jsing2-75/+5
It does not make sense to use code that is slower, currently broken and prevents the use of assembly Montgomery implementations. This is the result of `unifdef -m -DMONT_WORD`, followed by some manual clean up and the removal of the Ni bignum from BN_MONT_CTX (which was only used in the non-MONT_WORD case). ok miod@ tb@
2023-02-19Move BN_MONT_CTX back to bn_local.h for now. It's still used by bn_exp.ctb2-14/+14
2023-02-19Rewrite BN_MONT_CTX_set_locked()jsing1-23/+27
Rewrite and simplify BN_MONT_CTX_set_locked - in particular, only hold the lock for a short period of time, rather than holding a write lock for a module across an expensive operation. ok tb@
2023-02-19First pass clean up of bn_mont.c.jsing1-31/+37
Use calloc() rather than malloc() with manual initialisation of all struct members to zero, use memset() instead of manually initialising all struct members to zero, use consistent naming, use BN_free() instead of BN_clear_free() (since it is the same thing). ok tb@
2023-02-19Move BN_MONT_CTX_copy().jsing1-19/+19
2023-02-19Move struct bn_mont_ctx_st from bn_local.h to bn_mont.c.jsing2-14/+14
No code outside of bn_mont.c needs access to it. ok tb@
2023-02-17Provide optimised versions of bn_addw() and bn_subw() for aarch64.jsing1-1/+35
2023-02-17Remove now unused tangle of mul*/sqr* and BN_UMULT_* macros.jsing1-251/+1
No, I'm not trying to overwhelm you... however, we really no longer need this clutter. ok tb@
2023-02-17Reimplement bn_sqr_comba{4,8}().jsing2-102/+110
Use bignum primitives rather than the current mess of macros.The sqr_add_c macro gets replaced with bn_mulw_addtw(), while the sqr_add_c2 macro gets replaced with bn_mul2_mulw_addtw(). The variables in the comba functions have also been reordered, so that the patterns are easier to understand - the compiler can take care of optimising the inputs and outputs to avoid register moves. ok tb@
2023-02-16Enable s2n-bignum word_clz() on amd64.jsing4-4/+17
The BN_num_bits_word() function is a hot path, being called more than 80 million times during a libcrypto regress run. The word_clz() implementation uses five instructions to do the same as the generic code that uses more than 60 instructions. Discussed with tb@
2023-02-16Use bn_addw() in bn_mulw(), rather than duplicating add with carry code.jsing1-12/+7
2023-02-16Change include from _internal_s2n_bignum.h to s2n_bignum_internal.h.jsing1-1/+1
2023-02-16Include the ISC license from s2n-bignum's LICENSE file.jsing1-1/+12