RFR: 8282077: PKCS11 provider C_sign() impl should handle CKR_BUFFER_TOO_SMALL error

Mikael Vidstedt mikael at openjdk.java.net
Fri Feb 18 22:13:49 UTC 2022


On Fri, 18 Feb 2022 21:52:59 GMT, Valerie Peng <valeriep at openjdk.org> wrote:

> Could someone please help review this trivial change? This is to add an error handling for the potential CKR_BUFFER_TOO_SMALL error when calling C_Sign(). Since none of the supported signature algorithms trigger this error as the default buffer size is large enough, this is more for consistency sake. No new regression test for this and thus the @noreg-hard label.
> 
> Thanks,
> Valerie

src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_sign.c line 151:

> 149:         if (bufP == NULL) {
> 150:             throwOutOfMemoryError(env, 0);
> 151:             return NULL;

Does ckpData need to be freed here?

-------------

PR: https://git.openjdk.java.net/jdk/pull/7540



More information about the security-dev mailing list