Add new synthetic reproducer script for patch 5894be29

** Description changed:

  [Impact]
  
  On OpenSSL 3.0.14+ ssl_util_attrs_to_evp() → get_RSA_evp_pubkey() fails
  during C_SignInit / C_VerifyInit on RSA objects whenever an OpenSSL
  ENGINE (e.g. libp11's engine_pkcs11, loaded via -engine pkcs11) is
  registered as the process-wide default handler for RSA EVP_PKEY_METHOD.
  The observed error is:
  
  EVP_PKEY_fromdata_init: error:03000096:digital envelope
  routines::operation not supported for this keytype
  
  which propagates up through EVP_DigestSignFinal() /
  EVP_DigestVerifyFinal() and ultimately surfaces to callers as a fatal
  Host memory error / CKR_GENERAL_ERROR from tpm2-pkcs11, breaking TLS
  client authentication (e.g. wpa_supplicant EAP-TLS/PEAP with a
  TPM2-backed smartcard, using engine_pkcs11 in front of
  libtpm2_pkcs11.so).
  
  This regressed between OpenSSL 3.0.13 (working) and 3.0.14/3.5.5
  (broken).
  
  [Test Plan]
  
  This can be tested with the included synthetic reproducer: swtpm +
  tpm2-abrmd + tpm2-pkcs11 + libp11's  engine_pkcs11 , performing a real
  TLS 1.2 mutual-auth handshake (client  CertificateVerify  signed via the
  TPM-backed key) with OpenSSL 3.5.5 and  -engine pkcs11  (mirroring
- wpa_supplicant's smartcard/EAP-TLS configuration):
+ wpa_supplicant's smartcard/EAP-TLS configuration)
  
- Before the patch: handshake fails with  EVP_PKEY_fromdata_init: ...
- operation not supported for this keytype  during  C_SignInit.
+ I include here a patch that fixes the issue exposed by the reproducer
+ and a different patch that fixes a related issue (5894be29). Thus I
+ added a second script to test for this second patch.
  
- After the patch: handshake completes successfully ( Verify return code:
- 0 (ok) ), with the old error line only appearing as a benign, recovered-
- from diagnostic before the fallback succeeds.
+ Without patches the script tpm2-tls-minimal.sh returns:
+ RESULT: bug -- known error signature reproduced
+ 
+ and tpm2-tls-sign-nopkey.sh returns:
+ RESULT: ok -- handshake succeeded, bug NOT reproduced
+ 
+ After the patch the script tpm2-tls-minimal.sh returns:
+ RESULT: bug -- known error signature reproduced
+ 
+ and tpm2-tls-sign-nopkey.sh returns:
+ RESULT: ok -- handshake succeeded, 5894be29 present
+ 
  
  [Where problems could occur]
  
- The added code runs when the standard path fails so it should not affect
- any use case that is working now. This code is deprecated in OpenSSL 3.0
- and uses a pragma that silences GCC warnings so that it passes CI tests
- upstream. If the functions are removed in a future version of OpenSSL
- 3.x this could break. I do not expect this to happen though.
+ The added code in the first patch runs when the standard path fails so it 
should not affect any use case that is working now. This code is deprecated in 
OpenSSL 3.0 and uses a pragma that silences GCC warnings so that it passes CI 
tests upstream. If the functions are removed in a future version of OpenSSL 3.x 
this could break. I do not expect this to happen though.
+ The second patch only adds an if condition, so an error check code path that 
was always exercised before the patch now just is used when the if condition is 
true.
+ 
+ [Other Info]
+ 
+ OpenSSL commit 39ea783 reverted the code that made this work in version
+ 3.0.13. If that commit is backported to Noble at any time, this bug will
+ occur there, and this patch would need to be applied to that version as
+ well.

** Attachment added: "synthetic reproducer for 5894be29"
   
https://bugs.launchpad.net/ubuntu/+source/tpm2-pkcs11/+bug/2167891/+attachment/6021247/+files/tpm2-tls-sign-nopkey.sh

** Changed in: tpm2-pkcs11 (Ubuntu Stonking)
       Status: Confirmed => Invalid

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2167891

Title:
  "Host memory error" when using tpm with wpa_supplicant

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/tpm2-pkcs11/+bug/2167891/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to