Skip to content

Commit

Permalink
Fix for some TPM hardware, which does not support RSA validating usin…
Browse files Browse the repository at this point in the history
…g an exponent value less than 7. Can skip check using build option `WOLFTPM_NO_SOFTWARE_RSA`. Fix for the `wolfSSL_Connect` return code check in TLS client example.
  • Loading branch information
dgarske committed Jul 20, 2018
1 parent aa27a2a commit 1f92254
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,12 @@ make

## Release Notes

### wolfTPM Release 1.3 (07/19/2018)
### wolfTPM Release 1.3 (07/20/2018)

* Fixed the TIS TPM_BASE_ADDRESS to conform to specification. (PR #19)
* Fixed static analysis warnings. (PR #20)
* Fixed minor build warnings with different compilers. (PR #21)
* Fixed TPM failure for RSA exponents less than 7 by using software based RSA. (PR #23)
* Added TPM bechmarking support. (PR #16)
* Added functions to import/export public keys as wolf format. (PR #15)
* Added PKCS7 example to show sign/verify with TPM. (PR #17)
Expand Down
2 changes: 1 addition & 1 deletion examples/tls/tls_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ int TPM2_TLS_Client(void* userCtx)
rc = wolfSSL_get_error(ssl, 0);
}
} while (rc == WOLFSSL_ERROR_WANT_READ || rc == WOLFSSL_ERROR_WANT_WRITE);
if (rc != 0) {
if (rc != WOLFSSL_SUCCESS) {
goto exit;
}

Expand Down
11 changes: 11 additions & 0 deletions src/tpm2_wrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,17 @@ int wolfTPM2_LoadRsaPublicKey(WOLFTPM2_DEV* dev, WOLFTPM2_KEY* key,
if (rsaPubSz > sizeof(pub.publicArea.unique.rsa.buffer))
return BUFFER_E;

/* To support TPM hardware and firmware versions that do not allow small exponents */
#ifndef WOLFTPM_NO_SOFTWARE_RSA
/* The TPM reference implementation does not support an exponent size
smaller than 7 nor does it allow keys to be created on the TPM with a
public exponent less than 2^16 + 1. */
if (exponent < 7) {
printf("TPM based RSA with exponent %u not allowed! Using soft RSA\n", exponent);
return TPM_RC_KEY;
}
#endif

XMEMSET(&pub, 0, sizeof(pub));
pub.publicArea.type = TPM_ALG_RSA;
pub.publicArea.nameAlg = TPM_ALG_NULL;
Expand Down

0 comments on commit 1f92254

Please sign in to comment.