Repository navigation
Summary
This release adds verify-only LMS/HSS and XMSS/XMSS^MT support, an option to
link a static wolfSSL into libwolfpkcs11, and partial token writes that make
creating and destroying token objects much faster on custom stores. It also
fixes a large number of PKCS#11 specification compliance, memory-safety and
concurrency issues found through static analysis and external reports, fixes
TPM ECDH, the Windows ABI and the default token path, and enables
ThreadSanitizer in CI.
Compatibility with 2.1 behavior
Some of these fixes change behavior that applications or stored tokens may
depend on:
- Key material in stored token objects is now encrypted with the object's
policy (class, key type, key generation mechanism, local flag and operation
flags) as authenticated data. Tokens written by 2.1 and earlier still load,
and each object is rewritten in the new format the next time it is stored.
Earlier releases cannot read objects in the new format, so a token used with
2.2 cannot be moved back to an earlier release. (PR #243) - The token path lookup order is now
WOLFPKCS11_TOKEN_PATH, the NSS store
directory,WOLFPKCS11_DEFAULT_TOKEN_PATH, then the home directory, and a
path set with--with-default-token-pathis now used. POSIX builds that set
a default path and have tokens in$HOME/.wolfPKCS11need to set
WOLFPKCS11_TOKEN_PATHor move the token files. See the
WOLFPKCS11_TOKEN_PATHsection above. (PR #225, PR #247) - On Windows the PKCS#11 structures now use 1-byte packing, the layout other
PKCS#11 modules and applications use there. Applications must be rebuilt
with the new headers. DefineWOLFPKCS11_NO_PACKED_STRUCTSto keep the
previous layout. (PR #209) CKM_AES_CMACnow produces and checks a full 16-byte MAC. Earlier releases
used 8 bytes. (PR #243)CKA_CHECK_VALUEof a generic secret key is now the first three bytes of
the SHA-1 hash of its value, as PKCS#11 3.2 defines. AES-192 keys and
generic secrets that are not an AES key length now return a check value
instead of failing withCKR_FUNCTION_FAILED. (PR #248)C_GetAttributeValuereturnsCKR_ATTRIBUTE_TYPE_INVALIDfor attributes an
object does not have and keeps processing the template, andCKA_KEY_TYPE
is only an attribute of key objects. (PR #222)- Templates are checked more strictly.
C_SetAttributeValuerejects changes to
CKA_TOKEN,CKA_PRIVATE,CKA_MODIFIABLE, key components and certificate
values.C_CreateObjectrequires the key or certificate value.
C_GenerateKeyandC_GenerateKeyPairreject a class or key type that does
not match the mechanism. SettingCKA_ALWAYS_AUTHENTICATEtoCK_TRUE
returnsCKR_ATTRIBUTE_VALUE_INVALID. (PR #216, PR #243) - In non-NSS builds, finding, using or creating private objects needs a normal
user login, so an SO session can no longer use them.C_DeriveKey,
C_EncapsulateKeyandC_DecapsulateKeyneed a user login when the new key
is private. Closing all sessions now logs the application out, and setting
CKA_TRUSTEDneeds an SO session. (PR #207, PR #212, PR #227, PR #243) - EC keys generated on a TPM slot are now created with TPM capabilities that
matchCKA_SIGNandCKA_DERIVE, and ECDH runs on the TPM. TPM EC keys
stored by earlier releases were created for signing only and cannot be used
for ECDH. (PR #210) - Object creation fails with
CKR_FUNCTION_FAILEDonce the object ids run out
(about 268 million objects). Session objects now have their own id counter,
so session object handles start again at 1 after eachC_Initialize.
(PR #255) - After
C_DestroyObject,C_FindObjectscan return token objects in a
different order. PKCS#11 does not define the order. (PR #257) - MAXQ10xx builds must define
MAXQ10XX_PRODUCTION_KEY, or
WOLFPKCS11_MAXQ10XX_TEST_KEYto use the built-in test provisioning key.
With neither the build fails. (PR #207) - The CMake build now uses hidden symbol visibility and exports only the
C_*functions, like the autotools build. (PR #258) - A multi-threaded Windows build now needs Windows Vista or later. Windows CE,
or a_WIN32_WINNTbelow0x0600, fails with an#error. (PR #254)
Detail
- Added verify-only LMS/HSS and XMSS/XMSS^MT support (
--enable-lms,
--enable-xmss), using the PKCS#11 v3.3 mechanism, key type and attribute
values. Public keys can be imported, stored and used withC_Verify.
(PR #206) - Added an option to link a static wolfSSL into libwolfpkcs11 with its symbols
hidden (--with-static-wolfsslin autotools,WOLFPKCS11_STATIC_WOLFSSLin
CMake). The autotools build now also exports the PKCS#11 v3.0 and v3.2
functions, and the CMake package it installs no longer points at
NONE/includewhen configured without--prefix. (PR #258) - Creating and destroying token objects now writes only the changed objects
instead of the whole token, andC_SetAttributeValueon a token object
stores it straight away. (PR #257) - Fixed ECDH with EC keys generated on a TPM slot. (PR #210)
- Fixed the Windows ABI of the PKCS#11 structures. (PR #209)
- Fixed Windows GCC builds (MinGW-w64, Cygwin, MSYS2) failing on visibility
attribute warnings. (PR #224) - Fixed the default Windows token path, which read a variable that does not
exist. It is now%APPDATA%\wolfPKCS11. (PR #225) - Fixed
WOLFPKCS11_DEFAULT_TOKEN_PATHbeing ignored whenHOMEis set, and
being compiled in with extra quotes when set through configure or CMake.
(PR #247) - Fixed NSS database paths with a
sql:,dbm:orextern:prefix.
(PR #219) - Fixed
C_WrapKeyleaving the operation active after a length query, which
brokepk12util -othrough NSS. (PR #220) - Fixed
C_SetPINleaving protected token objects encrypted under the old
token key, so they could not be read after the nextC_Initialize.
(PR #226) - Fixed
CKA_CHECK_VALUEfor AES-192 keys and generic secret keys.
(PR #248) - Fixed
C_GetAttributeValuefailing the whole template for attributes an
object does not have. (PR #222) - Fixed object handles colliding with token object handles once object ids
passed0x0FFFFFFF, which could read or destroy the wrong object.
(PR #255) - Fixed a double free when two sessions destroy the same token object at the
same time. (PR #205) - Fixed
C_DestroyObjectremoving another object that had been created at
the same address by another thread. (PR #252) - Fixed the internal read/write lock being released by a thread that did not
take it, which hungpkcs11mttunder Wine, and fixed the data races
ThreadSanitizer reported. (PR #254) - Fixed a memory leak when
C_Logindecodes keys that are already loaded.
With a wolfSSL built withHAVE_WOLF_BIGINT(for example
--enable-pkcs11), RSA and ECC keys leaked their big integers, and with
dynamic key buffers ML-DSA and ML-KEM keys leaked their key buffers. A new
ASAN CI build against such a wolfSSL catches this. (PR #261) - Fixed building the AES key wrap with padding code against FIPS v5.2
modules. (PR #217) - Fixed the wolfTPM build with
WOLFPKCS11_NO_STORE. (PR #246) - Fixed numerous PKCS#11 compliance, memory-safety and concurrency findings
from Fenrir static analysis. (PR #207, PR #212, PR #213, PR #214, PR #215,
PR #216, PR #227, PR #243) These include:- Access control and login state: private objects are limited to user
sessions, login lockout counts stop at the limit and also cover
C_SetPIN, a failed login clears the derived token key, and logout
protects every decoded token object. - Stored objects: object policy is bound to the encrypted key data, stored
records are validated before use, store failures are reported and rolled
back, fresh IVs are generated before keys are stored, HKDF token keys are
stored, and every object gets a uniqueCKA_UNIQUE_ID. - Operation state: operations are released when replaced, cancelled or
ending in an error,CKR_BUFFER_TOO_SMALLreports the needed length and
keeps the operation for a retry, and lengths that do not fit in 32 bits
are rejected. - Mechanism parameters: AES-CTR counter, AES-GCM, AES-CCM, OAEP, PSS, CMAC,
ECDH, DH, HKDF and TLS derive parameters are checked, and derived keys
take theirCKA_ALWAYS_SENSITIVEandCKA_NEVER_EXTRACTABLEvalues from
the base key. - Templates: attributes are validated before an object is changed, key
material and certificate values are fixed after creation, data objects
are copied and partly updated correctly, and NSS email attributes are
sized correctly in the store. - Information functions: fixed-length fields in
C_GetInfo,
C_GetSlotInfoandC_GetTokenInfoare blank padded, and mechanism
flags and key sizes match what is implemented. SSL 3.0 key derivation is
no longer advertised. - Key material and transient MAC, AES and RNG buffers are zeroized after
use and on error paths.
- Access control and login state: private objects are limited to user
--enable-singlethreadednow definesWOLFPKCS11_SINGLE_THREADEDinstead
of wolfSSL'sSINGLE_THREADED, so wolfPKCS11 uses the same wolfSSL
structure layout as a multi-threaded libwolfssl. (PR #243)- Enabled ThreadSanitizer in CI. (PR #254)
- Fixed linking the tests in C++ debug builds. (PR #256, PR #259)
- Renamed
ecb_check_value_error_testtogeneric_secret_check_value_test.
(PR #250) - Updated the wolfBoot emulator CI image to m33mu v1.25. (PR #249)
- Added
CONTRIBUTING.md. (PR #211) - Added the 2.1 release date to the README. (PR #203)
- The shared library version is now 4.1.0, as the library exports the
PKCS#11 v3.0 and v3.2 functions. - Thanks to Peter Dennis Bartok for reporting the
C_GetAttributeValueand
CKA_CHECK_VALUEissues (issue #221, issue #245) and to Nazar Serhiichuk
for reporting the Windows ABI issue (issue #208).