Skip to content

Commit 679020d

Browse files
committed
Fix WOLFTPM2_USE_SW_ECDHE.
1 parent 082f22e commit 679020d

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/tpm2_cryptocb.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,15 @@ int wolfTPM2_CryptoDevCb(int devId, wc_CryptoInfo* info, void* ctx)
180180
int curve_id;
181181
WOLFTPM2_KEY* key;
182182

183+
#ifdef WOLFTPM2_USE_SW_ECDHE
184+
if (tlsCtx->ecdhKey == NULL) {
185+
return exit_rc;
186+
}
187+
#endif
188+
183189
if ( tlsCtx->eccKey == NULL
184190
&& tlsCtx->ecdsaKey == NULL
185-
#ifndef WOLFTPM2_USE_SW_ECDHE
186191
&& tlsCtx->ecdhKey == NULL
187-
#endif
188192
) {
189193
#ifdef DEBUG_WOLFTPM
190194
printf("No crypto callback key pointer set!\n");

wolftpm/tpm2_wrap.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3347,9 +3347,7 @@ typedef struct TpmCryptoDevCtx {
33473347
#ifdef HAVE_ECC
33483348
WOLFTPM2_KEY* eccKey; /* ECDSA - public only */
33493349
WOLFTPM2_KEYBLOB* ecdsaKey; /* ECDSA - retain encrypted private portion from keygen */
3350-
#ifndef WOLFTPM2_USE_SW_ECDHE
33513350
WOLFTPM2_KEY* ecdhKey; /* ECDH */
3352-
#endif
33533351
#endif
33543352
WOLFTPM2_KEY* storageKey;
33553353
#ifdef WOLFTPM_USE_SYMMETRIC

0 commit comments

Comments
 (0)