Created attachment 976257 [details] valgrind output [I reported this originally to https://issues.opendnssec.org/browse/SUPPORT-152 but it is a FEDORA only issue] When I generate ECC parameters with SECP384r1 using opensc's pkcs11-tool (or p11tool), I get uninitialized values warnings in valgrind. This does occur for 2048-bit rsa as well, but NOT for secp256r1. One would have expected the bytes of the generated keys to be properly initialized. I use softhsm-2.0.0b1-3.fc21.x86_64, compiled with openssl, and I get the conditional jumps with both pkcs11-tool and gnutls' p11tool. How to reproduce: $ valgrind pkcs11-tool --module /usr/lib64/pkcs11/libsofthsm2.so --keypairgen --key-type EC:secp384r1 --pin 12345678 --login --label test15 The output is attached.
Upstream in https://issues.opendnssec.org/browse/SUPPORT-152 fails to reproduce this in F21. Paul, could you verify whether the reproducer works in your F21? The full list of commands used are shown below. $ echo "directories.tokendir = ./db" >softhsm.conf $ echo "objectstore.backend = file" >>softhsm.conf $ mkdir db $ export SOFTHSM2_CONF=./softhsm.conf $ softhsm2-util --init-token --slot 0 --label test --so-pin 1234 --pin 1234 $ valgrind pkcs11-tool --module /usr/lib64/pkcs11/libsofthsm2.so --keypairgen --key-type EC:secp384r1 --pin 1234 --login --label test15 [...] Public Key Object; EC EC_POINT 384 bits ==27040== Use of uninitialised value of size 8 ==27040== at 0x3E53648131: _itoa_word (_itoa.c:180) ==27040== by 0x3E5364CC21: vfprintf (vfprintf.c:1641) ==27040== by 0x3E5370FD25: __printf_chk (printf_chk.c:35) ==27040== by 0x40BBA5: UnknownInlinedFun (stdio2.h:104) ==27040== by 0x40BBA5: show_key (pkcs11-tool.c:2606) ==27040== by 0x40BBA5: show_object (pkcs11-tool.c:2397) ==27040== by 0x40C5C8: gen_keypair (pkcs11-tool.c:1605) ==27040== by 0x405443: main (pkcs11-tool.c:814)
I get a similar though different error stream. See attached.
Created attachment 992257 [details] /tmp/s/softhsm-valgrind.txt.gz
(In reply to Paul Wouters from comment #2) > I get a similar though different error stream. See attached. Could it be issues related to FIPS140-2 mode being on? Could you try without that mode?
I was not in fips mode when doing the above test
FIPS_selftest_rsa is run so most probably you are in FIPS testing more. That is, you have /etc/system-fips present even though your kernel may not be in FIPS mode.
It seems that this issue is related to openssl. I don't see the issue at all if I use export OPENSSL_ia32cap=0 That is certainly related with some optimization openssl is using on my system, which valgrind doesn't handle well? The problem comes back if I use export OPENSSL_ia32cap=0x200000000000000 which according to https://www.openssl.org/docs/crypto/OPENSSL_ia32cap_loc.html is the AES-NI instruction set extension. There is something fishy there. Why would AES-NI affect secp384r1 key generation, but not secp256r1? In any case why would AES-NI be used anyway? The system isn't in FIPS mode to use an AES-based generator. I'm adding Tomas in case he has some idea on the issue.
Yes, this is pretty weird. Unless you have /etc/system-fips file the AES based DRBG should not be invoked at all. And presence of AES-NI instruction set should not affect anything else than AES.
This message is a reminder that Fedora 21 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 21. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '21'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 21 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.
Fedora 21 changed to end-of-life (EOL) status on 2015-12-01. Fedora 21 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. If you experience problems, please add a comment to this bug. Thank you for reporting this bug and we are sorry it could not be fixed.