-
Notifications
You must be signed in to change notification settings - Fork 31
Description
The issue:
This is issue is widespread throughout wh_server_cert.c. I'm going to walk through one function but search for "server->nvm,". for other instances.
wh_Server_CertReadTrusted() needs to get a root certificate out of NVM. If key wrapping is enabled, this is only available to the server via the cache. In these builds the server will/may have two caches, a global one (accessible via server->nvm->globalCache) and a local one (accessible by server->localCache. wh_Server_CertReadTrusted() calls wh_Nvm_GetMetadata and wh_Nvm_Read on server->nvm. If the key wrap is using a local cache (the safer and default option) these calls will obviously fail as the call has no access to a local cache.
The fix:
This suggestion should obviously be verified for architectural correctness and unintended security side effects before adoption. The certs can be accessed via wh_Server_KeystoreReadKey and other general keystore calls which correctly handle caches and reduces code duplication. Alternatively, wh_Server_CertReadTrusted and other calls in the certificate manager can be rewritten to use logic more similar to that in the general keystore and accept the entire server object as a parameter.