JDK-8022313 : sun/security/pkcs11/rsa/TestKeyPairGenerator.java failed in aurora
  • Type: Bug
  • Component: security-libs
  • Sub-Component: javax.crypto:pkcs11
  • Affected Version: 8,9
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: x86
  • Submitted: 2013-08-06
  • Updated: 2020-02-01
  • Resolved: 2015-02-13
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 7 JDK 8 JDK 9
7u271Fixed 8u60Fixed 9 b52Fixed
Related Reports
Duplicate :  
Relates :  
Description
TESTFAIL:sun/security/pkcs11/rsa/TestKeyPairGenerator.java


java.security.ProviderException: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_FUNCTION_FAILED
at sun.security.pkcs11.P11KeyPairGenerator.generateKeyPair(P11KeyPairGenerator.java:323)
at java.security.KeyPairGenerator$Delegate.generateKeyPair(KeyPairGenerator.java:681)
at TestKeyPairGenerator.main(TestKeyPairGenerator.java:118)
at PKCS11Test.premain(PKCS11Test.java:79)
at PKCS11Test.testNSS(PKCS11Test.java:357)
at PKCS11Test.main(PKCS11Test.java:89)
at TestKeyPairGenerator.main(TestKeyPairGenerator.java:96)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:491)
at com.sun.javatest.regtest.MainAction$SameVMRunnable.run(MainAction.java:728)
at java.lang.Thread.run(Thread.java:724)
Caused by: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_FUNCTION_FAILED
at sun.security.pkcs11.wrapper.PKCS11.C_GenerateKeyPair(Native Method)
at sun.security.pkcs11.P11KeyPairGenerator.generateKeyPair(P11KeyPairGenerator.java:315)
... 12 more
Comments
In recent 3 months (b29 to b38), this test failed 14 times out of the total 1794 runs
10-12-2014

14 times the test failed during a same binary run cycle.
09-12-2014

Good to hear that you have managed to duplicate this. I hope it won't be too difficult to diagnose now.
19-11-2013

Anything is possible with CKR_FUNCTION_FAILED. As it states in the spec: The requested function could not be performed, but detailed information about why not is not available in this error return. ... Given it does not return an error with sessions or objects, and it's infrequence, I wouldn't be surprised if another VM or test is running over this one. The function that returns the error just succeeded earlier in the test and in both stack traces at different key strengths of key geenration. RSA key generation is relatively slow, so if another test were to trample over this one, key generation would be the longest function to be sitting in
19-11-2013

