mbedtls/tests
Gilles Peskine d48761317c 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:39:17 +02:00
..
.jenkins
configs Update copyright notices to use Linux Foundation guidance 2020-08-19 10:35:41 +02:00
data_files More precise testing of dhm_min_len 2021-04-01 14:18:31 +02:00
docker/bionic Update copyright notices to use Linux Foundation guidance 2020-08-19 10:35:41 +02:00
git-scripts Update copyright notices to use Linux Foundation guidance 2020-08-19 10:35:41 +02:00
include/test New test helper mbedtls_test_read_mpi 2021-06-22 12:38:00 +02:00
scripts Merge pull request #4385 from gilles-peskine-arm/psa-storage-format-test-algorithms 2021-05-27 17:34:29 +02:00
src New test helper mbedtls_test_read_mpi 2021-06-22 12:38:00 +02:00
suites mbedtls_mpi_read_string: make an empty bignum for an empty string 2021-06-22 12:39:17 +02:00
.gitignore Apply feedback from PR review 2020-09-07 14:01:52 +02:00
CMakeLists.txt Add missing test suites to CMakeLists.txt 2021-05-25 19:35:17 +02:00
compat-in-docker.sh Update copyright notices to use Linux Foundation guidance 2020-08-19 10:35:41 +02:00
compat.sh Fix SSL tests scripts with recent OpenSSL server with Diffie-Hellman 2021-04-01 14:06:41 +02:00
context-info.sh Merge pull request #3614 from gilles-peskine-arm/ssl-opt-gnutls-printf-development 2020-11-04 17:55:42 +01:00
Descriptions.txt Add selftest program to the list of tests 2014-04-04 16:33:01 +02:00
make-in-docker.sh Update copyright notices to use Linux Foundation guidance 2020-08-19 10:35:41 +02:00
Makefile Use Python 3 instead of Python 2 to generate test files 2021-04-22 00:25:09 +02:00
ssl-opt-in-docker.sh Update copyright notices to use Linux Foundation guidance 2020-08-19 10:35:41 +02:00
ssl-opt.sh Merge pull request #4289 from gilles-peskine-arm/openssl-dhparam-robustness-development 2021-05-21 10:16:18 +02:00