JDK-8337742 : CKR_FUNCTION_FAILED error when trying to connect to HSM
  • Type: Bug
  • Component: security-libs
  • Affected Version: 21.0.4
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2024-07-25
  • Updated: 2024-08-23
  • Resolved: 2024-08-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 24
24Unresolved
Description
A DESCRIPTION OF THE PROBLEM :
Hello,

After upgrading java version from 11 to 21 we are unable to use HSM (Ultimaco CrypstoServer 5 simulator using libcs_pkcs11_R2.so library) anymore.
During provider initialization we receive following exception:

java.security.ProviderException: Initialization failed
	at jdk.crypto.cryptoki/sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:391)
	at jdk.crypto.cryptoki/sun.security.pkcs11.SunPKCS11$1.run(SunPKCS11.java:126)
	at jdk.crypto.cryptoki/sun.security.pkcs11.SunPKCS11$1.run(SunPKCS11.java:123)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:571)
	at jdk.crypto.cryptoki/sun.security.pkcs11.SunPKCS11.configure(SunPKCS11.java:123)
Caused by: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_FUNCTION_FAILED
	at jdk.crypto.cryptoki/sun.security.pkcs11.wrapper.PKCS11.C_GetMechanismInfo(Native Method)
	at jdk.crypto.cryptoki/sun.security.pkcs11.Token.getMechanismInfo(Token.java:399)
	at jdk.crypto.cryptoki/sun.security.pkcs11.SunPKCS11.initToken(SunPKCS11.java:1313)
	at jdk.crypto.cryptoki/sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:382)
	... 59 common frames omitted

Bug also exists on Java 24. On Java 11 everything works fine.


REGRESSION : Last worked in version 11.0.24


FREQUENCY : always



Comments
Mail to submitter ============= This is in reference to the JBS bug you reported as CKR_FUNCTION_FAILED error when trying to connect to HSM. Can you provide a standalone program to reproduce the problem?
26-07-2024