Skip to content

Commit

Permalink
Add wc_SetSeed_Cb for fips ecc (wolfSSL#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpbland1 authored May 23, 2023
1 parent cdff048 commit a92732d
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/tpm2.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,17 +469,25 @@ static TPM_ST TPM2_GetTag(TPM2_CTX* ctx)
}

#ifndef WOLFTPM2_NO_WOLFCRYPT
static inline void TPM2_WolfCrypt_Init(void)
static inline int TPM2_WolfCrypt_Init(void)
{
int rc = 0;

/* track reference count for wolfCrypt initialization */
if (gWolfCryptRefCount == 0) {
#ifdef DEBUG_WOLFSSL
wolfSSL_Debugging_ON();
#endif

wolfCrypt_Init();
rc = wolfCrypt_Init();
#ifdef WC_RNG_SEED_CB
if (rc == 0)
rc = wc_SetSeed_Cb(wc_GenerateSeed);
#endif
}
gWolfCryptRefCount++;

return rc;
}
#endif

Expand Down Expand Up @@ -605,7 +613,9 @@ TPM_RC TPM2_Init_ex(TPM2_CTX* ctx, TPM2HalIoCb ioCb, void* userCtx,
XMEMSET(ctx, 0, sizeof(TPM2_CTX));

#ifndef WOLFTPM2_NO_WOLFCRYPT
TPM2_WolfCrypt_Init();
rc = TPM2_WolfCrypt_Init();
if (rc != 0)
return rc;
#endif

#if defined(WOLFTPM_SWTPM)
Expand Down

0 comments on commit a92732d

Please sign in to comment.