Open mouse07410 opened 5 years ago
That is an interesting question. What openssl version is this?
1.1.1c.
But I think 3.0 did the same. Could not replicate with 3.0 on this machine.
Could you please provide the dtruss logs?
Sorry, I cannot: dtruss
requires root access, which somehow blocks access to the HW token.
sudo -EH dtruss -f /opt/local/bin/openssl cms -engine pkcs11 -keyform engine -aes256 -decrypt -binary -inform PEM -in /tmp/derive.44415.text.cms -out /tmp/derive.44415.text.dec -inkey "pkcs11:manufacturer=piv_II;object=KEY%20MAN%20key;object-type=private" 2>&1 | tee ossl-p-out.txt
dtrace: system integrity protection is on, some features will not be available
PID/THRD SYSCALL(args) = return
engine "pkcs11" set.
Specified object not found
Specified object not found
PKCS11_get_private_key returned NULL
cannot load signing key file from engine
4357936576:error:81067065:pkcs11 engine:ctx_load_privkey:object not found:eng_back.c:870:
4357936576:error:26096080:engine routines:ENGINE_load_private_key:failed loading private key:crypto/engine/eng_pkey.c:78:
and ossl-p-out.txt
OpenSSL-3.0 does not seem to be doing that:
$ openssl3 cms -engine pkcs11 -keyform engine -aes256 -decrypt -binary -inform PEM -in /tmp/derive.44415.text.cms -out /tmp/derive.44415.text.dec -inkey "pkcs11:manufacturer=piv_II;object=KEY%20MAN%20key;object-type=private"
engine "pkcs11" set.
Enter PKCS#11 token PIN for xxxxxxx:
$
One thing is clear: if the engine is defined in the openssl.cnf
, OpenSSL would at least look at it. The question is - would OpenSSL load that engine? It appears that OpenSSL-3 may or may not, but OpenSSL-1.1.1 always does?
The second question is - how does the GOST engine end up being loaded twice?
@levitte are you up to fixing another one today? :-)
No, not today.
I remember that I also got twice engine loaded if using openssl ca with -config option
In some cases, like invoking git
, this double loading is a fatal error. I'm reasonably certain that this problem is reproducible.
Would be nice to see it fixed.
Well. If I understand correctly, engines (and providers since 3.0) are not designed for being loaded more than once. For most of the command-line applications, you can provide an extra configuration file for their purpose.
And AFAIK, I don't (explicitly) load it twice. But somehow it ends up there.
Here's the relevant part of the
openssl.cnf
:@levitte something seems wrong here - why would the engine get loaded, and more than once - when a different one is requested?