microsoft / SymCrypt-OpenSSL

OpenSSL engine for use with SymCrypt cryptographic library
MIT License
43 stars 11 forks source link

Update tests for OpenSSL 3 and fix bugs found in test #77

Closed mamckee closed 6 months ago

mamckee commented 6 months ago

This PR updates existing tests for OpenSSL 3, and fixes any bugs found in testing

mlindgren commented 6 months ago
  message(FATAL_ERROR "Provide symcrypt pkg-config or set SYMCRYPT_ROOT_DIR variable")

np: tabs #Resolved


Refers to: CMakeLists.txt:19 in 55d107f. [](commit_id = 55d107fb4626a97dcb778ffeba4846c8f3c54615, deletion_comment = False)

mlindgren commented 6 months ago

A scenario exists in the engine that prevents this from working. EVP_CIPHER_CTX_iv_length calls into the engine, so the engine has no way of knowing the IV length for an IV passed to e_scossl_aes_gcm_init_key. The engine will continue to reject any IVs that aren't 12-bytes.

I don't follow this comment. Can't the engine save the IV length and use that for subsequent calls?

mamckee commented 6 months ago

A scenario exists in the engine that prevents this from working. EVP_CIPHER_CTX_iv_length calls into the engine, so the engine has no way of knowing the IV length for an IV passed to e_scossl_aes_gcm_init_key. The engine will continue to reject any IVs that aren't 12-bytes.

I don't follow this comment. Can't the engine save the IV length and use that for subsequent calls?

It depends on EVP_CTRL_AEAD_SET_IVLEN being set before EVP_CTRL_INIT. We might be able to rework this (i.e. not setting the IV until e_scossl_aes_gcm_init_key) but I don't want to spend a ton of time on adding new behavior to the engine. I'm sure there was a reason the IV was set in EVP_CTRL_INIT so it's something I'm hesitant to modify unless we need to.