Commit Graph

60 Commits (master)

Author SHA1 Message Date
Aidan Garske b58bee5952 F-9182 - Free PKCS7 state on error paths in the sign verify examples 2026-09-10 13:09:23 -07:00
Aidan Garske 4e073434bd F-11907 - Fail PKCS7 examples when the output file cannot be opened 2026-09-09 09:24:04 -07:00
Aidan 1c2c809751 F-3494 - https://fenrir.wolfssl.com/finding/3494 - examples/pkcs7: reset offset and fix loop continuation so detached PKCS7 body actually gets written 2026-04-28 09:14:43 -07:00
Aidan Garske 90846ba49f examples/pkcs7: size output buffer for RSA-4096 signatures
MAX_PKCS7_SIZE aliased to MAX_CONTEXT_SIZE (2 KB), which is enough
  for an RSA-2048 signed blob but overflows at RSA-4096 where the
  signature alone is 512 B plus a ~1-1.5 KB cert and ASN.1 overhead.
  wc_PKCS7_EncodeSignedData then returned BUFFER_E (0xffffff7c).

  Gate on MAX_RSA_KEY_BITS so 2048-bit builds keep the exact same
  buffer size; 4096-bit builds (Nations NS350, Infineon SLB967x,
  or anyone overriding) get 4 KB.
2026-04-24 22:24:57 +01:00
David Garske 579ec8cc7f Bump copyright year to 2026 and version to 4.0.0
Release prep for v4.0.0:
- Copyright headers updated 2025 -> 2026 across sources, headers, and examples
- Library version 3.10.0 -> 4.0.0 (libtool 16:8:0 -> 17:0:0)
- configure.ac WOLFSSL_URL http -> https
2026-04-22 09:24:55 -07:00
Aidan c5145d88da F-3271 - https://fenrir.wolfssl.com/finding/3271 - Use TPM2_Packet_AppendSensitive in TPM2_LoadExternal and extend roundtrip test coverage 2026-04-21 14:08:40 -07:00
Aidan 55faf11f27 F-3249 - https://fenrir.wolfssl.com/finding/3249 - Check wc_HashGetDigestSize return with signed int before assigning to word32 2026-04-21 14:02:52 -07:00
Aidan Garske 38350aa4a0 Remove redundant rc changes 2026-02-20 21:02:10 +00:00
Aidan Garske 978b72fb12 Improve error logging when wolfTPM2_Init fails
Resolves #457. When the SPI device could not be opened (e.g., kernel TPM
  driver owns it), wolfTPM failed silently with no error output. Users had
  no indication of what went wrong or how to fix it.

  Changes:
  - Make TPM2_Init failed message in wolfTPM2_Init_ex always print
    (previously required --enable-debug)
  - Add SPI/I2C open failure logging in hal/tpm_io_linux.c: permission
    denied prints unconditionally, other errors print with DEBUG_WOLFTPM
  - Add autodetect scan exhaustion message (DEBUG_WOLFTPM)
  - Fix examples (caps, wrap_test, bench, pkcs7) that silently returned
    on init failure to print error code and RC string
  - Update 13 other examples to include error code in init failure message
