mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-06 12:40:02 +00:00
Update to TEST_EQUAL macros for easier debuggability
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
67fb0e2662
commit
799befd58e
@ -34,13 +34,13 @@ void pk_parse_keyfile_rsa(char *key_file, char *password, int result)
|
||||
res = mbedtls_pk_parse_keyfile(&ctx, key_file, pwd,
|
||||
mbedtls_test_rnd_std_rand, NULL);
|
||||
|
||||
TEST_ASSERT(res == result);
|
||||
TEST_EQUAL(res, result);
|
||||
|
||||
if (res == 0) {
|
||||
mbedtls_rsa_context *rsa;
|
||||
TEST_ASSERT(mbedtls_pk_can_do(&ctx, MBEDTLS_PK_RSA));
|
||||
rsa = mbedtls_pk_rsa(ctx);
|
||||
TEST_ASSERT(mbedtls_rsa_check_privkey(rsa) == 0);
|
||||
TEST_EQUAL(mbedtls_rsa_check_privkey(rsa), 0);
|
||||
}
|
||||
|
||||
exit:
|
||||
@ -61,13 +61,13 @@ void pk_parse_public_keyfile_rsa(char *key_file, int result)
|
||||
|
||||
res = mbedtls_pk_parse_public_keyfile(&ctx, key_file);
|
||||
|
||||
TEST_ASSERT(res == result);
|
||||
TEST_EQUAL(res, result);
|
||||
|
||||
if (res == 0) {
|
||||
mbedtls_rsa_context *rsa;
|
||||
TEST_ASSERT(mbedtls_pk_can_do(&ctx, MBEDTLS_PK_RSA));
|
||||
rsa = mbedtls_pk_rsa(ctx);
|
||||
TEST_ASSERT(mbedtls_rsa_check_pubkey(rsa) == 0);
|
||||
TEST_EQUAL(mbedtls_rsa_check_pubkey(rsa), 0);
|
||||
}
|
||||
|
||||
exit:
|
||||
@ -87,7 +87,7 @@ void pk_parse_public_keyfile_ec(char *key_file, int result)
|
||||
|
||||
res = mbedtls_pk_parse_public_keyfile(&ctx, key_file);
|
||||
|
||||
TEST_ASSERT(res == result);
|
||||
TEST_EQUAL(res, result);
|
||||
|
||||
if (res == 0) {
|
||||
TEST_ASSERT(mbedtls_pk_can_do(&ctx, MBEDTLS_PK_ECKEY));
|
||||
@ -98,7 +98,7 @@ void pk_parse_public_keyfile_ec(char *key_file, int result)
|
||||
#else
|
||||
const mbedtls_ecp_keypair *eckey;
|
||||
eckey = mbedtls_pk_ec_ro(ctx);
|
||||
TEST_ASSERT(mbedtls_ecp_check_pubkey(&eckey->grp, &eckey->Q) == 0);
|
||||
TEST_EQUAL(mbedtls_ecp_check_pubkey(&eckey->grp, &eckey->Q), 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -120,13 +120,13 @@ void pk_parse_keyfile_ec(char *key_file, char *password, int result)
|
||||
res = mbedtls_pk_parse_keyfile(&ctx, key_file, password,
|
||||
mbedtls_test_rnd_std_rand, NULL);
|
||||
|
||||
TEST_ASSERT(res == result);
|
||||
TEST_EQUAL(res, result);
|
||||
|
||||
if (res == 0) {
|
||||
TEST_ASSERT(mbedtls_pk_can_do(&ctx, MBEDTLS_PK_ECKEY));
|
||||
#if defined(MBEDTLS_ECP_C)
|
||||
const mbedtls_ecp_keypair *eckey = mbedtls_pk_ec_ro(ctx);
|
||||
TEST_ASSERT(mbedtls_ecp_check_privkey(&eckey->grp, &eckey->d) == 0);
|
||||
TEST_EQUAL(mbedtls_ecp_check_privkey(&eckey->grp, &eckey->d), 0);
|
||||
#else
|
||||
/* PSA keys are already checked on import so nothing to do here. */
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user