File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
src/jdk.crypto.cryptoki/share/native/libj2pkcs11 Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2003, 2019 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2003, 2022 , Oracle and/or its affiliates. All rights reserved.
33 */
44
55/* Copyright (c) 2002 Graz University of Technology. All rights reserved.
@@ -144,11 +144,22 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1Sign
144144
145145 TRACE1 ("DEBUG C_Sign: ret rv=0x%lX\n" , rv );
146146
147+ if (rv == CKR_BUFFER_TOO_SMALL ) {
148+ bufP = (CK_BYTE_PTR ) malloc (ckSignatureLength );
149+ if (bufP == NULL ) {
150+ throwOutOfMemoryError (env , 0 );
151+ goto cleanup ;
152+ }
153+ rv = (* ckpFunctions -> C_Sign )(ckSessionHandle , ckpData , ckDataLength ,
154+ bufP , & ckSignatureLength );
155+ }
156+
147157 if (ckAssertReturnValueOK (env , rv ) == CK_ASSERT_OK ) {
148158 jSignature = ckByteArrayToJByteArray (env , bufP , ckSignatureLength );
149159 TRACE1 ("DEBUG C_Sign: signature length = %lu\n" , ckSignatureLength );
150160 }
151161
162+ cleanup :
152163 free (ckpData );
153164 if (bufP != BUF ) { free (bufP ); }
154165
You can’t perform that action at this time.
0 commit comments