@@ -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