Mastercard / pkcs11-tools

A set of tools to manage objects on PKCS#11 cryptographic tokens. Compatible with many PKCS#11 library, including major HSM brands, NSS and softoken.
Other
142 stars 29 forks source link

p11req -X option results in malloc failure #48

Open gl-mc opened 10 months ago

gl-mc commented 10 months ago

Describe the bug using the p11req command with the following options

$ p11req -i testp1 -d /CN=abc/O=def/C=xx-o ~/cavium_testp1.pkcs10 -e IP:0.0.0.0 -X

results in the following bug

*** OpenSSL ERROR at ../../lib/pkcs11_req.c:49  'error:0F076041:common libcrypto routines:OPENSSL_hexstr2buf:malloc failure' - (from crypto/o_str.c:157)

To Reproduce

  1. $ p11req -i testp1 -d /CN=abc/O=def/C=xx-o ~/cavium_testp1.pkcs10 -e IP:0.0.0.0 -X
    *** OpenSSL ERROR at ../../lib/pkcs11_req.c:49  'error:0F076041:common libcrypto routines:OPENSSL_hexstr2buf:malloc failure' - (from crypto/o_str.c:157)

Expected behavior No malloc error, command should produce valid pkcs10 request file. Removing the -X option at the end makes it succeed.

Screenshots N/A

Operating System (please complete the following information):

keldonin commented 10 months ago

definitely an issue that requires fixing, however I see that the country code is illegal: C=xx Can this be tested with a valid country code as well?

keldonin commented 10 months ago

which HSM is being interfaced in this case? Marvell, CloudHSM?

gl-mc commented 10 months ago

This was a Marvell. The certificate information string was valid including the country, but I redacted it as this is a public bug report and I did not want to leak information. I'll send you the details in direct email.