This one fails intermittently on Linux (Ubuntu 12.04 in my case) too. Here's a sample log. #Test Results (version 2) #Thu Nov 07 15:15:01 GMT 2013 #checksum:7a700bdff22e360e #-----testdescription----- $file=/data/jenkins/jobs/jdk8-tl-build/builds/2013-11-07_14-18-17/archive/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java $root=/data/jenkins/jobs/jdk8-tl-build/builds/2013-11-07_14-18-17/archive/jdk/test author=Andreas Sterbenz keywords=bug4856966 library=.. run=ASSUMED_ACTION main TestKeyPairGenerator\n source=TestKeyPairGenerator.java title=Verify that the RSA KeyPairGenerator works #-----environment----- #-----testresult----- description=file\:/data/jenkins/jobs/jdk8-tl-build/builds/2013-11-07_14-18-17/archive/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java elapsed=1342 0\:00\:01.342 end=Thu Nov 07 15\:15\:01 GMT 2013 environment=regtest execStatus=Failed. Execution failed\: `main' threw exception\: java.security.ProviderException\: sun.security.pkcs11.wrapper.PKCS11Exception\: CKR_FUNCTION_FAILED hostname=ashtown.ie.oracle.com javatestOS=Linux 3.2.0-23-generic (amd64) javatestVersion=4.4 jtregVersion=jtreg 4.1 dev b00 script=com.sun.javatest.regtest.RegressionScript sections=script_messages build compile main start=Thu Nov 07 15\:15\:00 GMT 2013 test=sun/security/pkcs11/rsa/TestKeyPairGenerator.java user.name=jenkins work=/data/jenkins/workspace/jdk8-tl-test/JTwork/sun/security/pkcs11/rsa #section:script_messages ----------messages:(5/312)---------- JDK under test: (/data/jenkins/jobs/jdk8-tl-build/lastSuccessful/archive/build/linux-x86_64-normal-server-release/images/j2sdk-image) java version "1.8.0-internal" Java(TM) SE Runtime Environment (build 1.8.0-internal-jenkins_2013_11_07_14_20-b00) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b56, mixed mode) #section:build ----------messages:(3/105)---------- command: build TestKeyPairGenerator reason: Named class compiled on demand elapsed time (seconds): 0.062 result: Passed. Build successful #section:compile ----------messages:(3/251)---------- command: compile -XDignore.symbol.file=true /data/jenkins/jobs/jdk8-tl-build/builds/2013-11-07_14-18-17/archive/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java reason: .class file out of date or does not exist elapsed time (seconds): 0.062 ----------rerun:(20/2627)*---------- HOME=/var/lib/jenkins \\ LANG=en_IE.UTF-8 \\ PATH=/bin:/usr/bin \\ /data/jenkins/jobs/jdk8-tl-build/lastSuccessful/archive/build/linux-x86_64-normal-server-release/images/j2sdk-image/bin/javac \\ -J-ea \\ -J-esa \\ -J-Xmx512m \\ -J-DCompatibilityTest.disableNetwork=true \\ -J-Dtest.vm.opts='-ea -esa -Xmx512m -DCompatibilityTest.disableNetwork=true' \\ -J-Dtest.class.path.prefix=/data/jenkins/workspace/jdk8-tl-test/JTwork/classes/2/sun/security/pkcs11/rsa:/data/jenkins/jobs/jdk8-tl-build/builds/2013-11-07_14-18-17/archive/jdk/test/sun/security/pkcs11/rsa:/data/jenkins/workspace/jdk8-tl-test/JTwork/classes/2/sun/security/pkcs11 \\ -J-Dtest.jdk=/data/jenkins/jobs/jdk8-tl-build/lastSuccessful/archive/build/linux-x86_64-normal-server-release/images/j2sdk-image \\ -J-Dtest.src.path=/data/jenkins/jobs/jdk8-tl-build/builds/2013-11-07_14-18-17/archive/jdk/test/sun/security/pkcs11/rsa:/data/jenkins/jobs/jdk8-tl-build/builds/2013-11-07_14-18-17/archive/jdk/test/sun/security/pkcs11 \\ -J-Dtest.compiler.opts= \\ -J-Dcompile.jdk=/data/jenkins/jobs/jdk8-tl-build/lastSuccessful/archive/build/linux-x86_64-normal-server-release/images/j2sdk-image \\ -J-Dtest.classes=/data/jenkins/workspace/jdk8-tl-test/JTwork/classes/2/sun/security/pkcs11/rsa \\ -J-Dtest.class.path=/data/jenkins/workspace/jdk8-tl-test/JTwork/classes/2/sun/security/pkcs11/rsa:/data/jenkins/workspace/jdk8-tl-test/JTwork/classes/2/sun/security/pkcs11 \\ -J-Dtest.java.opts= \\ -J-Dtest.src=/data/jenkins/jobs/jdk8-tl-build/builds/2013-11-07_14-18-17/archive/jdk/test/sun/security/pkcs11/rsa \\ -J-Dtest.tool.vm.opts='-J-ea -J-esa -J-Xmx512m -J-DCompatibilityTest.disableNetwork=true' \\ -d /data/jenkins/workspace/jdk8-tl-test/JTwork/classes/2/sun/security/pkcs11/rsa -classpath /data/jenkins/workspace/jdk8-tl-test/JTwork/classes/2/sun/security/pkcs11/rsa:/data/jenkins/jobs/jdk8-tl-build/builds/2013-11-07_14-18-17/archive/jdk/test/sun/security/pkcs11/rsa:/data/jenkins/workspace/jdk8-tl-test/JTwork/classes/2/sun/security/pkcs11:/data/jenkins/jobs/jdk8-tl-build/lastSuccessful/archive/build/linux-x86_64-normal-server-release/images/j2sdk-image/lib/tools.jar -sourcepath /data/jenkins/jobs/jdk8-tl-build/builds/2013-11-07_14-18-17/archive/jdk/test/sun/security/pkcs11/rsa:/data/jenkins/jobs/jdk8-tl-build/builds/2013-11-07_14-18-17/archive/jdk/test/sun/security/pkcs11 -XDignore.symbol.file=true /data/jenkins/jobs/jdk8-tl-build/builds/2013-11-07_14-18-17/archive/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java ----------direct:(2/207)---------- Note: /data/jenkins/jobs/jdk8-tl-build/builds/2013-11-07_14-18-17/archive/jdk/test/sun/security/pkcs11/PKCS11Test.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. result: Passed. Compilation successful #section:main ----------messages:(3/138)---------- command: main TestKeyPairGenerator reason: Assumed action based on file name: run main TestKeyPairGenerator elapsed time (seconds): 1.28 ----------rerun:(17/2081)*---------- HOME=/var/lib/jenkins \\ LANG=en_IE.UTF-8 \\ PATH=/bin:/usr/bin \\ /data/jenkins/jobs/jdk8-tl-build/lastSuccessful/archive/build/linux-x86_64-normal-server-release/images/j2sdk-image/bin/java \\ -Dtest.vm.opts='-ea -esa -Xmx512m -DCompatibilityTest.disableNetwork=true' \\ -Dtest.class.path.prefix=/data/jenkins/workspace/jdk8-tl-test/JTwork/classes/2/sun/security/pkcs11/rsa:/data/jenkins/jobs/jdk8-tl-build/builds/2013-11-07_14-18-17/archive/jdk/test/sun/security/pkcs11/rsa:/data/jenkins/workspace/jdk8-tl-test/JTwork/classes/2/sun/security/pkcs11 \\ -Dtest.jdk=/data/jenkins/jobs/jdk8-tl-build/lastSuccessful/archive/build/linux-x86_64-normal-server-release/images/j2sdk-image \\ -Dtest.src.path=/data/jenkins/jobs/jdk8-tl-build/builds/2013-11-07_14-18-17/archive/jdk/test/sun/security/pkcs11/rsa:/data/jenkins/jobs/jdk8-tl-build/builds/2013-11-07_14-18-17/archive/jdk/test/sun/security/pkcs11 \\ -Dtest.compiler.opts= \\ -Dcompile.jdk=/data/jenkins/jobs/jdk8-tl-build/lastSuccessful/archive/build/linux-x86_64-normal-server-release/images/j2sdk-image \\ -Dtest.classes=/data/jenkins/workspace/jdk8-tl-test/JTwork/classes/2/sun/security/pkcs11/rsa \\ -Dtest.class.path=/data/jenkins/workspace/jdk8-tl-test/JTwork/classes/2/sun/security/pkcs11/rsa:/data/jenkins/workspace/jdk8-tl-test/JTwork/classes/2/sun/security/pkcs11 \\ -Dtest.java.opts= \\ -Dtest.src=/data/jenkins/jobs/jdk8-tl-build/builds/2013-11-07_14-18-17/archive/jdk/test/sun/security/pkcs11/rsa \\ -Dtest.tool.vm.opts='-J-ea -J-esa -J-Xmx512m -J-DCompatibilityTest.disableNetwork=true' \\ -classpath /data/jenkins/workspace/jdk8-tl-test/JTwork/classes/2/sun/security/pkcs11/rsa:/data/jenkins/jobs/jdk8-tl-build/builds/2013-11-07_14-18-17/archive/jdk/test/sun/security/pkcs11/rsa:/data/jenkins/workspace/jdk8-tl-test/JTwork/classes/2/sun/security/pkcs11:/data/jenkins/jobs/jdk8-tl-build/lastSuccessful/archive/build/linux-x86_64-normal-server-release/images/j2sdk-image/lib/tools.jar \\ TestKeyPairGenerator ----------System.out:(21/916)---------- Beginning test run TestKeyPairGenerator... Running test with provider SunPKCS11-NSS... Generating 512 bit keypair... SunPKCS11-NSS RSA public key, 512 bits (id 57, session object) modulus: 9150773610864677421643589525985769089436392158062748641095416331303066247840828241095337664444635301969278501019004768260947659773307945066804401655663723 public exponent: 65537 Testing MD2withRSA... Testing MD5withRSA... Testing SHA1withRSA... Testing SHA224withRSA... Testing SHA256withRSA... Generating 512 bit keypair... SunPKCS11-NSS RSA public key, 512 bits (id 59, session object) modulus: 9462280772354111839314198201390785150606751294453140387420678052221133633258857454776084613579256136570980877974414744423221401293244265046656732006015313 public exponent: 3 Testing MD2withRSA... Testing MD5withRSA... Testing SHA1withRSA... Testing SHA224withRSA... Testing SHA256withRSA... Generating 1024 bit keypair... ----------System.err:(22/1296)---------- java.security.ProviderException: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_FUNCTION_FAILED at sun.security.pkcs11.P11KeyPairGenerator.generateKeyPair(P11KeyPairGenerator.java:386) at java.security.KeyPairGenerator$Delegate.generateKeyPair(KeyPairGenerator.java:680) at TestKeyPairGenerator.main(TestKeyPairGenerator.java:118) at PKCS11Test.premain(PKCS11Test.java:79) at PKCS11Test.testNSS(PKCS11Test.java:357) at PKCS11Test.main(PKCS11Test.java:89) at TestKeyPairGenerator.main(TestKeyPairGenerator.java:96) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.sun.javatest.regtest.MainAction$SameVMRunnable.run(MainAction.java:746) at java.lang.Thread.run(Thread.java:744) Caused by: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_FUNCTION_FAILED at sun.security.pkcs11.wrapper.PKCS11.C_GenerateKeyPair(Native Method) at sun.security.pkcs11.P11KeyPairGenerator.generateKeyPair(P11KeyPairGenerator.java:378) ... 12 more JavaTest Message: Test threw exception: java.security.ProviderException JavaTest Message: shutting down test result: Failed. Execution failed: `main' threw exception: java.security.ProviderException: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_FUNCTION_FAILED test result: Failed. Execution failed: `main' threw exception: java.security.ProviderException: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_FUNCTION_FAILED
07-11-2013

