aboutsummaryrefslogtreecommitdiff
path: root/src/crypto.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/crypto.cpp')
-rw-r--r--src/crypto.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/crypto.cpp b/src/crypto.cpp
index 89d9d72..5095c79 100644
--- a/src/crypto.cpp
+++ b/src/crypto.cpp
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include "olm/crypto.hh"
+#include "olm/crypto.h"
#include "olm/memory.hh"
#include <cstring>
@@ -163,23 +163,23 @@ int _olm_crypto_ed25519_verify(
}
-std::size_t olm::aes_encrypt_cbc_length(
+std::size_t _olm_crypto_aes_encrypt_cbc_length(
std::size_t input_length
) {
return input_length + AES_BLOCK_LENGTH - input_length % AES_BLOCK_LENGTH;
}
-void olm::aes_encrypt_cbc(
- olm::Aes256Key const & key,
- olm::Aes256Iv const & iv,
+void _olm_crypto_aes_encrypt_cbc(
+ _olm_aes256_key const *key,
+ _olm_aes256_iv const *iv,
std::uint8_t const * input, std::size_t input_length,
std::uint8_t * output
) {
std::uint32_t key_schedule[AES_KEY_SCHEDULE_LENGTH];
- ::aes_key_setup(key.key, key_schedule, AES_KEY_BITS);
+ ::aes_key_setup(key->key, key_schedule, AES_KEY_BITS);
std::uint8_t input_block[AES_BLOCK_LENGTH];
- std::memcpy(input_block, iv.iv, AES_BLOCK_LENGTH);
+ std::memcpy(input_block, iv->iv, AES_BLOCK_LENGTH);
while (input_length >= AES_BLOCK_LENGTH) {
xor_block<AES_BLOCK_LENGTH>(input_block, input);
::aes_encrypt(input_block, output, key_schedule, AES_KEY_BITS);
@@ -201,17 +201,17 @@ void olm::aes_encrypt_cbc(
}
-std::size_t olm::aes_decrypt_cbc(
- olm::Aes256Key const & key,
- olm::Aes256Iv const & iv,
+std::size_t _olm_crypto_aes_decrypt_cbc(
+ _olm_aes256_key const *key,
+ _olm_aes256_iv const *iv,
std::uint8_t const * input, std::size_t input_length,
std::uint8_t * output
) {
std::uint32_t key_schedule[AES_KEY_SCHEDULE_LENGTH];
- ::aes_key_setup(key.key, key_schedule, AES_KEY_BITS);
+ ::aes_key_setup(key->key, key_schedule, AES_KEY_BITS);
std::uint8_t block1[AES_BLOCK_LENGTH];
std::uint8_t block2[AES_BLOCK_LENGTH];
- std::memcpy(block1, iv.iv, AES_BLOCK_LENGTH);
+ std::memcpy(block1, iv->iv, AES_BLOCK_LENGTH);
for (std::size_t i = 0; i < input_length; i += AES_BLOCK_LENGTH) {
std::memcpy(block2, &input[i], AES_BLOCK_LENGTH);
::aes_decrypt(&input[i], &output[i], key_schedule, AES_KEY_BITS);