Skip to content

Commit 6eac604

Browse files
committed
PSA Crypto TEST App Changes,Including Wrapper keys
1 parent 030d95c commit 6eac604

File tree

7 files changed

+137
-63
lines changed

7 files changed

+137
-63
lines changed

soc/silabs/silabs_siwx917/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,9 @@ config MBEDTLS_USER_CONFIG_FILE
2121
default "sl_mbedtls_config_zephyr.h" \
2222
if PSA_CRYPTO_DRIVER_SILABS_SIWX91X
2323

24+
config TEST_WRAPPED_KEYS
25+
bool "wrapper keys"
26+
default n
27+
2428
endif
2529
endif

tests/crypto/psa_crypto/src/aead.c

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
#include <zephyr/ztest.h>
88
#include <psa/crypto.h>
99

10+
#if defined CONFIG_TEST_WRAPPED_KEYS
11+
#include "sl_si91x_psa_wrap.h"
12+
#endif
13+
1014
const uint8_t aes_key_buf[] = {0xea, 0x4f, 0x6f, 0x3c, 0x2f, 0xed, 0x2b, 0x9d,
1115
0xd9, 0x70, 0x8c, 0x2e, 0x72, 0x1a, 0xe0, 0x0f};
1216
const uint8_t aes_nonce_buf[] = {0xf9, 0x75, 0x80, 0x9d, 0xdb, 0x51,
@@ -45,6 +49,7 @@ const uint8_t chachapoly_expect_cipher_tag_buf[] = {
4549

4650
ZTEST(psa_crypto_test, test_aead_aes_ccm)
4751
{
52+
4853
const uint8_t expect_cipher_tag_buf[] = {
4954
0xe2, 0x2f, 0x37, 0x3b, 0xeb, 0xf6, 0x4a, 0x3e, 0x9b, 0x87, 0x75, 0x2b, 0xf9,
5055
0xdb, 0x34, 0xdc, 0x4d, 0x43, 0x3f, 0x00, 0xf5, 0x5c, 0x3f, 0x53, 0x0c, 0x89,
@@ -61,16 +66,22 @@ ZTEST(psa_crypto_test, test_aead_aes_ccm)
6166
psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT);
6267
psa_set_key_algorithm(&attributes, alg);
6368

69+
#if defined(CONFIG_TEST_WRAPPED_KEYS) && CONFIG_TEST_WRAPPED_KEYS
70+
printf("Test Wrapper keys enabled\n");
71+
psa_set_key_lifetime(&attributes, PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(
72+
PSA_KEY_PERSISTENCE_VOLATILE, PSA_KEY_VOLATILE_PERSISTENT_WRAP_IMPORT));
73+
#endif
6474
zassert_equal(psa_import_key(&attributes, aes_key_buf, sizeof(aes_key_buf), &key_id),
6575
PSA_SUCCESS, "Failed to import key");
66-
76+
6777
zassert_equal(psa_aead_encrypt(key_id, alg, aes_nonce_buf, sizeof(aes_nonce_buf),
6878
aes_ad_buf, sizeof(aes_ad_buf), aes_plaintext,
6979
sizeof(aes_plaintext), cipher_tag_buf,
7080
sizeof(cipher_tag_buf), &out_len),
71-
PSA_SUCCESS, "Failed to encrypt");
72-
81+
PSA_SUCCESS, "Failed to perform encrypt");
82+
7383
zassert_equal(out_len, sizeof(expect_cipher_tag_buf));
84+
7485
zassert_mem_equal(cipher_tag_buf, expect_cipher_tag_buf, sizeof(expect_cipher_tag_buf));
7586

7687
zassert_equal(psa_aead_decrypt(key_id, alg, aes_nonce_buf, sizeof(aes_nonce_buf),
@@ -79,13 +90,16 @@ ZTEST(psa_crypto_test, test_aead_aes_ccm)
7990
PSA_SUCCESS, "Failed to decrypt");
8091

8192
zassert_equal(out_len, sizeof(aes_plaintext));
93+
8294
zassert_mem_equal(decrypted, aes_plaintext, sizeof(aes_plaintext));
8395

8496
zassert_equal(psa_destroy_key(key_id), PSA_SUCCESS, "Failed to destroy key");
97+
8598
}
8699

87100
ZTEST(psa_crypto_test, test_aead_aes_gcm)
88101
{
102+
89103
const uint8_t expect_cipher_tag_buf[] = {
90104
0x0f, 0x51, 0xf7, 0xa8, 0x3c, 0x5b, 0x5a, 0xa7, 0x96, 0xb9, 0x70, 0x25, 0x9c,
91105
0xdd, 0xfe, 0x8f, 0x9a, 0x15, 0xa5, 0xc5, 0xeb, 0x48, 0x5a, 0xf5, 0x78, 0xfb,
@@ -102,16 +116,22 @@ ZTEST(psa_crypto_test, test_aead_aes_gcm)
102116
psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT);
103117
psa_set_key_algorithm(&attributes, alg);
104118

119+
#if defined(CONFIG_TEST_WRAPPED_KEYS) && CONFIG_TEST_WRAPPED_KEYS
120+
printf("Test Wrapper keys enabled\n");
121+
psa_set_key_lifetime(&attributes, PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(
122+
PSA_KEY_PERSISTENCE_VOLATILE, PSA_KEY_VOLATILE_PERSISTENT_WRAP_IMPORT));
123+
#endif
105124
zassert_equal(psa_import_key(&attributes, aes_key_buf, sizeof(aes_key_buf), &key_id),
106125
PSA_SUCCESS, "Failed to import key");
107126

108127
zassert_equal(psa_aead_encrypt(key_id, alg, aes_nonce_buf, sizeof(aes_nonce_buf),
109128
aes_ad_buf, sizeof(aes_ad_buf), aes_plaintext,
110129
sizeof(aes_plaintext), cipher_tag_buf,
111130
sizeof(cipher_tag_buf), &out_len),
112-
PSA_SUCCESS, "Failed to encrypt");
113-
131+
PSA_SUCCESS, "Failed to perform encrypt");
132+
114133
zassert_equal(out_len, sizeof(expect_cipher_tag_buf));
134+
115135
zassert_mem_equal(cipher_tag_buf, expect_cipher_tag_buf, sizeof(expect_cipher_tag_buf));
116136

117137
zassert_equal(psa_aead_decrypt(key_id, alg, aes_nonce_buf, sizeof(aes_nonce_buf),
@@ -120,13 +140,16 @@ ZTEST(psa_crypto_test, test_aead_aes_gcm)
120140
PSA_SUCCESS, "Failed to decrypt");
121141

122142
zassert_equal(out_len, sizeof(aes_plaintext));
143+
123144
zassert_mem_equal(decrypted, aes_plaintext, sizeof(aes_plaintext));
124145

125146
zassert_equal(psa_destroy_key(key_id), PSA_SUCCESS, "Failed to destroy key");
147+
126148
}
127149

128150
ZTEST(psa_crypto_test, test_aead_chacha20_poly1305)
129151
{
152+
130153
uint8_t cipher_tag_buf[130]; /* Ciphertext + Tag */
131154
uint8_t decrypted[sizeof(chachapoly_plaintext)] = {0};
132155
size_t out_len;
@@ -139,29 +162,36 @@ ZTEST(psa_crypto_test, test_aead_chacha20_poly1305)
139162
psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT);
140163
psa_set_key_algorithm(&attributes, alg);
141164

142-
zassert_equal(psa_import_key(&attributes, chachapoly_key_buf, sizeof(chachapoly_key_buf),
143-
&key_id),
165+
#if defined(CONFIG_TEST_WRAPPED_KEYS) && CONFIG_TEST_WRAPPED_KEYS
166+
printf("Test Wrapper keys enabled\n");
167+
psa_set_key_lifetime(&attributes, PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(
168+
PSA_KEY_PERSISTENCE_VOLATILE, PSA_KEY_VOLATILE_PERSISTENT_WRAP_IMPORT));
169+
#endif
170+
zassert_equal(psa_import_key(&attributes, chachapoly_key_buf, sizeof(chachapoly_key_buf), &key_id),
144171
PSA_SUCCESS, "Failed to import key");
145-
172+
146173
zassert_equal(psa_aead_encrypt(key_id, alg, chachapoly_nonce_buf,
147174
sizeof(chachapoly_nonce_buf), chachapoly_ad_buf,
148175
sizeof(chachapoly_ad_buf), chachapoly_plaintext,
149176
sizeof(chachapoly_plaintext), cipher_tag_buf,
150177
sizeof(cipher_tag_buf), &out_len),
151-
PSA_SUCCESS, "Failed to encrypt");
152-
178+
PSA_SUCCESS, "Failed to perform encrypt");
179+
153180
zassert_equal(out_len, sizeof(chachapoly_expect_cipher_tag_buf));
181+
154182
zassert_mem_equal(cipher_tag_buf, chachapoly_expect_cipher_tag_buf,
155183
sizeof(chachapoly_expect_cipher_tag_buf));
156-
184+
157185
zassert_equal(psa_aead_decrypt(key_id, alg, chachapoly_nonce_buf,
158186
sizeof(chachapoly_nonce_buf), chachapoly_ad_buf,
159187
sizeof(chachapoly_ad_buf), cipher_tag_buf, out_len,
160188
decrypted, sizeof(decrypted), &out_len),
161189
PSA_SUCCESS, "Failed to decrypt");
162190

163191
zassert_equal(out_len, sizeof(chachapoly_plaintext));
192+
164193
zassert_mem_equal(decrypted, chachapoly_plaintext, sizeof(chachapoly_plaintext));
165194

166195
zassert_equal(psa_destroy_key(key_id), PSA_SUCCESS, "Failed to destroy key");
196+
167197
}

tests/crypto/psa_crypto/src/cipher.c

Lines changed: 42 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
#include <zephyr/ztest.h>
88
#include <psa/crypto.h>
99

10+
#if defined CONFIG_TEST_WRAPPED_KEYS
11+
#include "sl_si91x_psa_wrap.h"
12+
#endif
13+
1014
#include "test_vectors.h"
1115

1216
uint8_t key_256[32] = {
@@ -40,24 +44,29 @@ ZTEST(psa_crypto_test, test_cipher_aes_cbc_256_multipart)
4044
psa_set_key_algorithm(&attributes, alg);
4145
psa_set_key_type(&attributes, PSA_KEY_TYPE_AES);
4246
psa_set_key_bits(&attributes, 256);
43-
if (IS_ENABLED(TEST_WRAPPED_KEYS)) {
47+
48+
#if defined(CONFIG_TEST_WRAPPED_KEYS) && CONFIG_TEST_WRAPPED_KEYS
49+
printf("Test Wrapper keys enabled\n");
4450
psa_set_key_lifetime(&attributes, PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(
45-
PSA_KEY_PERSISTENCE_VOLATILE, 1));
51+
PSA_KEY_PERSISTENCE_VOLATILE, 0));
4652
zassert_equal(psa_generate_key(&attributes, &key_id), PSA_SUCCESS,
4753
"Failed to generate key");
48-
} else {
54+
#else
4955
zassert_equal(psa_import_key(&attributes, key_256, sizeof(key_256), &key_id),
5056
PSA_SUCCESS, "Failed to import key");
51-
}
57+
#endif
5258
psa_reset_key_attributes(&attributes);
5359

