Skip to content

Commit e8663e3

Browse files
committed
support cache probe on freshen
1 parent 0170b93 commit e8663e3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/wh_server_keystore.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,13 @@ int wh_Server_KeystoreFreshenKey(whServerContext* server, whKeyId keyId,
527527
ret = _FindInCache(server, keyId, &foundIndex, &foundBigIndex, outBuf,
528528
outMeta);
529529
if (ret != WH_ERROR_OK) {
530+
/* For wrapped keys, just probe the cache and error if not found. We
531+
* don't support automatically unwrapping and caching outside of the
532+
* keywrap API */
533+
if (WH_KEYID_TYPE(keyId) == WH_KEYTYPE_WRAPPED) {
534+
return WH_ERROR_NOTFOUND;
535+
}
536+
530537
/* Not in cache. Check if it is in NVM */
531538
ret = wh_Nvm_GetMetadata(server->nvm, keyId, tmpMeta);
532539
if (ret == WH_ERROR_OK) {
@@ -582,7 +589,9 @@ int wh_Server_KeystoreReadKey(whServerContext* server, whKeyId keyId,
582589
return 0;
583590
}
584591

585-
/* Prevent exposing wrapped blobs through the unwrapped read path */
592+
/* For wrapped keys, just probe the cache and error if not found. We
593+
* don't support automatically unwrapping and caching outside of the
594+
* keywrap API */
586595
if (WH_KEYID_TYPE(keyId) == WH_KEYTYPE_WRAPPED) {
587596
return WH_ERROR_NOTFOUND;
588597
}

0 commit comments

Comments
 (0)