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

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Weijun Wang-2
We don't use `digest` anymore but still need to ignore the 0 argument.

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

Commit messages:
 - 8263978: Clarify why 0 argument is ignored in SecureRandom::setSeed

Changes: https://git.openjdk.java.net/jdk/pull/3124/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3124&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8263978
  Stats: 5 lines in 1 file changed: 3 ins; 0 del; 2 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3124.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3124/head:pull/3124

PR: https://git.openjdk.java.net/jdk/pull/3124
Reply | Threaded
Open this post in threaded view
|

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

Weijun Wang-2
> 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

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/3124/files
  - new: https://git.openjdk.java.net/jdk/pull/3124/files/dd61f386..6bd8b100

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=3124&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=3124&range=00-01

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3124.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3124/head:pull/3124

PR: https://git.openjdk.java.net/jdk/pull/3124
Reply | Threaded
Open this post in threaded view
|

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

Valerie Peng-2
On Mon, 22 Mar 2021 18:06:56 GMT, Weijun Wang <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

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

Weijun Wang-2
On Mon, 22 Mar 2021 18:40:37 GMT, Valerie Peng <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

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

Valerie Peng-2
In reply to this post by Weijun Wang-2
On Mon, 22 Mar 2021 18:06:56 GMT, Weijun Wang <[hidden email]> 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

Marked as reviewed by valeriep (Reviewer).

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

PR: https://git.openjdk.java.net/jdk/pull/3124
Reply | Threaded
Open this post in threaded view
|

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

Weijun Wang-2
In reply to this post by Weijun Wang-2
> 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:

  simplify

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/3124/files
  - new: https://git.openjdk.java.net/jdk/pull/3124/files/6bd8b100..56dff532

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=3124&range=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=3124&range=01-02

  Stats: 7 lines in 1 file changed: 0 ins; 2 del; 5 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3124.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3124/head:pull/3124

PR: https://git.openjdk.java.net/jdk/pull/3124
Reply | Threaded
Open this post in threaded view
|

Integrated: 8263978: Clarify why 0 argument is ignored in SecureRandom::setSeed

Weijun Wang-2
In reply to this post by Weijun Wang-2
On Mon, 22 Mar 2021 15:49:55 GMT, Weijun Wang <[hidden email]> wrote:

> We don't use `digest` anymore but still need to ignore the 0 argument.

This pull request has now been integrated.

Changeset: 0b2aa1b6
Author:    Weijun Wang <[hidden email]>
URL:       https://git.openjdk.java.net/jdk/commit/0b2aa1b6
Stats:     5 lines in 1 file changed: 1 ins; 0 del; 4 mod

8263978: Clarify why 0 argument is ignored in SecureRandom::setSeed

Reviewed-by: valeriep

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

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