5460
zassert_equal(psa_cipher_encrypt_setup(&operation, key_id, alg), PSA_SUCCESS,
5561
"Failed to begin encrypt operation");
62+
5663
zassert_equal(psa_cipher_generate_iv(&operation, iv, sizeof(iv), &iv_len), PSA_SUCCESS,
5764
"Failed to generate IV");
65+
5866
zassert_equal(psa_cipher_update(&operation, plaintext, sizeof(plaintext), ciphertext,
5967
sizeof(ciphertext), &ciphertext_len),
6068
PSA_SUCCESS, "Failed to update encrypt operation");
69+
6170
zassert_equal(psa_cipher_finish(&operation, ciphertext + ciphertext_len,
6271
sizeof(ciphertext) - ciphertext_len, &ciphertext_len),
6372
PSA_SUCCESS, "Failed to finish encrypt operation");
@@ -69,12 +78,16 @@ ZTEST(psa_crypto_test, test_cipher_aes_cbc_256_multipart)
6978

7079
zassert_equal(psa_cipher_decrypt_setup(&operation, key_id, alg), PSA_SUCCESS,
7180
"Failed to begin decrypt operation");
81+
7282
zassert_equal(psa_cipher_set_iv(&operation, iv, sizeof(iv)), PSA_SUCCESS,
7383
"Failed to set IV");
84+
7485
zassert_equal(psa_cipher_update(&operation, ciphertext, sizeof(ciphertext), decrypted,
7586
sizeof(decrypted), &decrypted_len),
7687
PSA_SUCCESS, "Failed to update decrypt operation");
88+
7789
zassert_equal(decrypted_len, sizeof(decrypted), "Decrypted length mismatch");
90+
7891
zassert_equal(psa_cipher_finish(&operation, decrypted + decrypted_len,
7992
sizeof(decrypted) - decrypted_len, &decrypted_len),
8093
PSA_SUCCESS, "Failed to finish decrypt operation");
@@ -96,15 +109,17 @@ ZTEST(psa_crypto_test, test_cipher_aes_cbc_256_single)
96109
psa_set_key_algorithm(&attributes, alg);
97110
psa_set_key_type(&attributes, PSA_KEY_TYPE_AES);
98111
psa_set_key_bits(&attributes, 256);
99-
if (IS_ENABLED(TEST_WRAPPED_KEYS)) {
112+
113+
#if defined(CONFIG_TEST_WRAPPED_KEYS) && CONFIG_TEST_WRAPPED_KEYS
114+
printf("Test Wrapper keys enabled\n");
100115
psa_set_key_lifetime(&attributes, PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(
101-
PSA_KEY_PERSISTENCE_VOLATILE, 1));
116+
PSA_KEY_PERSISTENCE_VOLATILE, PSA_KEY_VOLATILE_PERSISTENT_WRAP_IMPORT));
102117
zassert_equal(psa_generate_key(&attributes, &key_id), PSA_SUCCESS,
103118
"Failed to generate key");
104-
} else {
119+
#else
105120
zassert_equal(psa_import_key(&attributes, key_256, sizeof(key_256), &key_id),
106121
PSA_SUCCESS, "Failed to import key");
107-
}
122+
#endif
108123
psa_reset_key_attributes(&attributes);
109124

