Skip to content

Commit 524c884

Browse files
authored
Merge pull request #179 from dgarske/rel_v2.2
wolfTPM release v2.2 prep
2 parents 150e436 + b40574f commit 524c884

13 files changed

Lines changed: 81 additions & 22 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ ak.name
8787
cred.blob
8888
ek.pub
8989
srk.pub
90+
ak.pem
91+
ek.pem
9092

9193
# Generated Documentation
9294
docs/html

ChangeLog.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,44 @@
11
# Release Notes
22

3+
## wolfTPM Release 2.2 (07/13/2021)
4+
5+
**Summary**
6+
7+
Added new examples for remote attestation, make credential and GPIO support. Added Endorsement hierarchy support to many examples. Refactored the reference HAL IO code into separate files.
8+
9+
**Detail**
10+
11+
* Fixed total auth area size when multiple auth sessions are used (PR #174)
12+
* Fixed `TPM2_SetupPCRSel` to only allow valid pcrIndex values (PR #165 and PR #167)
13+
* Fixed `TPM2_MakeCredential` to work without auth as TCG spec defines (PR #174)
14+
* Fixed `TPM2_MakeCredential` to support using EK pub to encrypt challenge (PR #174)
15+
* Fixed `TPM2_ActivateCredential` to work with EK pub to decrypt challenge (PR #174)
16+
* Fix to only enable `printf` in library proper if `DEBUG_WOLFTPM` is set (PR #154)
17+
* Added support for QNX with wolfTPM (PR #156)
18+
* Added credential examples for remote attestation (PR #161)
19+
* Added new example for sealing a secret using TPM key (PR #157)
20+
* Added GPIO config, read and set examples (PR #155 and #172)
21+
* Added GPIO support and examples for ST33 (PR #155)
22+
* Added GPIO support and examples for Nuvoton NPCT75x (PR #172)
23+
* Added Endorsement support for keygen and attestation examples using `-eh` (PR #174)
24+
* Added missing `TPM2_CreateLoaded` command and added wrapper `wolfTPM2_CreateLoadedKey` (PR #174)
25+
* Added new wrappers for public PEM support `wolfTPM2_RsaKey_TpmToPemPub` and `wolfTPM2_RsaKey_PemPubToTpm` (PR #174)
26+
* Added keygen option to output PEM files for TPM public keys (PR #174)
27+
* Added saving of EK's TPM2B_PUBLIC for attestation purposes (PR #174)
28+
* Added new wrapper for satisfying EK policy (PR #174)
29+
* Added unit test for `TPM2_CertifyCreation` (PR #169)
30+
* Added support for `--with-wolfcrypt=/dir/` (PR #166)
31+
* Added documentation for using QEMU with `--enable-devtpm` for testing (PR #146)
32+
* Modified keygen to use new `wolfTPM2_CreateLoaded` wrapper to acquire correct AK name (PR #174)
33+
* Modified keyload to be able to load keys created under the EK/EH (PR #174)
34+
* Cleanup the ECC point code to appease some coverity warnings (PR #168)
35+
* Cleanup obsolete `txBuf[4] = 0x00;` because handled with SPI check wait state logic (PR #162)
36+
* Improved API documentation using Doxygen for wolfTPM wrappers and proprietary API's (PR #164)
37+
* Improved the Windows TBS documentation (PR #163)
38+
* Refactor the assignment of structs to use memcpy (PR #176)
39+
* Refactor of the TPM IO code to separate files (PR #171)
40+
41+
342
## wolfTPM Release 2.1 (03/17/2021)
443

544
* Fixed possible KDFa buffer overrun (PR #147)

configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# All right reserved.
44

55
AC_COPYRIGHT([Copyright (C) 2014-2021 wolfSSL Inc.])
6-
AC_INIT([wolftpm],[2.1.0],[https://github.com/wolfssl/wolfTPM/issues],[wolftpm],[http://www.wolfssl.com])
6+
AC_INIT([wolftpm],[2.2.0],[https://github.com/wolfssl/wolfTPM/issues],[wolftpm],[http://www.wolfssl.com])
77

88
AC_PREREQ([2.63])
99
AC_CONFIG_AUX_DIR([build-aux])
@@ -23,7 +23,7 @@ AC_ARG_PROGRAM
2323
AC_CONFIG_MACRO_DIR([m4])
2424
AC_CONFIG_HEADERS([src/config.h])
2525

26-
WOLFTPM_LIBRARY_VERSION=11:0:0
26+
WOLFTPM_LIBRARY_VERSION=12:0:0
2727
# | | |
2828
# +------+ | +---+
2929
# | | |

examples/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,6 @@ Using the `seal` example we store securely our data in a newly generated TPM 2.0
401401
Please find example output from sealing and unsealing a secret message:
402402

403403
```
404-
405404
$ ./examples/seal/seal keyblob.bin mySecretMessage
406405
TPM2.0 Simple Seal example
407406
Key Blob: keyblob.bin
@@ -431,7 +430,6 @@ Stored unsealed data to file = message.raw
431430
432431
$ cat message.raw
433432
mySecretMessage
434-
435433
```
436434

437435
After a successful unsealing, the data is stored into a new file. If no filename is provided, the `unseal` tool stores the data in `unseal.bin`.
@@ -497,7 +495,7 @@ NV Index for GPIO access created
497495

498496
### GPIO Config (NPCT75xx)
499497

500-
NPCT75x supports 3 output modes, information from `gpio/gpio_nuvoton` below:
498+
NPCT75x supports 3 output modes (no input modes), information from `gpio/gpio_nuvoton` below:
501499

502500
```
503501
$ ./examples/gpio/gpio_nuvoton -h

examples/attestation/activate_credential.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ int TPM2_ActivateCredential_Example(void* userCtx, int argc, char *argv[])
148148
printf("AK loaded at 0x%x\n", (word32)akKey.handle.hndl);
149149

150150
rc = wolfTPM2_UnsetAuth(&dev, 0);
151+
if (rc != 0) goto exit;
151152

152153
if (endorseKey) {
153154
/* Fresh policy session for EK auth */
@@ -178,8 +179,10 @@ int TPM2_ActivateCredential_Example(void* userCtx, int argc, char *argv[])
178179
if (fp != XBADFILE) {
179180
dataSize = (int)XFREAD((BYTE*)&cmdIn.activCred.credentialBlob, 1,
180181
sizeof(cmdIn.activCred.credentialBlob), fp);
181-
dataSize = (int)XFREAD((BYTE*)&cmdIn.activCred.secret, 1,
182-
sizeof(cmdIn.activCred.secret), fp);
182+
if (dataSize > 0) {
183+
dataSize += (int)XFREAD((BYTE*)&cmdIn.activCred.secret, 1,
184+
sizeof(cmdIn.activCred.secret), fp);
185+
}
183186
XFCLOSE(fp);
184187
}
185188
printf("Read credential blob and secret from %s, %d bytes\n",

examples/attestation/make_credential.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,15 @@ int TPM2_MakeCredential_Example(void* userCtx, int argc, char *argv[])
141141
printf("Public key for encryption loaded\n");
142142
handle.hndl = cmdOut.loadExtOut.objectHandle;
143143

144+
#if !defined(WOLFTPM2_NO_WOLFCRYPT) && !defined(NO_FILESYSTEM)
144145
/* Load AK Name digest */
145146
fp = XFOPEN("ak.name", "rb");
146147
if (fp != XBADFILE) {
147148
XFREAD((BYTE*)&name, 1, sizeof(name), fp);
148149
printf("Read AK Name digest\n");
149150
XFCLOSE(fp);
150151
}
152+
#endif
151153

152154
/* Create secret for the attestation server */
153155
cmdIn.makeCred.credential.size = CRED_SECRET_SIZE;
@@ -172,8 +174,10 @@ int TPM2_MakeCredential_Example(void* userCtx, int argc, char *argv[])
172174
if (fp != XBADFILE) {
173175
dataSize = (int)XFWRITE((BYTE*)&cmdOut.makeCred.credentialBlob, 1,
174176
sizeof(cmdOut.makeCred.credentialBlob), fp);
175-
dataSize = (int)XFWRITE((BYTE*)&cmdOut.makeCred.secret, 1,
176-
sizeof(cmdOut.makeCred.secret), fp);
177+
if (dataSize > 0) {
178+
dataSize += (int)XFWRITE((BYTE*)&cmdOut.makeCred.secret, 1,
179+
sizeof(cmdOut.makeCred.secret), fp);
180+
}
177181
XFCLOSE(fp);
178182
}
179183
printf("Wrote credential blob and secret to %s, %d bytes\n",

examples/gpio/gpio_config.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323

2424
#include <wolftpm/tpm2_wrap.h>
2525

26-
#if defined(WOLFTPM_ST33) || defined(WOLFTPM_AUTODETECT)
26+
#if !defined(WOLFTPM2_NO_WRAPPER) && \
27+
(defined(WOLFTPM_ST33) || defined(WOLFTPM_AUTODETECT))
2728

2829
#include <examples/gpio/gpio.h>
2930
#include <examples/tpm_io.h>
@@ -245,14 +246,15 @@ int TPM2_GPIO_Config_Example(void* userCtx, int argc, char *argv[])
245246
/******************************************************************************/
246247
/* --- END TPM2.0 GPIO Configuration example -- */
247248
/******************************************************************************/
248-
#endif /* WOLFTPM_ST33 || WOLFTPM_AUTODETECT */
249+
#endif /* !WOLFTPM2_NO_WRAPPER && (WOLFTPM_ST33 || WOLFTPM_AUTODETECT) */
249250

250251
#ifndef NO_MAIN_DRIVER
251252
int main(int argc, char *argv[])
252253
{
253254
int rc = -1;
254255

255-
#if defined(WOLFTPM_ST33) || defined(WOLFTPM_AUTODETECT)
256+
#if !defined(WOLFTPM2_NO_WRAPPER) && \
257+
(defined(WOLFTPM_ST33) || defined(WOLFTPM_AUTODETECT))
256258
rc = TPM2_GPIO_Config_Example(NULL, argc, argv);
257259
#else
258260
printf("GPIO configuration requires an ST33 TPM 2.0 module built with WOLFTPM_ST33 or --enable-st33\n");

examples/keygen/keygen.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,16 @@ int TPM2_Keygen_Example(void* userCtx, int argc, char *argv[])
129129
int bAIK = 1;
130130
int keyBits = 256;
131131
const char *outputFile = "keyblob.bin";
132-
const char *nameFile = "ak.name"; /* Name Digest for attestation purposes */
133132
const char *ekPubFile = "ek.pub";
134133
const char *srkPubFile = "srk.pub";
135134
const char *pubFilename = NULL;
135+
#if !defined(WOLFTPM2_NO_WOLFCRYPT) && !defined(NO_FILESYSTEM)
136+
const char *nameFile = "ak.name"; /* Name Digest for attestation purposes */
136137
const char *pemFilename = NULL;
138+
FILE *fp;
139+
#endif
137140
size_t len = 0;
138141
char symMode[] = "aesctr";
139-
FILE *fp;
140142

141143
if (argc >= 2) {
142144
if (XSTRNCMP(argv[1], "-?", 2) == 0 ||
@@ -348,6 +350,7 @@ int TPM2_Keygen_Example(void* userCtx, int argc, char *argv[])
348350
if (rc == 0) {
349351
rc = writeKeyPubPem(pemFilename, pem, pemSz);
350352
}
353+
if (rc != 0) goto exit;
351354

352355
pemFilename = (bAIK) ? pemFileAk : pemFileKey;
353356
pemSz = (word32)sizeof(pem);

examples/keygen/keyload.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ int TPM2_Keyload_Example(void* userCtx, int argc, char *argv[])
119119
primary = &endorse;
120120
}
121121
else { /* SRK */
122-
rc = getPrimaryStoragekey(&dev, primary, TPM_ALG_RSA);
122+
rc = getPrimaryStoragekey(&dev, &storage, TPM_ALG_RSA);
123123
if (rc != 0) goto exit;
124124
primary = &storage;
125125
}

examples/tls/tls_server.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,9 @@ int TPM2_TLS_ServerArgs(void* userCtx, int argc, char *argv[])
513513
#ifdef HAVE_ECC
514514
wc_ecc_free(&wolfEccKey);
515515
wolfTPM2_UnloadHandle(&dev, &eccKey.handle);
516+
#ifndef WOLFTPM2_USE_SW_ECDHE
517+
wolfTPM2_UnloadHandle(&dev, &ecdhKey.handle);
518+
#endif
516519
#endif
517520
wolfTPM2_UnloadHandle(&dev, &tpmSession.handle);
518521

0 commit comments

Comments
 (0)