On Tue, 31 Mar 2026 02:02:22 GMT, Weijun Wang <[email protected]> wrote:

>> 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.

done

> 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.

fixed

> 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.

done as suggested

> 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.

refactored here and other places

> 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.

done

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29833#discussion_r3030288389
PR Review Comment: https://git.openjdk.org/jdk/pull/29833#discussion_r3030287189
PR Review Comment: https://git.openjdk.org/jdk/pull/29833#discussion_r3030285257
PR Review Comment: https://git.openjdk.org/jdk/pull/29833#discussion_r3030284151
PR Review Comment: https://git.openjdk.org/jdk/pull/29833#discussion_r3030292440

Reply via email to