diff options
author | Richard van der Hoff <github@rvanderhoff.org.uk> | 2016-09-05 10:42:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-05 10:42:09 +0100 |
commit | 057ab15c1a9bd6e09b31955e840861151b5ad69e (patch) | |
tree | 140b55571972ddf76c28515ec767ac01a5e21712 /src/cipher.cpp | |
parent | 2aad4cfa860e33228372d525b4bc6a8bcdfbb8f6 (diff) | |
parent | 69f269ffaf88515f6d5c0b34178bf0096cf5773b (diff) |
Merge pull request #14 from matrix-org/rav/convert_crypto_to_c
Convert crypto.hh into C-compatible interface
Diffstat (limited to 'src/cipher.cpp')
-rw-r--r-- | src/cipher.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
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 <cstring> @@ -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); |