110125
zassert_equal(psa_cipher_encrypt(key_id, alg, plaintext, sizeof(plaintext),
@@ -120,17 +135,8 @@ ZTEST(psa_crypto_test, test_cipher_aes_cbc_256_single)
120135
PSA_SUCCESS, "Failed to perform one-shot decrypt operation");
121136

122137
zassert_equal(decrypted_len, sizeof(decrypted), "Decrypted length mismatch");
123-
zassert_mem_equal(decrypted, plaintext, sizeof(plaintext));
124-
125-
ciphertext_buffer_256[0] += 1;
126-
zassert_equal(psa_cipher_decrypt(key_id, alg, ciphertext_buffer_256, ciphertext_len,
127-
decrypted, sizeof(decrypted), &decrypted_len),
128-
PSA_SUCCESS,
129-
"Failed to perform one-shot decrypt operation with modified ciphertext");
130138

131-
zassert_equal(decrypted_len, sizeof(decrypted), "Decrypted length mismatch");
132-
zassert(memcmp(decrypted, plaintext, sizeof(plaintext)) != 0,
133-
"Decrypted modified data identical to original plaintext");
139+
zassert_mem_equal(decrypted, plaintext, sizeof(plaintext));
134140

135141
psa_destroy_key(key_id);
136142
}
@@ -145,16 +151,18 @@ ZTEST(psa_crypto_test, test_cipher_aes_ecb_128_single)
145151
psa_set_key_algorithm(&attributes, alg);
146152
psa_set_key_type(&attributes, PSA_KEY_TYPE_AES);
147153
psa_set_key_bits(&attributes, 128);
148-
if (IS_ENABLED(TEST_WRAPPED_KEYS)) {
149-
psa_set_key_lifetime(&attributes, PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(
150-
PSA_KEY_PERSISTENCE_VOLATILE, 1));
151154

155+
#if defined(CONFIG_TEST_WRAPPED_KEYS) && CONFIG_TEST_WRAPPED_KEYS
156+
printf("Test Wrapper keys enabled\n");
157+
psa_set_key_lifetime(&attributes, PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(
158+
PSA_KEY_PERSISTENCE_VOLATILE, PSA_KEY_VOLATILE_PERSISTENT_WRAP_IMPORT));
152159
zassert_equal(psa_generate_key(&attributes, &key_id), PSA_SUCCESS,
153160
"Failed to generate key");
154-
} else {
161+
#else
155162
zassert_equal(psa_import_key(&attributes, key_128, sizeof(key_128), &key_id),
156163
PSA_SUCCESS, "Failed to import key");
157-
}
164+
#endif
165+
158166
psa_reset_key_attributes(&attributes);
159167