I ran this again on the most recent jdk in jprt, which has windows 2003 & 2008, and the test passed. Given CKR_FUNCTION_FAILED is a general error in PKCS11 that doesn't provide any useful debugging info, and the evaluation I mentioned in the previous comment, I am moving this to a P4 as it appears to be intermittent and only shown up on Vista once. If this shows up again on a different OS or Windows version, please add a comment.
10-09-2013

jrpt tests of windows 2003 and XP show no failures using post-b100 jdk
07-08-2013

It's not a keysize problem as it failed on the second call to generate a 512 keypair. The test does a loop generating 512, 512, and 1024 bit keys. ----------System.out:(12/530)---------- Beginning test run TestKeyPairGenerator... Running test with provider SunPKCS11-NSS... Generating 512 bit keypair... SunPKCS11-NSS RSA public key, 512 bits (id 696, session object) modulus: 10039550723537764096519679627192119058837182179982735192622955614019574185633952633610378614345709584998718267131341111876490029071770202763156065274277331 public exponent: 65537 Testing MD2withRSA... Testing MD5withRSA... Testing SHA1withRSA... Testing SHA224withRSA... Testing SHA256withRSA... Generating 512 bit keypair... CKR_FUNCTION_FAILED is an odd error to return when it just executed the code moments before. I've change this back to x86/windows vista as there is no evidence it fails on other platforms to be labeled "generic". Secondly I removed the confidential flag because there is nothing concerning about this failure.
06-08-2013

