mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-26 00:25:35 +00:00
77f55c9b00
Replace the two test functions mbedtls_mpi_copy_sint (supporting signed inputs but always with exactly one limb) and mbedtls_mpi_copy_binary (supporting arbitrary-sized inputs but not negative inputs) by a single function that supports both arbitrary-sized inputs and arbitrary-signed inputs. This will allows testing combinations like negative source and zero-sized destination. Also generalize mpi_copy_self to support arbitrary inputs. Generate a new list of test cases systematically enumerating all possibilities among various categories: zero with 0 or 1 limb, negative or positive with 1 limb, negative or positive with >1 limb. I used the following Perl script: ``` sub rhs { $_ = $_[0]; s/bead/beef/; s/ca5cadedb01dfaceacc01ade/face1e55ca11ab1ecab005e5/; $_ } %v = ( "zero (null)" => "", "zero (1 limb)" => "0", "small positive" => "bead", "large positive" => "ca5cadedb01dfaceacc01ade", "small negative" => "-bead", "large negative" => "-ca5cadedb01dfaceacc01ade", ); foreach $s (sort keys %v) { foreach $d (sort keys %v) { printf "Copy %s to %s\nmbedtls_mpi_copy:\"%s\":\"%s\"\n\n", $s, $d, $v{$s}, rhs($v{$d}); } } foreach $s (sort keys %v) { printf "Copy self: %s\nmpi_copy_self:\"%s\"\n\n", $s, $v{$s}; } ``` Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com> |
||
---|---|---|
.. | ||
.jenkins | ||
configs | ||
data_files | ||
docker/bionic | ||
git-scripts | ||
include/test | ||
scripts | ||
src | ||
suites | ||
.gitignore | ||
CMakeLists.txt | ||
compat-in-docker.sh | ||
compat.sh | ||
context-info.sh | ||
Descriptions.txt | ||
make-in-docker.sh | ||
Makefile | ||
ssl-opt-in-docker.sh | ||
ssl-opt.sh |