160168
zassert_equal(psa_cipher_encrypt(key_id, alg, plaintext, sizeof(plaintext), ciphertext,
@@ -167,18 +175,10 @@ ZTEST(psa_crypto_test, test_cipher_aes_ecb_128_single)
167175
zassert_equal(psa_cipher_decrypt(key_id, alg, ciphertext, ciphertext_len, decrypted,
168176
sizeof(decrypted), &decrypted_len),
169177
PSA_SUCCESS, "Failed to perform one-shot decrypt operation");
170-
zassert_equal(decrypted_len, sizeof(decrypted), "Decrypted length mismatch");
171-
zassert_mem_equal(decrypted, plaintext, sizeof(plaintext));
172-
173-
ciphertext[0] += 1;
174-
zassert_equal(psa_cipher_decrypt(key_id, alg, ciphertext, ciphertext_len, decrypted,
175-
sizeof(decrypted), &decrypted_len),
176-
PSA_SUCCESS,
177-
"Failed to perform one-shot decrypt operation with modified ciphertext");
178178

179179
zassert_equal(decrypted_len, sizeof(decrypted), "Decrypted length mismatch");
180-
zassert(memcmp(decrypted, plaintext, sizeof(plaintext)) != 0,
181-
"Decrypted modified data identical to original plaintext");
180+
181+
zassert_mem_equal(decrypted, plaintext, sizeof(plaintext));
182182

183183
psa_destroy_key(key_id);
184184
}
@@ -194,6 +194,12 @@ ZTEST(psa_crypto_test, test_cipher_chacha20_single)
194194
psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT);
195195
psa_set_key_algorithm(&attributes, alg);
196196

