RFR: 8263978: Clarify why 0 argument is ignored in SecureRandom::setSeed [v2]
Valerie Peng
valeriep at openjdk.java.net
Mon Mar 22 18:43:41 UTC 2021
On Mon, 22 Mar 2021 18:06:56 GMT, Weijun Wang <weijun at openjdk.org> wrote:
>> We don't use `digest` anymore but still need to ignore the 0 argument.
>
> 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[])`).
*/
-------------
PR: https://git.openjdk.java.net/jdk/pull/3124
More information about the security-dev
mailing list