Skip to content

Commit 81a5d7e

Browse files
committed
Revert changes to WOLFTPM2_USE_SW_ECDHE
1 parent 4050983 commit 81a5d7e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/tpm2_cryptocb.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,12 @@ int wolfTPM2_CryptoDevCb(int devId, wc_CryptoInfo* info, void* ctx)
182182
int curve_id;
183183
WOLFTPM2_KEY* key;
184184

185+
#ifdef WOLFTPM2_USE_SW_ECDHE
186+
if (tlsCtx->ecdhKey == NULL) {
187+
return exit_rc;
188+
}
189+
#endif
190+
185191
if ( tlsCtx->eccKey == NULL
186192
&& tlsCtx->ecdsaKey == NULL
187193
&& tlsCtx->ecdhKey == NULL
@@ -262,13 +268,8 @@ int wolfTPM2_CryptoDevCb(int devId, wc_CryptoInfo* info, void* ctx)
262268
}
263269
#ifndef WOLFTPM2_USE_SW_ECDHE
264270
else {
265-
key = tlsCtx->ecdhKey;
266-
if (key == NULL) {
267-
/* fallback to software crypto */
268-
return exit_rc;
269-
}
270-
271271
/* Generate ephemeral key - if one isn't already created */
272+
key = tlsCtx->ecdhKey;
272273
if (key->handle.hndl == 0 ||
273274
key->handle.hndl == TPM_RH_NULL) {
274275
rc = wolfTPM2_ECDHGenKey(tlsCtx->dev, tlsCtx->ecdhKey,

0 commit comments

Comments
 (0)