pk: fixing backport issues

Note: RSA is not supported in mbedtls-2.28 for opaque wrapping
so it was removed from test_suite_pkwrite.data.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
Valerio Setti 2023-05-02 16:38:57 +02:00
parent 974b816b3e
commit 0eace4128b
4 changed files with 5 additions and 15 deletions

View File

@ -672,7 +672,7 @@ int mbedtls_pk_wrap_as_opaque(mbedtls_pk_context *pk,
status = psa_import_key(&attributes, d, d_len, key);
mbedtls_platform_zeroize(d, sizeof(d));
if (status != PSA_SUCCESS) {
return PSA_PK_TO_MBEDTLS_ERR(status);
return MBEDTLS_ERR_PK_HW_ACCEL_FAILED;
}
/* make PK context wrap the key slot */

Binary file not shown.

View File

@ -94,22 +94,14 @@ Private key write check EC Brainpool 512 bits (DER)
depends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_BP512R1_ENABLED
pk_write_key_check:"data_files/ec_bp512_prv.der":TEST_DER
Derive public key RSA
depends_on:MBEDTLS_RSA_C
pk_write_public_from_private:"data_files/server1.key.der":"data_files/server1.pubkey.der"
Derive public key RSA 4096
depends_on:MBEDTLS_RSA_C
pk_write_public_from_private:"data_files/rsa4096_prv.der":"data_files/rsa4096_pub.der"
Derive public key EC 192 bits
depends_on:MBEDTLS_ECP_LIGHT:MBEDTLS_ECP_DP_SECP192R1_ENABLED
depends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP192R1_ENABLED
pk_write_public_from_private:"data_files/ec_prv.sec1.der":"data_files/ec_pub.der"
Derive public key EC 521 bits
depends_on:MBEDTLS_ECP_LIGHT:MBEDTLS_ECP_DP_SECP521R1_ENABLED
depends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP521R1_ENABLED
pk_write_public_from_private:"data_files/ec_521_prv.der":"data_files/ec_521_pub.der"
Derive public key EC Brainpool 512 bits
depends_on:MBEDTLS_ECP_LIGHT:MBEDTLS_ECP_DP_BP512R1_ENABLED
depends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_BP512R1_ENABLED
pk_write_public_from_private:"data_files/ec_bp512_prv.der":"data_files/ec_bp512_pub.der"

View File

@ -140,8 +140,7 @@ void pk_write_public_from_private(char *priv_key_file, char *pub_key_file)
mbedtls_pk_init(&priv_key);
USE_PSA_INIT();
TEST_EQUAL(mbedtls_pk_parse_keyfile(&priv_key, priv_key_file, NULL,
mbedtls_test_rnd_std_rand, NULL), 0);
TEST_EQUAL(mbedtls_pk_parse_keyfile(&priv_key, priv_key_file, NULL), 0);
TEST_EQUAL(mbedtls_pk_load_file(pub_key_file, &pub_key_raw,
&pub_key_len), 0);
@ -158,7 +157,6 @@ void pk_write_public_from_private(char *priv_key_file, char *pub_key_file)
mbedtls_platform_zeroize(derived_key_raw, sizeof(derived_key_raw));
TEST_EQUAL(mbedtls_pk_wrap_as_opaque(&priv_key, &opaque_key_id,
PSA_ALG_NONE, PSA_KEY_USAGE_EXPORT,
PSA_ALG_NONE), 0);
TEST_EQUAL(mbedtls_pk_write_pubkey_der(&priv_key, derived_key_raw,