Skip to content

Commit 642beec

Browse files
authored
Merge pull request #362 from dgarske/rel_v3.4.0
wolfTPM v3.4.0 release
2 parents b36f792 + 95ae2f7 commit 642beec

File tree

11 files changed

+82
-31
lines changed

11 files changed

+82
-31
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
cmake_minimum_required(VERSION 3.16)
2323

24-
project(wolfTPM VERSION 3.2.0 LANGUAGES C)
24+
project(wolfTPM VERSION 3.4.0 LANGUAGES C)
2525

2626
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
2727
set(WOLFTPM_DEFINITIONS)

ChangeLog.md

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

3+
## wolfTPM Release 3.4.0 (July 30, 2024)
4+
5+
**Summary**
6+
7+
Added Endorsement Key Certificate support. Added support for NV read/write with policy. Added policy password support. Refactor of the session authentication structures.
8+
9+
**Detail**
10+
11+
* Added EK Certificate Support (PR #360)
12+
- Added new API's `wolfTPM2_GetKeyTemplate_EK` and `wolfTPM2_GetKeyTemplate_EK` for getting EK public templates used for generating the EK primary key.
13+
- Added `examples/endorsement/get_ek_certs` for showing how to retrieve and validate the manufacturers endorsement key certificates.
14+
* Improvements to auth handling to support Policy Password and Policy Auth Value (PR #350)
15+
- Refactor to eliminate confusing cast between TPMS_AUTH_COMMAND and TPM2_AUTH_SESSION.
16+
- Support for policy auth value and policy password.
17+
- Add new NV policy write/read API's `wolfTPM2_NVWriteAuthPolicy` and `wolfTPM2_NVReadAuthPolicy`.
18+
* Fixed ST33KTPM IAK/IDevID provisioning NV indexes. (PR #361)
19+
* Fixed TLS example build issues with wolfSSL not having crypto callback or PK callback enabled. (PR #360)
20+
* Fixed CSR version (use version 0) (PR #359)
21+
* Fixed issue with Doxygen generation of wolfTPM due to doxybook2 crashing on unnamed enum. (PR #357)
22+
* Fixed HMAC session save last (not typically used) (PR #355)
23+
* Fixed Infineon I2C HAL gating logic (PR #347)
24+
* Added documentation for IAK/IDevID build options. (PR #361)
25+
* Added support for Espressif IDE (see IDE/Espressif) (PR #321)
26+
* Added tests for create_primary (PR #345)
27+
* Improved software TPM (docs/SWTPM.md) documentation (PR #348)
28+
29+
330
## wolfTPM Release 3.2.0 (Apr 24, 2024)
431

532
**Summary**

IDE/VisualStudio/user_settings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ extern "C" {
4646
/* TPM */
4747
#define WOLFSSL_AES_CFB /* required for parameter encryption */
4848
#define WOLFSSL_PUBLIC_MP /* expose mp_ math functions - required for tpm ECC secret encrypt */
49+
#define WOLFTPM_AUTODETECT /* support any TPM model (unknown/safe options) */
4950

5051
/* Callbacks */
5152
#define WOLF_CRYPTO_CB

IDE/VisualStudio/wolftpm.vcxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@
212212
<SubSystem>
213213
</SubSystem>
214214
<GenerateDebugInformation>true</GenerateDebugInformation>
215+
<AdditionalDependencies>tbs.lib;%(AdditionalDependencies)</AdditionalDependencies>
215216
</Link>
216217
</ItemDefinitionGroup>
217218
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -254,6 +255,7 @@
254255
<EnableCOMDATFolding>true</EnableCOMDATFolding>
255256
<OptimizeReferences>true</OptimizeReferences>
256257
<GenerateDebugInformation>true</GenerateDebugInformation>
258+
<AdditionalDependencies>tbs.lib;%(AdditionalDependencies)</AdditionalDependencies>
257259
</Link>
258260
</ItemDefinitionGroup>
259261
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@@ -289,6 +291,7 @@
289291
<SubSystem>
290292
</SubSystem>
291293
<GenerateDebugInformation>true</GenerateDebugInformation>
294+
<AdditionalDependencies>tbs.lib;%(AdditionalDependencies)</AdditionalDependencies>
292295
</Link>
293296
</ItemDefinitionGroup>
294297
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -329,6 +332,7 @@
329332
<EnableCOMDATFolding>true</EnableCOMDATFolding>
330333
<OptimizeReferences>true</OptimizeReferences>
331334
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
335+
<AdditionalDependencies>tbs.lib;%(AdditionalDependencies)</AdditionalDependencies>
332336
</Link>
333337
</ItemDefinitionGroup>
334338
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

configure.ac

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# wolftpm
2-
# Copyright (C) 2021 wolfSSL Inc.
2+
# Copyright (C) 2024 wolfSSL Inc.
33
# All right reserved.
44

5-
AC_COPYRIGHT([Copyright (C) 2014-2021 wolfSSL Inc.])
6-
AC_INIT([wolftpm],[3.2.0],[https://github.com/wolfssl/wolfTPM/issues],[wolftpm],[http://www.wolfssl.com])
5+
AC_COPYRIGHT([Copyright (C) 2014-2024 wolfSSL Inc.])
6+
AC_INIT([wolftpm],[3.4.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])
@@ -28,7 +28,7 @@ AC_ARG_PROGRAM
2828

2929
AC_CONFIG_HEADERS([src/config.h])
3030

31-
WOLFTPM_LIBRARY_VERSION=16:2:0
31+
WOLFTPM_LIBRARY_VERSION=16:3:0
3232
# | | |
3333
# +------+ | +---+
3434
# | | |

examples/endorsement/get_ek_certs.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838

3939
#ifndef WOLFTPM2_NO_WOLFCRYPT
4040
#include <wolfssl/wolfcrypt/asn.h>
41+
#if !defined(WOLFCRYPT_ONLY)
4142
#include "trusted_certs.h"
43+
#endif
4244
#endif
4345

4446
/******************************************************************************/
@@ -89,7 +91,7 @@ static void show_ek_public(const TPM2B_PUBLIC* pub)
8991
}
9092
else if (pub->publicArea.type == TPM_ALG_ECC) {
9193
const char* curveName = "NULL";
92-
#ifndef WOLFTPM2_NO_WOLFCRYPT
94+
#if !defined(WOLFTPM2_NO_WOLFCRYPT) && defined(HAVE_ECC)
9395
curveName = wc_ecc_get_name(
9496
TPM2_GetWolfCurve(pub->publicArea.parameters.eccDetail.curveID));
9597
#endif
@@ -153,8 +155,8 @@ int TPM2_EndorsementCert_Example(void* userCtx, int argc, char *argv[])
153155
TPMT_PUBLIC publicTemplate;
154156
word32 nvIndex;
155157
#ifndef WOLFTPM2_NO_WOLFCRYPT
156-
int i;
157158
#ifndef WOLFCRYPT_ONLY
159+
int i;
158160
WOLFSSL_CERT_MANAGER* cm = NULL;
159161
#endif
160162
DecodedCert cert;
@@ -351,9 +353,10 @@ int TPM2_EndorsementCert_Example(void* userCtx, int argc, char *argv[])
351353
rc = wc_DerToPem(certBuf, certSz, NULL, 0, CERT_TYPE);
352354
if (rc > 0) { /* returns actual PEM size */
353355
pemSz = (word32)rc;
354-
rc = 0;
355-
356356
pemSz++; /* for '\0'*/
357+
rc = 0;
358+
}
359+
if (rc == 0) {
357360
pem = (char*)XMALLOC(pemSz, NULL, DYNAMIC_TYPE_TMP_BUFFER);
358361
if (pem == NULL) {
359362
rc = MEMORY_E;

examples/keygen/external_import.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,13 @@ int TPM2_ExternalImport_Example(void* userCtx, int argc, char *argv[])
8888
WOLFTPM2_DEV dev;
8989
WOLFTPM2_KEY storage; /* SRK */
9090
WOLFTPM2_KEY *primary;
91+
#ifndef WOLFTPM2_NO_HEAP
9192
WOLFTPM2_KEYBLOB* key2;
9293
WOLFTPM2_KEYBLOB* rsaKey3;
94+
#else
95+
WOLFTPM2_KEYBLOB key2[1];
96+
WOLFTPM2_KEYBLOB rsaKey3[1];
97+
#endif
9398
TPM2B_DIGEST seedValue;
9499
TPMT_PUBLIC publicTemplate3;
95100
TPMA_OBJECT attributes;
@@ -122,8 +127,10 @@ int TPM2_ExternalImport_Example(void* userCtx, int argc, char *argv[])
122127
argc--;
123128
}
124129

130+
#ifndef WOLFTPM2_NO_HEAP
125131
key2 = wolfTPM2_NewKeyBlob();
126132
rsaKey3 = wolfTPM2_NewKeyBlob();
133+
#endif
127134
primary = &storage;
128135

129136
rc = wolfTPM2_Init(&dev, TPM2_IoCb, NULL);
@@ -229,8 +236,10 @@ int TPM2_ExternalImport_Example(void* userCtx, int argc, char *argv[])
229236
wolfTPM2_UnloadHandle(&dev, &key2->handle);
230237
wolfTPM2_UnloadHandle(&dev, &primary->handle);
231238

239+
#ifndef WOLFTPM2_NO_HEAP
232240
wolfTPM2_FreeKeyBlob(key2);
233241
wolfTPM2_FreeKeyBlob(rsaKey3);
242+
#endif
234243

235244
wolfTPM2_Cleanup(&dev);
236245

examples/tls/tls_common.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@
8989
/******************************************************************************/
9090

9191
typedef struct SockIoCbCtx {
92-
int listenFd;
93-
int fd;
92+
SOCKET_T listenFd;
93+
SOCKET_T fd;
9494
} SockIoCbCtx;
9595

9696
#ifndef WOLFSSL_USER_IO
@@ -266,7 +266,7 @@ static inline int SetupSocketAndListen(SockIoCbCtx* sockIoCtx, word32 port)
266266

267267
static inline int SocketWaitClient(SockIoCbCtx* sockIoCtx)
268268
{
269-
int connd;
269+
SOCKET_T connd;
270270
struct sockaddr_in clientAddr;
271271
XSOCKLENT size = sizeof(clientAddr);
272272

src/tpm2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ TPM_RC TPM2_Init_ex(TPM2_CTX* ctx, TPM2HalIoCb ioCb, void* userCtx,
642642
/* Setup HAL IO Callback */
643643
rc = TPM2_SetHalIoCb(ctx, ioCb, userCtx);
644644
if (rc != TPM_RC_SUCCESS)
645-
return rc;
645+
return rc;
646646
#endif
647647

648648
/* Set the active TPM global */

src/tpm2_wrap.c

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
/* For some struct to buffer conversions */
3232
#include <wolftpm/tpm2_packet.h>
33-
33+
#include <hal/tpm_io.h> /* for default IO callback */
3434

3535
/* Local Functions */
3636
static int wolfTPM2_GetCapabilities_NoDev(WOLFTPM2_CAPS* cap);
@@ -182,7 +182,7 @@ WOLFTPM2_DEV* wolfTPM2_New(void)
182182
WOLFTPM2_DEV *dev = (WOLFTPM2_DEV*)XMALLOC(
183183
sizeof(WOLFTPM2_DEV), NULL, DYNAMIC_TYPE_TMP_BUFFER);
184184
if (dev != NULL) {
185-
if (wolfTPM2_Init(dev, NULL, NULL) != TPM_RC_SUCCESS) {
185+
if (wolfTPM2_Init(dev, TPM2_IoCb, NULL) != TPM_RC_SUCCESS) {
186186
XFREE(dev, NULL, DYNAMIC_TYPE_TMP_BUFFER);
187187
dev = NULL;
188188
}
@@ -797,20 +797,27 @@ static int wolfTPM2_GetCapabilities_NoDev(WOLFTPM2_CAPS* cap)
797797
#if defined(WOLFTPM_SLB9672) || defined(WOLFTPM_SLB9673)
798798
/* Get vendor specific information */
799799
if (rc == 0) {
800-
rc = tpm2_ifx_cap_vendor_get(cap, TPM_PT_VENDOR_FIX_FU_OPERATION_MODE,
800+
int rc_ifx;
801+
rc_ifx = tpm2_ifx_cap_vendor_get(cap, TPM_PT_VENDOR_FIX_FU_OPERATION_MODE,
801802
&cap->opMode, sizeof(cap->opMode));
802-
}
803-
if (rc == 0) {
804-
rc = tpm2_ifx_cap_vendor_get(cap, TPM_PT_VENDOR_FIX_FU_KEYGROUP_ID,
805-
(uint8_t*)&cap->keyGroupId, sizeof(cap->keyGroupId));
806-
}
807-
if (rc == 0) {
808-
rc = tpm2_ifx_cap_vendor_get(cap, TPM_PT_VENDOR_FIX_FU_COUNTER,
809-
(uint8_t*)&cap->fwCounter, sizeof(cap->fwCounter));
810-
}
811-
if (rc == 0) {
812-
rc = tpm2_ifx_cap_vendor_get(cap, TPM_PT_VENDOR_FIX_FU_COUNTER_SAME,
813-
(uint8_t*)&cap->fwCounterSame, sizeof(cap->fwCounterSame));
803+
if (rc_ifx == 0) {
804+
rc_ifx = tpm2_ifx_cap_vendor_get(cap, TPM_PT_VENDOR_FIX_FU_KEYGROUP_ID,
805+
(uint8_t*)&cap->keyGroupId, sizeof(cap->keyGroupId));
806+
}
807+
if (rc_ifx == 0) {
808+
rc_ifx = tpm2_ifx_cap_vendor_get(cap, TPM_PT_VENDOR_FIX_FU_COUNTER,
809+
(uint8_t*)&cap->fwCounter, sizeof(cap->fwCounter));
810+
}
811+
if (rc_ifx == 0) {
812+
rc_ifx = tpm2_ifx_cap_vendor_get(cap, TPM_PT_VENDOR_FIX_FU_COUNTER_SAME,
813+
(uint8_t*)&cap->fwCounterSame, sizeof(cap->fwCounterSame));
814+
}
815+
if (rc_ifx != 0) {
816+
#ifdef DEBUG_WOLFTPM
817+
printf("Error getting Infineon vendor capabilities 0x%x: %s\n",
818+
rc_ifx, TPM2_GetRCString(rc_ifx));
819+
#endif
820+
}
814821
}
815822
#endif
816823

@@ -1142,7 +1149,7 @@ int wolfTPM2_Cleanup_ex(WOLFTPM2_DEV* dev, int doShutdown)
11421149
return rc;
11431150
#endif
11441151

1145-
if (doShutdown) {
1152+
if (doShutdown && TPM2_GetActiveCtx() != NULL) {
11461153
Shutdown_In shutdownIn;
11471154
XMEMSET(&shutdownIn, 0, sizeof(shutdownIn));
11481155
shutdownIn.shutdownType = TPM_SU_CLEAR;

0 commit comments

Comments
 (0)