Gilles Peskine 7cba859235 mbedtls_mpi_read_string: make an empty bignum for an empty string
In mbedtls_mpi_read_string, if the string is empty, return an empty bignum
rather than a bignum with one limb with the value 0.

Both representations are correct, so this is not, in principle, a
user-visible change. The change does leak however through
mbedtls_mpi_write_string in base 16 (but not in other bases), as it writes a
bignum with 0 limbs as "" but a bignum with the value 0 and at least one
limb as "00".

This change makes it possible to construct an empty bignum through
mbedtls_mpi_read_string, which is especially useful to construct test
cases (a common use of mbedtls_mpi_read_string, as most formats use in
production encode numbers in binary, to be read with mbedtls_mpi_read_binary
or mbedtls_mpi_read_binary_le).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-06-22 12:47:21 +02:00
..
2021-03-10 12:52:37 +00:00
2021-03-10 12:52:37 +00:00
2021-05-25 09:23:10 +02:00
2021-03-04 14:34:50 +00:00
2021-03-10 12:52:37 +00:00
2021-05-27 14:39:53 +02:00
2021-06-08 16:45:41 +02:00
2021-06-17 21:46:29 +02:00
2021-06-01 10:02:13 +08:00
2021-06-08 16:45:41 +02:00
2021-06-08 16:45:41 +02:00
2021-06-16 10:34:25 +02:00
2021-04-07 12:45:35 +01:00
2021-03-29 14:20:18 +01:00
2021-04-07 12:45:35 +01:00
2021-03-29 14:20:18 +01:00
2021-04-07 12:45:35 +01:00
2021-04-07 12:45:35 +01:00
2021-06-16 10:34:25 +02:00
2021-03-10 12:52:37 +00:00
2021-06-08 16:45:41 +02:00
2021-06-17 09:38:38 +02:00
2021-04-15 11:19:47 +01:00
2021-05-13 11:19:01 +02:00
2020-11-25 13:10:50 +01:00
2020-11-25 13:10:50 +01:00
2021-05-27 14:40:40 +02:00
2021-06-08 16:45:41 +02:00
2021-06-08 16:45:41 +02:00
2021-06-08 16:45:41 +02:00
2021-06-08 16:45:41 +02:00
2021-06-18 12:59:38 +02:00
2021-06-08 16:45:41 +02:00