Skip to content

Commit 6498766

Browse files
committed
review feedback and rebase to incorporate new keystore functionality
1 parent 9e787f0 commit 6498766

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/wh_client_crypto.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2830,8 +2830,12 @@ static int _CmacKdfMakeKey(whClientContext* ctx, whKeyId saltKeyId,
28302830

28312831
if (fixedInfoSz > 0 && fixedInfo != NULL) {
28322832
memcpy(payload, fixedInfo, fixedInfoSz);
2833+
payload += fixedInfoSz;
28332834
}
28342835

2836+
/* squash unused warning */
2837+
(void)payload;
2838+
28352839
ret = wh_Client_SendRequest(ctx, group, action, req_len, dataPtr);
28362840
if (ret != WH_ERROR_OK) {
28372841
return ret;

src/wh_server_crypto.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,8 @@ int wh_Server_CmacKdfKeyCacheImport(whServerContext* ctx,
12081208
return WH_ERROR_BADARGS;
12091209
}
12101210

1211-
ret = wh_Server_KeystoreGetCacheSlot(ctx, keySize, &cacheBuf, &cacheMeta);
1211+
ret = wh_Server_KeystoreGetCacheSlot(ctx, keyId, keySize, &cacheBuf,
1212+
&cacheMeta);
12121213
if (ret == WH_ERROR_OK) {
12131214
memcpy(cacheBuf, keyData, keySize);
12141215
}
@@ -1375,12 +1376,12 @@ static int _HandleCmacKdf(whServerContext* ctx, uint16_t magic,
13751376
uint32_t zSz = req.zSz;
13761377
uint32_t fixedInfoSz = req.fixedInfoSz;
13771378
uint32_t outSz = req.outSz;
1378-
whKeyId keyIdOut =
1379-
WH_MAKE_KEYID(WH_KEYTYPE_CRYPTO, ctx->comm->client_id, req.keyIdOut);
1380-
whKeyId saltKeyId =
1381-
WH_MAKE_KEYID(WH_KEYTYPE_CRYPTO, ctx->comm->client_id, req.keyIdSalt);
1382-
whKeyId zKeyId =
1383-
WH_MAKE_KEYID(WH_KEYTYPE_CRYPTO, ctx->comm->client_id, req.keyIdZ);
1379+
whKeyId keyIdOut = wh_KeyId_TranslateFromClient(
1380+
WH_KEYTYPE_CRYPTO, ctx->comm->client_id, req.keyIdOut);
1381+
whKeyId saltKeyId = wh_KeyId_TranslateFromClient(
1382+
WH_KEYTYPE_CRYPTO, ctx->comm->client_id, req.keyIdSalt);
1383+
whKeyId zKeyId = wh_KeyId_TranslateFromClient(
1384+
WH_KEYTYPE_CRYPTO, ctx->comm->client_id, req.keyIdZ);
13841385
whNvmFlags flags = (whNvmFlags)req.flags;
13851386
uint8_t* label = req.label;
13861387
uint16_t label_size = WH_NVM_LABEL_LEN;
@@ -1454,7 +1455,7 @@ static int _HandleCmacKdf(whServerContext* ctx, uint16_t magic,
14541455
ret = wh_Server_CmacKdfKeyCacheImport(ctx, out, outSz, keyIdOut,
14551456
flags, label_size, label);
14561457
if (ret == WH_ERROR_OK) {
1457-
res.keyIdOut = WH_KEYID_ID(keyIdOut);
1458+
res.keyIdOut = wh_KeyId_TranslateToClient(keyIdOut);
14581459
res.outSz = 0;
14591460
memset(out, 0, outSz);
14601461
}

0 commit comments

Comments
 (0)