8233954: UnsatisfiedLinkError or NoSuchAlgorithmException after removing sunec.dll

Reviewed-by: ascarpino
This commit is contained in:
Xue-Lei Andrew Fan 2019-11-21 18:42:33 -08:00
parent 8c6eb44946
commit 5161ab9493
2 changed files with 33 additions and 11 deletions

View File

@ -250,8 +250,19 @@ enum NamedGroup {
this.supportedProtocols = supportedProtocols; this.supportedProtocols = supportedProtocols;
this.keAlgParamSpec = keAlgParamSpec; this.keAlgParamSpec = keAlgParamSpec;
// Check if it is a supported named group.
AlgorithmParameters algParams = null; AlgorithmParameters algParams = null;
boolean mediator = (keAlgParamSpec != null); boolean mediator = (keAlgParamSpec != null);
// HACK CODE
//
// An EC provider, for example the SunEC provider, may support
// AlgorithmParameters but not KeyPairGenerator or KeyAgreement.
if (mediator && (namedGroupSpec == NamedGroupSpec.NAMED_GROUP_ECDHE)) {
mediator = JsseJce.isEcAvailable();
}
// Check the specific algorithm parameters.
if (mediator) { if (mediator) {
try { try {
algParams = algParams =

View File

@ -274,6 +274,16 @@ enum SignatureScheme {
Arrays.asList(handshakeSupportedProtocols); Arrays.asList(handshakeSupportedProtocols);
boolean mediator = true; boolean mediator = true;
// HACK CODE
//
// An EC provider, for example the SunEC provider, may support
// AlgorithmParameters but not KeyPairGenerator or Signature.
if ("EC".equals(keyAlgorithm)) {
mediator = JsseJce.isEcAvailable();
}
// Check the specific algorithm and parameters.
if (mediator) {
if (signAlgParams != null) { if (signAlgParams != null) {
mediator = signAlgParams.isAvailable; mediator = signAlgParams.isAvailable;
} else { } else {
@ -288,6 +298,7 @@ enum SignatureScheme {
} }
} }
} }
}
if (mediator && ((id >> 8) & 0xFF) == 0x03) { // SHA224 if (mediator && ((id >> 8) & 0xFF) == 0x03) { // SHA224
// There are some problems to use SHA224 on Windows. // There are some problems to use SHA224 on Windows.