9 Commits

Author SHA1 Message Date
Cameron Gutman
13041e0323 Further optimization to avoid needless calls to EVP_aes_128_gcm() and EVP_aes_128_cbc() 2021-04-22 17:49:51 -05:00
Cameron Gutman
8354c403f4 Optimize OpenSSL backend to avoid redundant reinitialization
It is best to pass as few parameters to EVP_*Init_ex() as possible.
Passing a key, IV, or cipher will cause redundant work to happen behind
the scenes as OpenSSL doesn't check whether they have actually changed.

This avoids a malloc()/free() and redoing AES key expansion for every
message that is encrypted and decrypted.
2021-04-22 17:34:48 -05:00
Cameron Gutman
29d2cc6d5b Improve MbedTLS implementation of AES-CBC 2021-04-22 17:08:35 -05:00
Cameron Gutman
55cf1f8d30 Remove unnecessary calls to EVP_CIPHER_CTX_reset()
EVP_EncryptInit_ex() and EVP_DecryptInit_ex() free the cipher state as required
2021-04-22 00:17:46 -05:00
Cameron Gutman
625ec431eb Improve AES-CBC code in preparation for audio encryption 2021-04-21 23:59:14 -05:00
Cameron Gutman
873fc6f837 Build fixes 2021-04-17 22:00:53 -05:00
Cameron Gutman
efaeade7a6 Small cleanup and bugfix 2021-04-17 20:24:43 -05:00
Cameron Gutman
98d7ceecf7 Add native MbedTLS crypto backend 2021-04-17 19:00:26 -05:00
Cameron Gutman
d62ee951a0 Refactor OpenSSL usage into a platform-specific file to allow other crypto backends 2021-04-17 17:47:53 -05:00