RFR: 8298127: HSS/LMS Signature Verification [v16]

Andrey Turbanov aturbanov at openjdk.org
Thu May 18 16:24:17 UTC 2023


On Wed, 17 May 2023 20:01:26 GMT, Ferenc Rakoczi <duke at openjdk.org> wrote:

>> Implement support for Leighton-Micali Signatures (LMS) as described in RFC 8554. LMS is an approved software signing algorithm for CNSA 2.0, with SHA-256/192 parameters recommended.
>
> Ferenc Rakoczi has updated the pull request incrementally with one additional commit since the last revision:
> 
>   More input checks.

src/java.base/share/classes/sun/security/provider/HSS.java line 36:

> 34: import java.util.Arrays;
> 35: 
> 36: /*

Can we make it a javadoc?
Suggestion:

/**

src/java.base/share/classes/sun/security/provider/HSS.java line 410:

> 408:         final int sigLmType;
> 409:         final int sigOtsType;
> 410:         final private byte[] qArr;

let's remove `private` to be consistent with other fields
Suggestion:

        final byte[] qArr;

src/java.base/share/classes/sun/security/provider/HSS.java line 415:

> 413:         final int n; // output length of the hash function used in the OTS
> 414:         final int p; // number of hash chains in the signature
> 415:         final int m; // output length of the hash fubction used in the Merkle tree

typo `fubction`

src/java.base/share/classes/sun/security/provider/HSS.java line 428:

> 426: 
> 427:             LMOTSParams lmotsParams;
> 428:                 q = LMSUtils.fourBytesToInt(sigArray, offset);

indentations is confusing here

src/java.base/share/classes/sun/security/provider/HSS.java line 512:

> 510:         // Precomputed block for SHA256 when the message size is 55 bytes
> 511:         // (i.e. when SHA256 is used)
> 512:         private final static byte[] hashbufSha256_32 = {

Suggestion:

        private static final byte[] hashbufSha256_32 = {

src/java.base/share/classes/sun/security/provider/HSS.java line 711:

> 709:         protected Key engineTranslateKey(Key key) throws InvalidKeyException {
> 710:             if (key == null) {
> 711:                 throw  new InvalidKeyException("key cannot be null");

Suggestion:

                throw new InvalidKeyException("key cannot be null");

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13691#discussion_r1198023023
PR Review Comment: https://git.openjdk.org/jdk/pull/13691#discussion_r1198020705
PR Review Comment: https://git.openjdk.org/jdk/pull/13691#discussion_r1198020959
PR Review Comment: https://git.openjdk.org/jdk/pull/13691#discussion_r1198018892
PR Review Comment: https://git.openjdk.org/jdk/pull/13691#discussion_r1198018138
PR Review Comment: https://git.openjdk.org/jdk/pull/13691#discussion_r1198024479



More information about the security-dev mailing list