mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-06 01:13:49 +00:00
Improve readability of null-argument tests
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
39b7bba8a0
commit
5d867872dd
@ -1401,17 +1401,21 @@ void ecp_export(int id, char *Qx, char *Qy, char *d, int expected_ret, int inval
|
||||
TEST_EQUAL(export_grp.id,
|
||||
mbedtls_ecp_keypair_get_group_id(&key));
|
||||
|
||||
/* Test null arguments */
|
||||
/* Test null arguments: grp only */
|
||||
mbedtls_ecp_group_free(&export_grp);
|
||||
mbedtls_mpi_free(&export_d);
|
||||
mbedtls_ecp_point_free(&export_Q);
|
||||
mbedtls_ecp_group_init(&export_grp);
|
||||
mbedtls_mpi_init(&export_d);
|
||||
mbedtls_ecp_point_init(&export_Q);
|
||||
TEST_EQUAL(mbedtls_ecp_export(&key, &export_grp, NULL, NULL), 0);
|
||||
TEST_EQUAL(mbedtls_ecp_group_cmp(&key.grp, &export_grp), 0);
|
||||
|
||||
/* Test null arguments: d only */
|
||||
mbedtls_mpi_free(&export_d);
|
||||
mbedtls_mpi_init(&export_d);
|
||||
TEST_EQUAL(mbedtls_ecp_export(&key, NULL, &export_d, NULL), 0);
|
||||
TEST_EQUAL(mbedtls_mpi_cmp_mpi(&key.d, &export_d), 0);
|
||||
|
||||
/* Test null arguments: Q only */
|
||||
mbedtls_ecp_point_free(&export_Q);
|
||||
mbedtls_ecp_point_init(&export_Q);
|
||||
TEST_EQUAL(mbedtls_ecp_export(&key, NULL, NULL, &export_Q), 0);
|
||||
TEST_EQUAL(mbedtls_ecp_point_cmp(&key.Q, &export_Q), 0);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user