197+
#if defined(CONFIG_TEST_WRAPPED_KEYS) && CONFIG_TEST_WRAPPED_KEYS
198+
printf("Test Wrapper keys enabled\n");
199+
psa_set_key_lifetime(&attributes, PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(
200+
PSA_KEY_PERSISTENCE_VOLATILE, 0));
201+
#endif
202+
197203
zassert_equal(psa_import_key(&attributes, key_256, sizeof(key_256), &key_id), PSA_SUCCESS,
198204
"Failed to import key");
199205

@@ -209,5 +215,8 @@ ZTEST(psa_crypto_test, test_cipher_chacha20_single)
209215
sizeof(decrypted), &out_len),
210216
PSA_SUCCESS, "Failed to decrypt");
211217

218+
zassert(memcmp(ciphertext_buffer_256, plaintext, sizeof(plaintext)) != 0,
219+
"Ciphertext identical to plaintext");
220+
212221
zassert_mem_equal(decrypted, plaintext, sizeof(plaintext));
213222
}

tests/crypto/psa_crypto/src/hash.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ ZTEST(psa_crypto_test, test_hash_sha256)
2222

2323
zassert_equal(psa_hash_compute(PSA_ALG_SHA_256, plaintext, sizeof(plaintext), hash_buf,
2424
sizeof(hash_buf), &hash_len),
25-
PSA_SUCCESS, "Failed to compute hash");
25+
PSA_SUCCESS, "Failed to perform hash");
26+
2627
zassert_equal(hash_len, sizeof(expect_sha256_hash), "Hash length mismatch");
2728
zassert_mem_equal(hash_buf, expect_sha256_hash, sizeof(expect_sha256_hash),
2829
"Hash mismatch");
@@ -55,7 +56,10 @@ ZTEST(psa_crypto_test, test_hash_sha256_multipart)
5556

