From 69f269ffaf88515f6d5c0b34178bf0096cf5773b Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 2 Sep 2016 15:35:04 +0100 Subject: Convert AES functions to plain C --- src/cipher.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/cipher.cpp') diff --git a/src/cipher.cpp b/src/cipher.cpp index 8e3d7a5..6b53690 100644 --- a/src/cipher.cpp +++ b/src/cipher.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ #include "olm/cipher.h" -#include "olm/crypto.hh" +#include "olm/crypto.h" #include "olm/memory.hh" #include @@ -22,9 +22,9 @@ const std::size_t HMAC_KEY_LENGTH = 32; namespace { struct DerivedKeys { - olm::Aes256Key aes_key; + _olm_aes256_key aes_key; std::uint8_t mac_key[HMAC_KEY_LENGTH]; - olm::Aes256Iv aes_iv; + _olm_aes256_iv aes_iv; }; @@ -58,7 +58,7 @@ size_t aes_sha_256_cipher_mac_length(const struct _olm_cipher *cipher) { size_t aes_sha_256_cipher_encrypt_ciphertext_length( const struct _olm_cipher *cipher, size_t plaintext_length ) { - return olm::aes_encrypt_cbc_length(plaintext_length); + return _olm_crypto_aes_encrypt_cbc_length(plaintext_length); } size_t aes_sha_256_cipher_encrypt( @@ -80,8 +80,8 @@ size_t aes_sha_256_cipher_encrypt( derive_keys(c->kdf_info, c->kdf_info_length, key, key_length, keys); - olm::aes_encrypt_cbc( - keys.aes_key, keys.aes_iv, plaintext, plaintext_length, ciphertext + _olm_crypto_aes_encrypt_cbc( + &keys.aes_key, &keys.aes_iv, plaintext, plaintext_length, ciphertext ); _olm_crypto_hmac_sha256( @@ -126,8 +126,8 @@ size_t aes_sha_256_cipher_decrypt( return std::size_t(-1); } - std::size_t plaintext_length = olm::aes_decrypt_cbc( - keys.aes_key, keys.aes_iv, ciphertext, ciphertext_length, plaintext + std::size_t plaintext_length = _olm_crypto_aes_decrypt_cbc( + &keys.aes_key, &keys.aes_iv, ciphertext, ciphertext_length, plaintext ); olm::unset(keys); -- cgit v1.2.3