Skip to content

Commit

Permalink
8247895: SHA1PRNGReseed.java is calling setSeed(0)
Browse files Browse the repository at this point in the history
Reviewed-by: weijun, rhalade
  • Loading branch information
Sibabrata Sahoo committed Mar 23, 2021
1 parent b2a52ea commit 5a51d70
Showing 1 changed file with 4 additions and 4 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -28,14 +28,14 @@

/**
* @test
* @bug 8154523
* @bug 8154523 8247895
* @summary SHA1PRNG output should change after setSeed
*/
public class SHA1PRNGReseed {

public static void main(String[] args) throws Exception {
SecureRandom sr = SecureRandom.getInstance("SHA1PRNG");
sr.setSeed(0);
sr.setSeed(1);
sr.nextInt();

ByteArrayOutputStream bout = new ByteArrayOutputStream();
Expand All @@ -45,7 +45,7 @@ public static void main(String[] args) throws Exception {
new ByteArrayInputStream(bout.toByteArray())).readObject();

int i1 = sr.nextInt();
sr2.setSeed(1);
sr2.setSeed(2);
int i2 = sr2.nextInt();

if (i1 == i2) {
Expand Down

3 comments on commit 5a51d70

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GoeLin
Copy link
Member

@GoeLin GoeLin commented on 5a51d70 Jun 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk11u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 5a51d70 Jun 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GoeLin the backport was successfully created on the branch GoeLin-backport-5a51d709 in my personal fork of openjdk/jdk11u-dev. To create a pull request with this backport targeting openjdk/jdk11u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 5a51d709 from the openjdk/jdk repository.

The commit being backported was authored by Sibabrata Sahoo on 23 Mar 2021 and was reviewed by Weijun Wang and Rajan Halade.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk11u-dev:

$ git fetch https://github.com/openjdk-bots/jdk11u-dev.git GoeLin-backport-5a51d709:GoeLin-backport-5a51d709
$ git checkout GoeLin-backport-5a51d709
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk11u-dev.git GoeLin-backport-5a51d709

Please sign in to comment.