提交 eb5b5af0 编写于 作者: C coffeys

Merge

......@@ -323,4 +323,5 @@ b0277ec994b751ebb761814675352506cd56bcd6 jdk8u25-b02
d7d221f56fd17b96bab4440448641a844f9e92cd jdk8u25-b08
0c6cf43c5bcf0917d07a1bc94adb7a091f18f32c jdk8u25-b09
1317d94e95861a47fee8258903b652af70a3493c jdk8u25-b10
2104dfd9a4c2b519cdca019aec938db539bf4f3f jdk8u25-b11
f935349e2c065487c745bc41f81ddc7869bd2d2d jdk8u31-b00
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2014, 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
......@@ -29,6 +29,7 @@ import java.io.IOException;
import java.security.MessageDigest;
import java.security.SecureRandomSpi;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
/**
* <p>This class provides a crytpographically strong pseudo-random number
......@@ -94,9 +95,19 @@ implements java.io.Serializable {
*/
private void init(byte[] seed) {
try {
digest = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
throw new InternalError("internal error: SHA-1 not available.", e);
/*
* Use the local SUN implementation to avoid native
* performance overhead.
*/
digest = MessageDigest.getInstance("SHA", "SUN");
} catch (NoSuchProviderException | NoSuchAlgorithmException e) {
// Fallback to any available.
try {
digest = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException exc) {
throw new InternalError(
"internal error: SHA-1 not available.", exc);
}
}
if (seed != null) {
......@@ -265,9 +276,19 @@ implements java.io.Serializable {
s.defaultReadObject ();
try {
digest = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
throw new InternalError("internal error: SHA-1 not available.", e);
/*
* Use the local SUN implementation to avoid native
* performance overhead.
*/
digest = MessageDigest.getInstance("SHA", "SUN");
} catch (NoSuchProviderException | NoSuchAlgorithmException e) {
// Fallback to any available.
try {
digest = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException exc) {
throw new InternalError(
"internal error: SHA-1 not available.", exc);
}
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册