Skip to content

Commit d6f31be

Browse files
authored
Fix key wrap test to use defined key id. Check error code (#212)
1 parent bbb9297 commit d6f31be

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

test/wh_test_keywrap.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static int _AesGcm_KeyWrap(whClientContext* client, WC_RNG* rng)
101101
uint8_t wrappedKey[WH_TEST_AES_WRAPPED_KEYSIZE];
102102
whKeyId wrappedKeyId;
103103
whNvmMetadata metadata = {
104-
.id = WH_MAKE_KEYID(WH_KEYTYPE_CRYPTO, 0, 8),
104+
.id = WH_MAKE_KEYID(WH_KEYTYPE_CRYPTO, 0, WH_TEST_AESGCM_KEYID),
105105
.label = "AES Key Label",
106106
.len = WH_TEST_AES_KEYSIZE,
107107
.flags = WH_NVM_FLAGS_NONE,
@@ -222,7 +222,11 @@ int whTest_Client_KeyWrap(whClientContext* client)
222222
int ret = 0;
223223
WC_RNG rng[1];
224224

225-
_InitServerKek(client);
225+
ret = _InitServerKek(client);
226+
if (ret != WH_ERROR_OK) {
227+
WH_ERROR_PRINT("Failed to _InitServerKek %d\n", ret);
228+
return ret;
229+
}
226230

227231
ret = wc_InitRng_ex(rng, NULL, WH_DEV_ID);
228232
if (ret != 0) {
@@ -233,7 +237,7 @@ int whTest_Client_KeyWrap(whClientContext* client)
233237
#ifdef HAVE_AESGCM
234238
ret = _AesGcm_KeyWrap(client, rng);
235239
if (ret != WH_ERROR_OK) {
236-
WH_ERROR_PRINT("Failed to wc_InitRng_ex %d\n", ret);
240+
WH_ERROR_PRINT("Failed to _AesGcm_KeyWrap %d\n", ret);
237241
}
238242
#endif
239243

0 commit comments

Comments
 (0)