2026-02-20 20:48:25 +00:00
David Garske 1402d0d132 wolfTPM Release v3.9.2 prep. Migrating to GPLv3. 2025-07-30 07:29:31 -07:00
David Garske 6fbb49a94f wolfTPM Release v3.9.0. Updated copyright and version. 2025-05-14 15:31:07 -07:00
David Garske 7c48b76548 Support for building wolfTPM against older wolfCrypt (like v4.7.0). 2024-12-13 09:45:52 -08:00
msi-debian 599998d827 Fixing PKCS7 Type delclaration 2024-11-18 10:18:05 -07:00
David Garske 1603cfdaaf More fixes for no filesystem. 2024-08-30 09:58:04 -07:00
David Garske 026c82f799 Fixes and new tests for building wolfCrypt/wolfTPM without ECC or RSA. Fixes ZD 18470. Improved smallstack (eliminated `WOLFTPM2_MAX_BUFFER`). Fixes for building with NO_ASN. 2024-08-19 09:55:15 -07:00
David Garske c98ee9a71e Update copyright date. 2024-04-24 10:42:27 -07:00
David Garske eed7803e96 Fixes for building wolfTPM examples with NO_FILESYSTEM. Tested with `./configure --enable-swtpm CFLAGS="-DNO_FILESYSTEM" && make`. 2024-03-22 14:24:18 -07:00
David Garske b395b65287 Fix for config.h, which should only be included from .c files, not headers. ZD 17473 2024-02-07 14:28:33 -08:00
David Garske 0aa01f4f5a Added PKCS7 ECC support to example. Added wrapper function to export TPM public key as DER/ASN.1 or PEM. Fix for crypto callback ECC sign to handle getting keySz for unknown cases (like PKCS7 without privateKey set). 2024-01-17 15:50:30 -08:00
David Garske 23a5d2595b Fixes for small stack. 2023-08-31 13:37:22 -07:00
David Garske 5b6c7c0368 Improvements to the secure_rot example. Add support for manually placing hash. 2023-08-15 14:41:09 -07:00
David Garske 0ceeebeaf7 Fix for building with no PEM to DER. Fix for building with static library and no debug, due to missing stdio in examples. Fix for TLS examples missing WOLFCRYPT_ONLY check. Fix for building with WC_NO_RNG. Fix for RSA salt with RNG using crypto cb. 2023-05-02 16:18:21 -07:00
David Garske c05bf659c2 Fix broken paths with HAL refactor. Update TLS examples to use latest TLS version (allowing downgrade). 2023-01-20 08:29:53 -08:00
David Garske 1ea4a591a8 HAL refactor and documentation improvements. Move example HAL implementations into new `hal` directory. Include the example HAL in the library when building. Updated HAL IO documentation. 2023-01-18 12:38:04 -08:00
David Garske 3f84b2efbc wolfTPM v2.5.0 release prep 2022-07-22 09:32:57 -07:00
David Garske 9d2483d327 New CSR wrappers to assist with TPM based CSR/Self-Signed-Cert generation including CSharp wrappers. This includes support for subject, key usage, custom request extensions and output as PEM or DER. New structure `WOLFTPM2_CSR`. New API's `wolfTPM2_CSR_*`. New CSharp class `Csr`. 2022-07-12 13:53:04 -07:00
Elms ede184c735 configure: keep example directory strcuture during install 2021-11-18 12:04:41 -08:00
Dimitar Tomov 8528a326be Added fixes and unit tests for wolfTPM2_CreateLoadedKey and TPM2_CreateLoaded
* Added new units tests and fixed missing XMEMSET
* Renamed and modified PemToTpm to PubPemToTpm, works only with Pub keys
* Fixes from peer feedback

