test: check for exact length of returned pub key

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
Valerio Setti 2023-04-27 12:07:23 +02:00
parent f5451717af
commit 9a855f21aa

View file

@ -149,8 +149,8 @@ void pk_write_public_from_private(char *priv_key_file, char *pub_key_file)
derived_key_len = pub_key_len;
ASSERT_ALLOC(derived_key_raw, derived_key_len);
TEST_LE_U(1, mbedtls_pk_write_pubkey_der(&priv_key, derived_key_raw,
derived_key_len));
TEST_EQUAL(mbedtls_pk_write_pubkey_der(&priv_key, derived_key_raw,
derived_key_len), pub_key_len);
ASSERT_COMPARE(derived_key_raw, derived_key_len,
pub_key_raw, pub_key_len);
@ -162,8 +162,8 @@ void pk_write_public_from_private(char *priv_key_file, char *pub_key_file)
PSA_ALG_NONE, PSA_KEY_USAGE_EXPORT,
PSA_ALG_NONE), 0);
TEST_LE_U(1, mbedtls_pk_write_pubkey_der(&priv_key, derived_key_raw,
derived_key_len));
TEST_EQUAL(mbedtls_pk_write_pubkey_der(&priv_key, derived_key_raw,
derived_key_len), pub_key_len);
ASSERT_COMPARE(derived_key_raw, derived_key_len,
pub_key_raw, pub_key_len);