5657
zassert_equal(psa_hash_finish(&hash_op, hash_buf, sizeof(hash_buf), &hash_len), PSA_SUCCESS,
5758
"Failed to finish hash");
59+
5860
zassert_equal(hash_len, sizeof(expect_sha256_hash), "Hash length mismatch");
61+
5962
zassert_mem_equal(hash_buf, expect_sha256_hash, sizeof(expect_sha256_hash),
6063
"Hash mismatch");
64+
6165
}

tests/crypto/psa_crypto/src/key_agreement.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
#include <zephyr/ztest.h>
88
#include <psa/crypto.h>
99

10+
#if defined CONFIG_TEST_WRAPPED_KEYS
11+
#include "sl_si91x_psa_wrap.h"
12+
#endif
13+
1014
static const uint8_t client_private_key[] = {
1115
0xB0, 0x76, 0x51, 0xEA, 0x20, 0xF0, 0x28, 0xA8, 0x16, 0xEE, 0x01,
1216
0xB0, 0xD1, 0x06, 0x2A, 0x7C, 0x81, 0x58, 0xE8, 0x84, 0xE9, 0xBC,
@@ -44,10 +48,12 @@ ZTEST(psa_crypto_test, test_key_agreement_ecdh_25519)
4448
psa_set_key_type(&attributes, PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_MONTGOMERY));
4549
psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_DERIVE);
4650
psa_set_key_algorithm(&attributes, PSA_ALG_ECDH);
47-
if (IS_ENABLED(TEST_WRAPPED_KEYS)) {
51+
52+
#if defined(CONFIG_TEST_WRAPPED_KEYS) && CONFIG_TEST_WRAPPED_KEYS
53+
printf("Test Wrapper keys enabled\n");
4854
psa_set_key_lifetime(&attributes, PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(
49-
PSA_KEY_PERSISTENCE_VOLATILE, 1));
50-
}
55+
PSA_KEY_PERSISTENCE_VOLATILE, 0));
56+
#endif
5157
zassert_equal(psa_import_key(&attributes, client_private_key, sizeof(client_private_key),
5258
&key_id),
5359
PSA_SUCCESS, "Failed to import client key");
@@ -57,6 +63,7 @@ ZTEST(psa_crypto_test, test_key_agreement_ecdh_25519)
5763
sizeof(server_public_key), shared_secret_buf,
5864
sizeof(shared_secret_buf), &shared_secret_len),
5965
PSA_SUCCESS, "Failed to perform key agreement with server");
66+
6067
zassert_equal(psa_destroy_key(key_id), PSA_SUCCESS, "Failed to destroy client key");
6168

6269
/* Import server key */
@@ -66,7 +73,7 @@ ZTEST(psa_crypto_test, test_key_agreement_ecdh_25519)
6673
psa_set_key_algorithm(&attributes, PSA_ALG_ECDH);
6774
if (IS_ENABLED(TEST_WRAPPED_KEYS)) {
6875
psa_set_key_lifetime(&attributes, PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(
69-
PSA_KEY_PERSISTENCE_VOLATILE, 1));
76+
PSA_KEY_PERSISTENCE_VOLATILE, 0));
7077
}
7178
zassert_equal(psa_import_key(&attributes, server_private_key, sizeof(server_private_key),
7279
&key_id),
@@ -77,6 +84,7 @@ ZTEST(psa_crypto_test, test_key_agreement_ecdh_25519)
7784
sizeof(client_public_key), shared_secret_buf,
7885
sizeof(shared_secret_buf), &shared_secret_len),
7986
PSA_SUCCESS, "Failed to perform key agreement with client");
87+
8088
zassert_equal(psa_destroy_key(key_id), PSA_SUCCESS, "Failed to destroy server key");
8189

8290
/* Verify shared secret */

0 commit comments

Comments
 (0)