Affected test (for aurora matching): sun/security/pkcs11/rsa/TestKeyPairGenerator.java
06-08-2013

Error message: Testing MD5withRSA... Testing SHA1withRSA... Testing SHA224withRSA... Testing SHA256withRSA... Generating 512 bit keypair... ----------System.err:(22/1318)---------- java.security.ProviderException: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_FUNCTION_FAILED at sun.security.pkcs11.P11KeyPairGenerator.generateKeyPair(P11KeyPairGenerator.java:323) at java.security.KeyPairGenerator$Delegate.generateKeyPair(KeyPairGenerator.java:681) at TestKeyPairGenerator.main(TestKeyPairGenerator.java:118) at PKCS11Test.premain(PKCS11Test.java:79) at PKCS11Test.testNSS(PKCS11Test.java:357) at PKCS11Test.main(PKCS11Test.java:89) at TestKeyPairGenerator.main(TestKeyPairGenerator.java:96) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:491) at com.sun.javatest.regtest.MainAction$SameVMRunnable.run(MainAction.java:728) at java.lang.Thread.run(Thread.java:724) Caused by: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_FUNCTION_FAILED at sun.security.pkcs11.wrapper.PKCS11.C_GenerateKeyPair(Native Method) at sun.security.pkcs11.P11KeyPairGenerator.generateKeyPair(P11KeyPairGenerator.java:315) ... 12 more
06-08-2013

I was wondering whether the underlying pkcs11 has disabled the generation of 512 bits RSA keys.
06-08-2013