Stop supporting non-canonical case in mpi_write_string test data
We're using the non-standard function strcasecmp() just so that the case of digits beyond 9 can be different in the library and in the test data. Use matching case in the test data, and use a standard function for the comparison. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
ad450d5a92
commit
017f0b7369
2 changed files with 3 additions and 3 deletions
|
@ -133,7 +133,7 @@ void mpi_read_write_string(int radix_X, char *input_X, int radix_A,
|
|||
TEST_ASSERT(sign_is_valid(&X));
|
||||
TEST_ASSERT(mbedtls_mpi_write_string(&X, radix_A, str, output_size, &len) == result_write);
|
||||
if (result_write == 0) {
|
||||
TEST_ASSERT(strcasecmp(str, input_A) == 0);
|
||||
TEST_ASSERT(strcmp(str, input_A) == 0);
|
||||
TEST_ASSERT(str[len] == '!');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,10 +56,10 @@ Test mpi_read_write_string #5 (Illegal output radix)
|
|||
mpi_read_write_string:16:"-23":17:"-23":4:0:MBEDTLS_ERR_MPI_BAD_INPUT_DATA
|
||||
|
||||
Test mpi_read_write_string #6 (Output radix of 15)
|
||||
mpi_read_write_string:10:"29":15:"1e":100:0:0
|
||||
mpi_read_write_string:10:"29":15:"1E":100:0:0
|
||||
|
||||
Test mpi_read_write_string #7
|
||||
mpi_read_write_string:10:"56125680981752282334141896320372489490613963693556392520816017892111350604111697682705498319512049040516698827829292076808006940873974979584527073481012636016353913462376755556720019831187364993587901952757307830896531678727717924":16:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":200:0:0
|
||||
mpi_read_write_string:10:"56125680981752282334141896320372489490613963693556392520816017892111350604111697682705498319512049040516698827829292076808006940873974979584527073481012636016353913462376755556720019831187364993587901952757307830896531678727717924":16:"0941379D00FED1491FE15DF284DFDE4A142F68AA8D412023195CEE66883E6290FFE703F4EA5963BF212713CEE46B107C09182B5EDCD955ADAC418BF4918E2889AF48E1099D513830CEC85C26AC1E158B52620E33BA8692F893EFBB2F958B4424":200:0:0
|
||||
|
||||
Test mpi_read_write_string #8 (Empty MPI hex -> hex)
|
||||
mpi_read_write_string:16:"":16:"":4:0:0
|
||||
|
|
Loading…
Reference in a new issue