Skip to content
Permalink
Browse files
8233954: UnsatisfiedLinkError or NoSuchAlgorithmException after remov…
…ing sunec.dll

Backport-of: 5161ab9
  • Loading branch information
Olga Mikhaltsova authored and Yuri Nesterenko committed Nov 26, 2020
1 parent 89354b8 commit 5af784b4a61c6047a42330a3e227aa770cdb458a
Showing with 33 additions and 11 deletions.
  1. +11 −0 src/java.base/share/classes/sun/security/ssl/NamedGroup.java
  2. +22 −11 src/java.base/share/classes/sun/security/ssl/SignatureScheme.java
@@ -250,8 +250,19 @@ private NamedGroup(int id, String name,
this.supportedProtocols = supportedProtocols;
this.keAlgParamSpec = keAlgParamSpec;

// Check if it is a supported named group.
AlgorithmParameters algParams = 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) {
try {
algParams =
@@ -272,17 +272,28 @@ private SignatureScheme(int id, String name,
Arrays.asList(handshakeSupportedProtocols);

boolean mediator = true;
if (signAlgParams != null) {
mediator = signAlgParams.isAvailable;
} else {
try {
Signature.getInstance(algorithm);
} catch (Exception e) {
mediator = false;
if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
SSLLogger.warning(
"Signature algorithm, " + algorithm +
", is not supported by the underlying providers");
// 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) {
mediator = signAlgParams.isAvailable;
} else {
try {
Signature.getInstance(algorithm);
} catch (Exception e) {
mediator = false;
if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
SSLLogger.warning(
"Signature algorithm, " + algorithm +
", is not supported by the underlying providers");
}
}
}
}

1 comment on commit 5af784b

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on 5af784b Nov 26, 2020

Please sign in to comment.