Skip to content

Commit d095536

Browse files
authored
Merge pull request #498 from dgarske/rng_use_wolf
Fix to make sure wolfCrypt DRBG is used with crypto callbacks
2 parents e95c7b6 + 41ce0ad commit d095536

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/tpm2_cryptocb.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,11 @@ int wolfTPM2_CryptoDevCb(int devId, wc_CryptoInfo* info, void* ctx)
7171
#endif
7272

7373
if (info->algo_type == WC_ALGO_TYPE_RNG) {
74-
#ifndef WC_NO_RNG
74+
/* For WOLFTPM2_USE_WOLF_RNG we want to fallback to the wolfCrypt DRBG,
75+
so return CRYPTOCB_UNAVAILABLE here */
76+
#if !defined(WC_NO_RNG) && !defined(WOLFTPM2_USE_WOLF_RNG)
7577
rc = wolfTPM2_GetRandom(tlsCtx->dev, info->rng.out, info->rng.sz);
76-
#endif /* !WC_NO_RNG */
78+
#endif /* !WC_NO_RNG && !WOLFTPM2_USE_WOLF_RNG */
7779
}
7880
else if (info->algo_type == WC_ALGO_TYPE_SEED) {
7981
#ifndef WC_NO_RNG

0 commit comments

Comments
 (0)