Signed-off-by: Dimitar Tomov <dimi@wolfssl.com>
2021-07-12 15:09:28 -07:00
David Garske 2f63aadf02 Revert include.am changes. Use macro magic to include the .c file from tpm_io.c for backwards compatibility and ease for new platforms with automake. 2021-06-07 10:20:51 -07:00
Dimitar Tomov a43797ca9c Update all include.am example files
Signed-off-by: Dimitar Tomov <dimi@wolfssl.com>
2021-06-07 14:32:47 +03:00
David Garske 2b8cfb8692 wolfTPM Release v2.1.0 preparation.
* Updated copyright
* Fixed minor cast warning.
* Fixed minor scan-build warnings.
* Cleanup print public and fix possible print of uninitialized field.
2021-03-17 10:13:50 -07:00
David Garske c0fa6423d5 Cleanup of the examples to use the key templates. The PKCS7 example was failing because of a key mismatch between the TPM private key and the public key used in the certificate setup using the CSR and ./certs/certreq/sh`. 2021-01-14 16:41:12 -08:00
David Garske 845b3d1da2 Release fixes and cleanups. Fixes for init of `WOLFTPM2_HASH` in `wolfTPM2_HashStart`. Fix for for various build configurations (--disable-wrapper). Fix for Microchip "sign" bit on symmetric keys. Fix for scan-build warnings. Cleanup whitespace. 2020-12-07 11:01:02 -08:00
David Garske 4b0b70861c Added parameter encryption support to more examples. Fix to not set "encrypt" or "decrypt" if command doesn't allow it. Updated documentation. 2020-11-30 12:00:54 -08:00
David Garske 4c2e8d3f43 Added response HMAC validation. Fixes for nonce and auth count. Fix for AES CFB decrypt set key (requires `AES_ENCRYPTION` on SetKey). Cleanup verbose debugging. PR ready for review. 2020-11-25 16:04:04 -08:00
Dimitar Tomov 4b98d6d637 Fixed minor errors about missing header, variables not used and whitespaces
Signed-off-by: Dimitar Tomov <dimi@wolfssl.com>
2020-11-25 12:33:51 +02:00
David Garske 409fd96502 Fixes for response decryption. Nonce from TPM captured correctly now. Added support for args to all examples. 2020-11-24 16:44:20 -08:00
David Garske 5abeea75a9 Added object names to the command hash calculation (cpHash). Added HMAC key creation. Fixed outstanding TODO items. 2020-11-23 14:54:39 -08:00
David Garske dbd8e41b47 Refactor of the session authentication. Added "-e" option to some examples to enable parameter encryption and removed the _paramenc.c files. Fixup for the `getPrimaryStoragekey` to allow persisting if not `WOLFTPM_WINAPI`. Improve command line options. Added calculation of command hash and HMAC for sessions. 2020-11-20 16:47:14 -08:00
David Garske b1e130ae65 Update help for `--enable-cryptocb` (don't use old enable name). 2020-09-24 13:41:16 -07:00
David Garske ffa058e445 Fixes for building without wolfCrypt RSA (when `NO_RSA` is defined). 2020-04-22 10:37:50 -07:00
Chris Conlon 91ef0b0e6e update copyright to 2020 2020-01-03 15:31:27 -08:00
David Garske 7887130287 wolfTPM v1.7 Release 2019-12-27 14:43:30 -08:00
David Garske 4de58e6d60 Remove execute bit on .c/.h files. 2019-05-14 13:58:06 -07:00
David Garske 5f0c7ba6c1 Fix printf type warnings. Added missing stdio.h for printf in examples. Added new API's `TPM2_SetActiveCtx`, `TPM2_ChipStartup`, `TPM2_SetHalIoCb` and `TPM2_Init_ex`. Fix to make sure TPM2_CTX is cleaned up after `wolfTPM2_Test`. Allowed way to indicate `BOOL` type already defined. 2019-05-07 14:35:23 -07:00
David Garske 3e9d70c159 Fix to better handle chip detection. Added stdio printf include for TPM benchmark. Added C++ support. 2019-05-07 10:39:17 -07:00
David Garske a5d286c737 Fixes for various compiler warnings. Fixes for supporting new CryptoCb. Added way to implement own socket functions for TLS examples. Added TLS error codes. 2019-02-01 13:27:52 -08:00
David Garske e057bc0a35 Cleanup to ensure `TpmCryptoDevCtx tpmCtx` is memset. Added support for handling new cryptocb update. 2019-02-01 13:27:52 -08:00
David Garske dba2df99f2 Added Crypto callback support for AES, Hash and RNG. Minor compiler warning fixes. 2019-02-01 13:27:15 -08:00
David Garske d28e63c72f Added TPM2 wrappers for symmetric AES encrypt and decrypt. Moved common test parameters into examples/tpm_test.h. 2018-12-28 12:15:58 -08:00