mbedtls icon indicating copy to clipboard operation
mbedtls copied to clipboard

Document that bignum_core doesn't handle zero-length arrays

Open gilles-peskine-arm opened this issue 2 years ago • 0 comments

Arithmetic on the singleton set {0} isn't useful, so there's no point in supporting zero-length numbers in bignum_core. This is different from bignum which manipulates variable-length numbers and a zero-length array, with a null pointer, is a perfectly cromulent representation of 0. Likewise bignum_mod and bignum_mod_raw don't need to work with modulo 1 so they never need to manipulate zero-length limb arrays.

  • Document this in bignum_core.h.
  • Remove any support for zero-length-with-null-pointer in bignum_core.c.
  • See if there's any functions in bignum_mod_raw and bignum_mod where this applies as well.

gilles-peskine-arm avatar Sep 13 '22 10:09 gilles-peskine-arm