I was trying to make wpa_supplicant use a tpm2-pkcs11 stored private key to authenticate
against a RADIUS server, I mentioned about it on this discussion:
With some fixes on tpm2-pkcs11, TLS is working and there is an integration test for that
I wasn't able to reproduce this on Ubuntu 18, and noted that the test cases ran on top
of an Ubuntu 16.04 image. I tried Ubuntu 16.04 and TLS works as in the integration test. I
also checked that using latest version of wpa_supplicant, it does work with tpm2-pkcs11
and creates an EAP-TLS connection using the TPM.
I've debugged a bit in both OS versions and found that openssl is calling
pkey_rsa_sign with different padding modes: RSA_PKCS1_PADDING in Ubuntu 16, and
RSA_PKCS1_PSS_PADDING in Ubuntu 18. The consequence is that in tpm2-pkcs11, sign_init is
being called using CKM_RSA_PKCS as mechanism on Ubuntu 16, but in Ubuntu 18 it is being
called with CKM_RSA_X_509, which is not supported.
I think I have to file a bug to OpenSSL, but I don't know too much about the PKCS11
specs to support the claims. I'd appreciate any help to file a decent issue. Also, any
workaround is welcome, as replacing OpenSSL in any distribution is very hard given all the
software that depends on it.