On Mon, 23 Mar 2026 20:32:43 GMT, Mark Powers <[email protected]> wrote:

>> [JDK-8369917](https://bugs.openjdk.org/browse/JDK-8369917)
>
> Mark Powers has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   update KeyUtil::hashAlgFromHSS to allow more numbers

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

> 426:         }
> 427: 
> 428:         static LMSParams of(int type) {

This method can be refactored into a big state expression just like 
`LMOTSParams.of`. There is no need to define the local variables below.

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

> 694:                 0, 0, 0, 0, 0, 0, 1, 0x78
> 695:         };
> 696: 

Either remove this empty line, or, add empty lines before 684 and 718.

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

> 749:             this.hashAlgName = hashAlgName;
> 750:             this.hashAlg_n = hashAlg_n;
> 751:             if (hashAlgName.startsWith("SHAKE")) {

Not sure if there will be other "SHAKE" later, but to be safe, just check 
`.equals("SHAKE256-512")`, the else below can also be `.equals("SHA-256")`. 
Maybe a switch.

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

> 766:         static LMOTSParams of(int lmotsType) {
> 767:             LMOTSParams params;
> 768:             switch (lmotsType) {

This can be refactored into a switch expression.

src/java.base/share/classes/sun/security/util/KeyUtil.java line 447:

> 445:             // Section 5.3: LMS public key is u32str(type) || 
> u32str(otstype) || I || T[1]
> 446:             // Section 8: type is the numeric identifier for an LMS 
> specification.
> 447:             // This RFC defines 5 SHA-256 based types, value from 5 to 9.

You can remove line 447.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29833#discussion_r3013043652
PR Review Comment: https://git.openjdk.org/jdk/pull/29833#discussion_r3010616136
PR Review Comment: https://git.openjdk.org/jdk/pull/29833#discussion_r3010626668
PR Review Comment: https://git.openjdk.org/jdk/pull/29833#discussion_r3013041326
PR Review Comment: https://git.openjdk.org/jdk/pull/29833#discussion_r3010599094

Reply via email to