You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit bd3d286
Browse filesBrowse the repository at this point in the historyBrowse files
The three argument doFinal on TupleHash and ParallelHash now binds the requested output length as the L parameter of NIST SP 800-185 sec. 5.3 and sec. 6.3, as KMAC already did, rather than encoding the object's configured output size.
Copy file name to clipboardExpand all lines: docs/releasenotes.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -208,6 +208,8 @@ Date: 2026, TBD
208
208
209
209
- The PKCS12-PBMAC1 keystore asked PBKDF2 for a 256-octet MAC key against an HMAC-SHA-512 message-authentication scheme, four times the size of the key that scheme uses. RFC 9579 sec. 5 says the derived key "SHOULD be the same size as the HMAC function output size", giving the worked example of a 32-octet key for HMAC-SHA-256, so the keystore now asks for 64 - and so does the default on PKCS12StoreParameter.pbmac1WithPBKDF2Builder(), the public builder that configures the same field. Nothing was weaker for the extra length; the shorter derivation is the conformant one and is marginally cheaper. Reading is unaffected either way, since the length is taken from the file: a PFX written by an earlier release, asking for 256, still verifies, and that is why the keyLength upper bound is well above the HMAC output size rather than at it. The builder's setKeySize() parameter was named keySizeinBits but has always been used as octets, being passed straight into PBKDF2Params, whose keyLength RFC 8018 app. A.2 defines as "the length in octets of the derived key"; it is renamed keySizeInOctets, which changes no behaviour and no signature - only what the parameter is called. PBMAC1WithPBKDF2Builder had no javadoc at all, so the units were undiscoverable from the API docs; it and its six methods are now documented, including the RFC 9579 sec. 5 rule that the key length match the output size of the message-authentication scheme.
210
210
211
+
- The three argument doFinal(byte[], int, int) on org.bouncycastle.crypto.digests.TupleHash and ParallelHash ignored the requested output length when binding the L parameter, encoding right_encode of the object's configured output size instead. NIST SP 800-185 sec. 5.3 step 4 and sec. 6.3 step 4 make L both the value encoded into the message and the number of bits squeezed, so asking a TupleHash128 for 64 bytes produced neither TupleHash128(X, 512, S) nor any other function the specification names. Worse, because a 32 byte and a 64 byte request encoded the same L and then read different amounts of one output stream, the shorter result was a prefix of the longer one - contradicting the property the specification states outright for both functions, in sec. 5.1 ("Changing any input to the function, including the requested output length, will almost certainly change the final output") and sec. 6.1 ("Changing any input parameter to ParallelHash, even the requested output length, will result in unrelated output"). The requested length is now the L parameter, as it already was in KMAC, whose doFinal(out, outOff, outLen) is KMAC(K, X, outLen * 8, S). This changes the output of both classes for any caller passing an outLen other than the configured digest size; the two argument doFinal, which uses the configured size, and doOutput, which encodes right_encode(0) for the XOF variants of sec. 5.3.1 and sec. 6.3.1, are unaffected, as are the TupleHash / ParallelHash MessageDigest services of the BC provider, which only use the two argument form.
212
+
211
213
### 2.1.3 Additional Features and Functionality
212
214
213
215
- BIP340Signer can now be initialised from an AsymmetricCipherKeyPair, through the new init(boolean, AsymmetricCipherKeyPair) and init(boolean, AsymmetricCipherKeyPair, SecureRandom) methods. BIP-340 signing needs the public point twice, for the parity of d and for bytes(P) in the nonce and challenge hashes (sec. 3.3 steps 3-4), and derived it with a d'*G multiplication every time; a caller that already holds the public key can now supply it and skip that. Since the two fixed-base multiplications - that one and R = k'*G - are very nearly the whole cost of a signature, producing one measures about twice as fast this way (github #2420). The public key is not checked against the private key, because checking it means performing the multiplication being avoided; a mismatched pair simply produces a signature that does not verify, and the javadoc says so. Independently, the public point is now derived once per init() rather than on every generateSignature() call, so a signer initialised once and used for several signatures gets most of the same saving with no change on the caller's part. Signatures are unchanged in every case, and the existing CipherParameters init is untouched.
0 commit comments