Closed DemiMarie closed 1 year ago
@DemiMarie Do you have any more concrete issues/suggestion than just pointing to the openssl issue?
@stefanberger No, but you did mention that the low-level functions are much faster than the high-level ones, and I wonder if the lack of pre-fetching is partially to blame.
This code base here maintains backwards compatibility with OpenSSL 1.1 as well and in some cases there's a lot more cycles to spend for OpenSSL 3.0 than for OpenSSL 1.1 using deprecated lower level APIs:
Work-arounds for EV_KEY_set_group is computationally expensive: https://github.com/stefanberger/libtpms/pull/352/files#diff-04c34ed9f666e08b0838b4adbf1161a337177f1a5a0fd88404b646851911800cR258
Work-around missing EC_POINTs_mul() seems more expensive: https://github.com/stefanberger/libtpms/blob/66d178b981dd84386ed20694e010c0cef30b24b2/src/tpm2/crypto/openssl/TpmToOsslMath.c#L693-L714
Work-around deprecated DES_random_key(): https://github.com/stefanberger/libtpms/pull/351/commits/1a99b9962d4b149b60457bb7abad467eddd6bfb6
Work-around AES/TDES/Camellia crypto functions using EVP functions seems a lot more expensive: https://github.com/stefanberger/libtpms/pull/349/files
I am not sure whether anyone will performance test the TPM 2 implementation but it would be a bit slower once one uses the OpenSSL 3.0 functions.
https://github.com/stefanberger/libtpms/pull/349/files#diff-dd8458cfda3caf2ace6e574df79ae81819aed9651b6f84f5ae1f233b9c32c62eR150-R156 is going to be slow. Calling EVP_CIPHER_fetch()
and EVP_MD_fetch()
during initialization will be much faster.
TPM 2 cannot use the EVP functions for hashes since libtpms needs access to the context: https://github.com/stefanberger/libtpms/wiki/OpenSSL-3-port#shaxyz_init-shaxyz_update-shaxyz_final
In PR #357 I have now added a caching layer to avoid having to call functions like EVP_aes_128_ctr()
multiple times. To avoid yet more #ifdefs for older and newer versions of OpenSSL I am not using the new EVP_CIPHER_fetch()
function but extended the existing function that also worked before 3.0.0 and doesn't touch any deprecated functions.
See https://github.com/openssl/openssl/pull/20354.