diff --git a/test/wh_test_crypto.c b/test/wh_test_crypto.c index cc93ac217..da9434743 100644 --- a/test/wh_test_crypto.c +++ b/test/wh_test_crypto.c @@ -972,6 +972,17 @@ static int whTest_CryptoRsaAsync(whClientContext* ctx, WC_RNG* rng) } } + /* Evict keys now that we are done with them to free up cache space */ + if (ret == WH_ERROR_OK && keyCached) { + ret = wh_Client_KeyEvict(ctx, keyId); + if (ret != WH_ERROR_OK) { + WH_ERROR_PRINT("KeyEvict after sign/verify failed: %d\n", ret); + } + else { + keyCached = 0; + } + } + /* 9) RsaMakeExportKey async: server generates ephemeral key, returns DER. */ if (ret == WH_ERROR_OK) { diff --git a/wolfhsm/wh_settings.h b/wolfhsm/wh_settings.h index 0add5d1b0..6422a2837 100644 --- a/wolfhsm/wh_settings.h +++ b/wolfhsm/wh_settings.h @@ -225,12 +225,17 @@ /* Number of RAM keys */ #ifndef WOLFHSM_CFG_SERVER_KEYCACHE_COUNT +#if defined(WOLFHSM_CFG_SHE_EXTENSION) +/* Default to large enough cache to hold all SHE keys */ +#define WOLFHSM_CFG_SERVER_KEYCACHE_COUNT 16 +#else #define WOLFHSM_CFG_SERVER_KEYCACHE_COUNT 8 #endif +#endif /* Number of big RAM keys */ #ifndef WOLFHSM_CFG_SERVER_KEYCACHE_BIG_COUNT -#define WOLFHSM_CFG_SERVER_KEYCACHE_BIG_COUNT 1 +#define WOLFHSM_CFG_SERVER_KEYCACHE_BIG_COUNT 3 #endif /* Size in bytes of each key cache buffer */