RFR: 8263978: Clarify why 0 argument is ignored in SecureRandom::setSeed [v2]

Weijun Wang weijun at openjdk.java.net
Mon Mar 22 19:44:40 UTC 2021


On Mon, 22 Mar 2021 18:40:37 GMT, Valerie Peng <valeriep at openjdk.org> wrote:

>> Weijun Wang has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   typo
>
> src/java.base/share/classes/java/security/SecureRandom.java line 739:
> 
>> 737:          * to actually do any seeding. We either keep the object unseeded
>> 738:          * (in `new SecureRandom()`) or we seed the object explicitly
>> 739:          * (in `new SecureRandom(byte[])`).
> 
> Maybe clearer to make it shorter? I removed the "It's critical..." sentence as it seems redundant.
> /*
>  * Ignore call from super constructor as well as any other calls 
>  * unfortunate enough to be passing 0. All SecureRandom
>  * constructors call `super(0)` which leads to `setSeed(0)`.
>  * We either keep the object unseeded (in `new SecureRandom()`) 
>  * or we seed the object explicitly (in `new SecureRandom(byte[])`).
>  */

Sure I can do that.

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

PR: https://git.openjdk.java.net/jdk/pull/3124



More information about the security-dev mailing list