/hg/icedtea8-forest/jdk: 2 new changesets
andrew at icedtea.classpath.org
andrew at icedtea.classpath.org
Wed May 25 01:38:24 UTC 2016
changeset 7513dae3426b in /hg/icedtea8-forest/jdk
details: http://icedtea.classpath.org/hg/icedtea8-forest/jdk?cmd=changeset;node=7513dae3426b
author: andrew
date: Fri Apr 22 19:17:13 2016 +0100
PR2934: SunEC provider throwing KeyException with current NSS
Summary: Initialise the random number generator and feed the seed to it.
changeset 10c9f8461c29 in /hg/icedtea8-forest/jdk
details: http://icedtea.classpath.org/hg/icedtea8-forest/jdk?cmd=changeset;node=10c9f8461c29
author: andrew
date: Fri May 20 19:42:05 2016 +0100
Added tag icedtea-3.1.0pre02 for changeset 7513dae3426b
diffstat:
.hgtags | 1 +
src/share/native/sun/security/ec/ECC_JNI.cpp | 23 +++++++++++++++++++++++
src/share/native/sun/security/ec/ecc_impl.h | 4 ++--
3 files changed, 26 insertions(+), 2 deletions(-)
diffs (89 lines):
diff -r 49ce65a9e969 -r 10c9f8461c29 .hgtags
--- a/.hgtags Tue May 17 03:03:29 2016 +0100
+++ b/.hgtags Fri May 20 19:42:05 2016 +0100
@@ -602,3 +602,4 @@
ea965fea71f612d65013192aa637d88e05915b10 jdk8u92-b00
cc8d0d6c6f9543120836e70e0aa3fa9c9b6fe0f3 jdk8u92-b13
10f96be3009c666af35a128d03bacdb69134206c icedtea-3.1.0pre01
+7513dae3426bed44c4fdbe608cce2a7e5255b46c icedtea-3.1.0pre02
diff -r 49ce65a9e969 -r 10c9f8461c29 src/share/native/sun/security/ec/ECC_JNI.cpp
--- a/src/share/native/sun/security/ec/ECC_JNI.cpp Tue May 17 03:03:29 2016 +0100
+++ b/src/share/native/sun/security/ec/ECC_JNI.cpp Fri May 20 19:42:05 2016 +0100
@@ -134,8 +134,17 @@
env->GetByteArrayRegion(seed, 0, jSeedLength, pSeedBuffer);
// Generate the new keypair (using the supplied seed)
+#ifdef SYSTEM_NSS
+ if (RNG_RandomUpdate((unsigned char *) pSeedBuffer, jSeedLength)
+ != SECSuccess) {
+ ThrowException(env, KEY_EXCEPTION);
+ goto cleanup;
+ }
+ if (EC_NewKey(ecparams, &privKey) != SECSuccess) {
+#else
if (EC_NewKey(ecparams, &privKey, (unsigned char *) pSeedBuffer,
jSeedLength, 0) != SECSuccess) {
+#endif
ThrowException(env, KEY_EXCEPTION);
goto cleanup;
}
@@ -267,8 +276,18 @@
env->GetByteArrayRegion(seed, 0, jSeedLength, pSeedBuffer);
// Sign the digest (using the supplied seed)
+#ifdef SYSTEM_NSS
+ if (RNG_RandomUpdate((unsigned char *) pSeedBuffer, jSeedLength)
+ != SECSuccess) {
+ ThrowException(env, KEY_EXCEPTION);
+ goto cleanup;
+ }
+ if (ECDSA_SignDigest(&privKey, &signature_item, &digest_item)
+ != SECSuccess) {
+#else
if (ECDSA_SignDigest(&privKey, &signature_item, &digest_item,
(unsigned char *) pSeedBuffer, jSeedLength, 0) != SECSuccess) {
+#endif
ThrowException(env, KEY_EXCEPTION);
goto cleanup;
}
@@ -499,6 +518,9 @@
if (SECOID_Init() != SECSuccess) {
ThrowException(env, INTERNAL_ERROR);
}
+ if (RNG_RNGInit() != SECSuccess) {
+ ThrowException(env, INTERNAL_ERROR);
+ }
#endif
}
@@ -507,6 +529,7 @@
(JNIEnv *env, jclass UNUSED(clazz))
{
#ifdef SYSTEM_NSS
+ RNG_RNGShutdown();
if (SECOID_Shutdown() != SECSuccess) {
ThrowException(env, INTERNAL_ERROR);
}
diff -r 49ce65a9e969 -r 10c9f8461c29 src/share/native/sun/security/ec/ecc_impl.h
--- a/src/share/native/sun/security/ec/ecc_impl.h Tue May 17 03:03:29 2016 +0100
+++ b/src/share/native/sun/security/ec/ecc_impl.h Fri May 20 19:42:05 2016 +0100
@@ -254,8 +254,10 @@
This function is no longer required because the random bytes are now
supplied by the caller. Force a failure.
*/
+#ifndef SYSTEM_NSS
#define RNG_GenerateGlobalRandomBytes(p,l) SECFailure
#endif
+#endif
#define CHECK_MPI_OK(func) if (MP_OKAY > (err = func)) goto cleanup
#define MP_TO_SEC_ERROR(err)
@@ -267,8 +269,6 @@
#ifdef SYSTEM_NSS
#define EC_DecodeParams(a,b,c) EC_DecodeParams(a,b)
-#define EC_NewKey(a,b,c,d,e) EC_NewKey(a,b)
-#define ECDSA_SignDigest(a,b,c,d,e,f) ECDSA_SignDigest(a,b,c)
#define ECDSA_VerifyDigest(a,b,c,d) ECDSA_VerifyDigest(a,b,c)
#define ECDH_Derive(a,b,c,d,e,f) ECDH_Derive(a,b,c,d,e)
#else
More information about the distro-pkg-dev
mailing list