diff options
author | Richard van der Hoff <richard@matrix.org> | 2016-05-20 11:59:31 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2016-05-23 18:55:06 +0100 |
commit | 444ef1f70687c340ba1b0b2a22d6e63c734d5f9e (patch) | |
tree | 08e39a888a262acab58d2c0616a966a5e1034ca1 | |
parent | c57b2b71c5a1314e79a0ee110ed9e1168a70b921 (diff) |
Prefix for internal symbols
Give a load of internal symbols "_olm_" prefixes. This better delineates the
public and private interfaces in the module, and helps avoid internal symbols
leaking out and possibly being abused.
-rw-r--r-- | include/olm/base64.h | 8 | ||||
-rw-r--r-- | include/olm/cipher.h | 32 | ||||
-rw-r--r-- | include/olm/crypto.h | 6 | ||||
-rw-r--r-- | include/olm/pickle.h | 18 | ||||
-rw-r--r-- | include/olm/ratchet.hh | 6 | ||||
-rw-r--r-- | src/base64.cpp | 8 | ||||
-rw-r--r-- | src/cipher.cpp | 33 | ||||
-rw-r--r-- | src/crypto.cpp | 6 | ||||
-rw-r--r-- | src/olm.cpp | 8 | ||||
-rw-r--r-- | src/pickle.cpp | 12 | ||||
-rw-r--r-- | src/ratchet.cpp | 14 | ||||
-rw-r--r-- | src/session.cpp | 10 | ||||
-rw-r--r-- | src/utility.cpp | 2 | ||||
-rw-r--r-- | tests/test_base64.cpp | 8 | ||||
-rw-r--r-- | tests/test_crypto.cpp | 8 | ||||
-rw-r--r-- | tests/test_ratchet.cpp | 4 |
16 files changed, 93 insertions, 90 deletions
diff --git a/include/olm/base64.h b/include/olm/base64.h index e7a9a50..80384a8 100644 --- a/include/olm/base64.h +++ b/include/olm/base64.h @@ -30,7 +30,7 @@ extern "C" { /** * The number of bytes of unpadded base64 needed to encode a length of input. */ -size_t olm_encode_base64_length( +size_t _olm_encode_base64_length( size_t input_length ); @@ -42,7 +42,7 @@ size_t olm_encode_base64_length( * * Returns number of bytes encoded */ -size_t olm_encode_base64( +size_t _olm_encode_base64( uint8_t const * input, size_t input_length, uint8_t * output ); @@ -51,7 +51,7 @@ size_t olm_encode_base64( * The number of bytes of raw data a length of unpadded base64 will encode to. * Returns size_t(-1) if the length is not a valid length for base64. */ -size_t olm_decode_base64_length( +size_t _olm_decode_base64_length( size_t input_length ); @@ -63,7 +63,7 @@ size_t olm_decode_base64_length( * * Returns number of bytes decoded */ -size_t olm_decode_base64( +size_t _olm_decode_base64( uint8_t const * input, size_t input_length, uint8_t * output ); diff --git a/include/olm/cipher.h b/include/olm/cipher.h index 0d6fd5b..3296c37 100644 --- a/include/olm/cipher.h +++ b/include/olm/cipher.h @@ -23,20 +23,22 @@ extern "C" { #endif -struct olm_cipher; +struct _olm_cipher; -struct cipher_ops { +struct _olm_cipher_ops { /** * Returns the length of the message authentication code that will be * appended to the output. */ - size_t (*mac_length)(const struct olm_cipher *cipher); + size_t (*mac_length)(const struct _olm_cipher *cipher); /** * Returns the length of cipher-text for a given length of plain-text. */ - size_t (*encrypt_ciphertext_length)(const struct olm_cipher *cipher, - size_t plaintext_length); + size_t (*encrypt_ciphertext_length)( + const struct _olm_cipher *cipher, + size_t plaintext_length + ); /* * Encrypts the plain-text into the output buffer and authenticates the @@ -53,7 +55,7 @@ struct cipher_ops { * buffer is too small. Otherwise returns the length of the output buffer. */ size_t (*encrypt)( - const struct olm_cipher *cipher, + const struct _olm_cipher *cipher, uint8_t const * key, size_t key_length, uint8_t const * plaintext, size_t plaintext_length, uint8_t * ciphertext, size_t ciphertext_length, @@ -65,7 +67,7 @@ struct cipher_ops { * cipher-text can contain. */ size_t (*decrypt_max_plaintext_length)( - const struct olm_cipher *cipher, + const struct _olm_cipher *cipher, size_t ciphertext_length ); @@ -84,7 +86,7 @@ struct cipher_ops { * of the plain text. */ size_t (*decrypt)( - const struct olm_cipher *cipher, + const struct _olm_cipher *cipher, uint8_t const * key, size_t key_length, uint8_t const * input, size_t input_length, uint8_t const * ciphertext, size_t ciphertext_length, @@ -92,16 +94,16 @@ struct cipher_ops { ); /** destroy any private data associated with this cipher */ - void (*destruct)(struct olm_cipher *cipher); + void (*destruct)(struct _olm_cipher *cipher); }; -struct olm_cipher { - const struct cipher_ops *ops; +struct _olm_cipher { + const struct _olm_cipher_ops *ops; /* cipher-specific fields follow */ }; -struct olm_cipher_aes_sha_256 { - struct olm_cipher base_cipher; +struct _olm_cipher_aes_sha_256 { + struct _olm_cipher base_cipher; uint8_t const * kdf_info; size_t kdf_info_length; @@ -121,8 +123,8 @@ struct olm_cipher_aes_sha_256 { * * kdf_info_length: length of context string kdf_info */ -struct olm_cipher *olm_cipher_aes_sha_256_init( - struct olm_cipher_aes_sha_256 *cipher, +struct _olm_cipher *_olm_cipher_aes_sha_256_init( + struct _olm_cipher_aes_sha_256 *cipher, uint8_t const * kdf_info, size_t kdf_info_length); diff --git a/include/olm/crypto.h b/include/olm/crypto.h index 1357834..31b9b60 100644 --- a/include/olm/crypto.h +++ b/include/olm/crypto.h @@ -31,7 +31,7 @@ const size_t SHA256_OUTPUT_LENGTH = 32; /** Computes SHA-256 of the input. The output buffer must be a least 32 * bytes long. */ -void crypto_sha256( +void _olm_crypto_sha256( uint8_t const * input, size_t input_length, uint8_t * output ); @@ -40,7 +40,7 @@ void crypto_sha256( * http://tools.ietf.org/html/rfc2104 * Computes HMAC-SHA-256 of the input for the key. The output buffer must * be at least 32 bytes long. */ -void crypto_hmac_sha256( +void _olm_crypto_hmac_sha256( uint8_t const * key, size_t key_length, uint8_t const * input, size_t input_length, uint8_t * output @@ -50,7 +50,7 @@ void crypto_hmac_sha256( /** HMAC-based Key Derivation Function (HKDF) * https://tools.ietf.org/html/rfc5869 * Derives key material from the input bytes. */ -void crypto_hkdf_sha256( +void _olm_crypto_hkdf_sha256( uint8_t const * input, size_t input_length, uint8_t const * info, size_t info_length, uint8_t const * salt, size_t salt_length, diff --git a/include/olm/pickle.h b/include/olm/pickle.h index 4e46910..c1e8192 100644 --- a/include/olm/pickle.h +++ b/include/olm/pickle.h @@ -21,25 +21,25 @@ extern "C" { #endif -#define olm_pickle_uint32_length(value) 4 -uint8_t * olm_pickle_uint32(uint8_t * pos, uint32_t value); -uint8_t const * olm_unpickle_uint32( +#define _olm_pickle_uint32_length(value) 4 +uint8_t * _olm_pickle_uint32(uint8_t * pos, uint32_t value); +uint8_t const * _olm_unpickle_uint32( uint8_t const * pos, uint8_t const * end, uint32_t *value ); -#define olm_pickle_bool_length(value) 1 -uint8_t * olm_pickle_bool(uint8_t * pos, int value); -uint8_t const * olm_unpickle_bool( +#define _olm_pickle_bool_length(value) 1 +uint8_t * _olm_pickle_bool(uint8_t * pos, int value); +uint8_t const * _olm_unpickle_bool( uint8_t const * pos, uint8_t const * end, int *value ); -#define olm_pickle_bytes_length(bytes, bytes_length) (bytes_length) -uint8_t * olm_pickle_bytes(uint8_t * pos, uint8_t const * bytes, +#define _olm_pickle_bytes_length(bytes, bytes_length) (bytes_length) +uint8_t * _olm_pickle_bytes(uint8_t * pos, uint8_t const * bytes, size_t bytes_length); -uint8_t const * olm_unpickle_bytes(uint8_t const * pos, uint8_t const * end, +uint8_t const * _olm_unpickle_bytes(uint8_t const * pos, uint8_t const * end, uint8_t * bytes, size_t bytes_length); diff --git a/include/olm/ratchet.hh b/include/olm/ratchet.hh index e1d462d..acb5608 100644 --- a/include/olm/ratchet.hh +++ b/include/olm/ratchet.hh @@ -17,7 +17,7 @@ #include "olm/list.hh" #include "olm/error.h" -struct olm_cipher; +struct _olm_cipher; namespace olm { @@ -69,14 +69,14 @@ struct Ratchet { Ratchet( KdfInfo const & kdf_info, - olm_cipher const *ratchet_cipher + _olm_cipher const *ratchet_cipher ); /** A some strings identifying the application to feed into the KDF. */ KdfInfo const & kdf_info; /** The AEAD cipher to use for encrypting messages. */ - olm_cipher const *ratchet_cipher; + _olm_cipher const *ratchet_cipher; /** The last error that happened encrypting or decrypting a message. */ OlmErrorCode last_error; diff --git a/src/base64.cpp b/src/base64.cpp index 920119e..bbfb210 100644 --- a/src/base64.cpp +++ b/src/base64.cpp @@ -138,13 +138,13 @@ std::uint8_t const * olm::decode_base64( // implementations of base64.h -size_t olm_encode_base64_length( +size_t _olm_encode_base64_length( size_t input_length ) { return olm::encode_base64_length(input_length); } -size_t olm_encode_base64( +size_t _olm_encode_base64( uint8_t const * input, size_t input_length, uint8_t * output ) { @@ -152,13 +152,13 @@ size_t olm_encode_base64( return r - output; } -size_t olm_decode_base64_length( +size_t _olm_decode_base64_length( size_t input_length ) { return olm::decode_base64_length(input_length); } -size_t olm_decode_base64( +size_t _olm_decode_base64( uint8_t const * input, size_t input_length, uint8_t * output ) { diff --git a/src/cipher.cpp b/src/cipher.cpp index 8c56efa..73d6680 100644 --- a/src/cipher.cpp +++ b/src/cipher.cpp @@ -32,7 +32,7 @@ static void derive_keys( DerivedKeys & keys ) { std::uint8_t derived_secrets[2 * olm::KEY_LENGTH + olm::IV_LENGTH]; - crypto_hkdf_sha256( + _olm_crypto_hkdf_sha256( key, key_length, nullptr, 0, kdf_info, kdf_info_length, @@ -47,24 +47,24 @@ static void derive_keys( static const std::size_t MAC_LENGTH = 8; -size_t aes_sha_256_cipher_mac_length(const struct olm_cipher *cipher) { +size_t aes_sha_256_cipher_mac_length(const struct _olm_cipher *cipher) { return MAC_LENGTH; } size_t aes_sha_256_cipher_encrypt_ciphertext_length( - const struct olm_cipher *cipher, size_t plaintext_length + const struct _olm_cipher *cipher, size_t plaintext_length ) { return olm::aes_encrypt_cbc_length(plaintext_length); } size_t aes_sha_256_cipher_encrypt( - const struct olm_cipher *cipher, + const struct _olm_cipher *cipher, uint8_t const * key, size_t key_length, uint8_t const * plaintext, size_t plaintext_length, uint8_t * ciphertext, size_t ciphertext_length, uint8_t * output, size_t output_length ) { - auto *c = reinterpret_cast<const olm_cipher_aes_sha_256 *>(cipher); + auto *c = reinterpret_cast<const _olm_cipher_aes_sha_256 *>(cipher); if (aes_sha_256_cipher_encrypt_ciphertext_length(cipher, plaintext_length) < ciphertext_length) { @@ -80,7 +80,7 @@ size_t aes_sha_256_cipher_encrypt( keys.aes_key, keys.aes_iv, plaintext, plaintext_length, ciphertext ); - crypto_hmac_sha256( + _olm_crypto_hmac_sha256( keys.mac_key, olm::KEY_LENGTH, output, output_length - MAC_LENGTH, mac ); @@ -92,27 +92,27 @@ size_t aes_sha_256_cipher_encrypt( size_t aes_sha_256_cipher_decrypt_max_plaintext_length( - const struct olm_cipher *cipher, + const struct _olm_cipher *cipher, size_t ciphertext_length ) { return ciphertext_length; } size_t aes_sha_256_cipher_decrypt( - const struct olm_cipher *cipher, + const struct _olm_cipher *cipher, uint8_t const * key, size_t key_length, uint8_t const * input, size_t input_length, uint8_t const * ciphertext, size_t ciphertext_length, uint8_t * plaintext, size_t max_plaintext_length ) { - auto *c = reinterpret_cast<const olm_cipher_aes_sha_256 *>(cipher); + auto *c = reinterpret_cast<const _olm_cipher_aes_sha_256 *>(cipher); DerivedKeys keys; std::uint8_t mac[SHA256_OUTPUT_LENGTH]; derive_keys(c->kdf_info, c->kdf_info_length, key, key_length, keys); - crypto_hmac_sha256( + _olm_crypto_hmac_sha256( keys.mac_key, olm::KEY_LENGTH, input, input_length - MAC_LENGTH, mac ); @@ -131,11 +131,11 @@ size_t aes_sha_256_cipher_decrypt( } -void aes_sha_256_cipher_destruct(struct olm_cipher *cipher) { +void aes_sha_256_cipher_destruct(struct _olm_cipher *cipher) { } -const cipher_ops aes_sha_256_cipher_ops = { +const _olm_cipher_ops aes_sha_256_cipher_ops = { aes_sha_256_cipher_mac_length, aes_sha_256_cipher_encrypt_ciphertext_length, aes_sha_256_cipher_encrypt, @@ -147,10 +147,11 @@ const cipher_ops aes_sha_256_cipher_ops = { } // namespace -olm_cipher *olm_cipher_aes_sha_256_init(struct olm_cipher_aes_sha_256 *cipher, - uint8_t const * kdf_info, - size_t kdf_info_length) -{ +_olm_cipher *_olm_cipher_aes_sha_256_init( + struct _olm_cipher_aes_sha_256 *cipher, + uint8_t const * kdf_info, + size_t kdf_info_length +) { cipher->base_cipher.ops = &aes_sha_256_cipher_ops; cipher->kdf_info = kdf_info; cipher->kdf_info_length = kdf_info_length; diff --git a/src/crypto.cpp b/src/crypto.cpp index 175b323..4fa92f1 100644 --- a/src/crypto.cpp +++ b/src/crypto.cpp @@ -255,7 +255,7 @@ std::size_t olm::aes_decrypt_cbc( } -void crypto_sha256( +void _olm_crypto_sha256( std::uint8_t const * input, std::size_t input_length, std::uint8_t * output ) { @@ -267,7 +267,7 @@ void crypto_sha256( } -void crypto_hmac_sha256( +void _olm_crypto_hmac_sha256( std::uint8_t const * key, std::size_t key_length, std::uint8_t const * input, std::size_t input_length, std::uint8_t * output @@ -283,7 +283,7 @@ void crypto_hmac_sha256( } -void crypto_hkdf_sha256( +void _olm_crypto_hkdf_sha256( std::uint8_t const * input, std::size_t input_length, std::uint8_t const * salt, std::size_t salt_length, std::uint8_t const * info, std::size_t info_length, diff --git a/src/olm.cpp b/src/olm.cpp index 9d84758..b34a1dc 100644 --- a/src/olm.cpp +++ b/src/olm.cpp @@ -59,11 +59,11 @@ static std::uint8_t const * from_c(void const * bytes) { static const std::uint8_t CIPHER_KDF_INFO[] = "Pickle"; -const olm_cipher *get_pickle_cipher() { - static olm_cipher *cipher = NULL; - static olm_cipher_aes_sha_256 PICKLE_CIPHER; +const _olm_cipher *get_pickle_cipher() { + static _olm_cipher *cipher = NULL; + static _olm_cipher_aes_sha_256 PICKLE_CIPHER; if (!cipher) { - cipher = olm_cipher_aes_sha_256_init( + cipher = _olm_cipher_aes_sha_256_init( &PICKLE_CIPHER, CIPHER_KDF_INFO, sizeof(CIPHER_KDF_INFO) - 1 ); diff --git a/src/pickle.cpp b/src/pickle.cpp index 1158306..fc3e2b4 100644 --- a/src/pickle.cpp +++ b/src/pickle.cpp @@ -200,34 +200,34 @@ std::uint8_t const * olm::unpickle( ////// pickle.h implementations -uint8_t * olm_pickle_uint32(uint8_t * pos, uint32_t value) { +uint8_t * _olm_pickle_uint32(uint8_t * pos, uint32_t value) { return olm::pickle(pos, value); } -uint8_t const * olm_unpickle_uint32( +uint8_t const * _olm_unpickle_uint32( uint8_t const * pos, uint8_t const * end, uint32_t *value ) { return olm::unpickle(pos, end, *value); } -uint8_t * olm_pickle_bool(uint8_t * pos, int value) { +uint8_t * _olm_pickle_bool(uint8_t * pos, int value) { return olm::pickle(pos, (bool)value); } -uint8_t const * olm_unpickle_bool( +uint8_t const * _olm_unpickle_bool( uint8_t const * pos, uint8_t const * end, int *value ) { return olm::unpickle(pos, end, *reinterpret_cast<bool *>(value)); } -uint8_t * olm_pickle_bytes(uint8_t * pos, uint8_t const * bytes, +uint8_t * _olm_pickle_bytes(uint8_t * pos, uint8_t const * bytes, size_t bytes_length) { return olm::pickle_bytes(pos, bytes, bytes_length); } -uint8_t const * olm_unpickle_bytes(uint8_t const * pos, uint8_t const * end, +uint8_t const * _olm_unpickle_bytes(uint8_t const * pos, uint8_t const * end, uint8_t * bytes, size_t bytes_length) { return olm::unpickle_bytes(pos, end, bytes, bytes_length); } diff --git a/src/ratchet.cpp b/src/ratchet.cpp index de46be4..abcc8a1 100644 --- a/src/ratchet.cpp +++ b/src/ratchet.cpp @@ -50,7 +50,7 @@ static void create_chain_key( olm::SharedKey secret; olm::curve25519_shared_secret(our_key, their_key, secret); std::uint8_t derived_secrets[2 * olm::KEY_LENGTH]; - crypto_hkdf_sha256( + _olm_crypto_hkdf_sha256( secret, sizeof(secret), root_key, sizeof(root_key), info.ratchet_info, info.ratchet_info_length, @@ -70,7 +70,7 @@ static void advance_chain_key( olm::ChainKey const & chain_key, olm::ChainKey & new_chain_key ) { - crypto_hmac_sha256( + _olm_crypto_hmac_sha256( chain_key.key, sizeof(chain_key.key), CHAIN_KEY_SEED, sizeof(CHAIN_KEY_SEED), new_chain_key.key @@ -84,7 +84,7 @@ static void create_message_keys( olm::ChainKey const & chain_key, olm::KdfInfo const & info, olm::MessageKey & message_key) { - crypto_hmac_sha256( + _olm_crypto_hmac_sha256( chain_key.key, sizeof(chain_key.key), MESSAGE_KEY_SEED, sizeof(MESSAGE_KEY_SEED), message_key.key @@ -94,7 +94,7 @@ static void create_message_keys( static std::size_t verify_mac_and_decrypt( - olm_cipher const *cipher, + _olm_cipher const *cipher, olm::MessageKey const & message_key, olm::MessageReader const & reader, std::uint8_t * plaintext, std::size_t max_plaintext_length @@ -184,7 +184,7 @@ static std::size_t verify_mac_and_decrypt_for_new_chain( olm::Ratchet::Ratchet( olm::KdfInfo const & kdf_info, - olm_cipher const * ratchet_cipher + _olm_cipher const * ratchet_cipher ) : kdf_info(kdf_info), ratchet_cipher(ratchet_cipher), last_error(OlmErrorCode::OLM_SUCCESS) { @@ -196,7 +196,7 @@ void olm::Ratchet::initialise_as_bob( olm::Curve25519PublicKey const & their_ratchet_key ) { std::uint8_t derived_secrets[2 * olm::KEY_LENGTH]; - crypto_hkdf_sha256( + _olm_crypto_hkdf_sha256( shared_secret, shared_secret_length, nullptr, 0, kdf_info.root_info, kdf_info.root_info_length, @@ -218,7 +218,7 @@ void olm::Ratchet::initialise_as_alice( olm::Curve25519KeyPair const & our_ratchet_key ) { std::uint8_t derived_secrets[2 * olm::KEY_LENGTH]; - crypto_hkdf_sha256( + _olm_crypto_hkdf_sha256( shared_secret, shared_secret_length, nullptr, 0, kdf_info.root_info, kdf_info.root_info_length, diff --git a/src/session.cpp b/src/session.cpp index 0d9b58a..19b9f21 100644 --- a/src/session.cpp +++ b/src/session.cpp @@ -35,11 +35,11 @@ static const olm::KdfInfo OLM_KDF_INFO = { RATCHET_KDF_INFO, sizeof(RATCHET_KDF_INFO) - 1 }; -const olm_cipher *get_cipher() { - static olm_cipher *cipher; - static olm_cipher_aes_sha_256 OLM_CIPHER; +const _olm_cipher *get_cipher() { + static _olm_cipher *cipher; + static _olm_cipher_aes_sha_256 OLM_CIPHER; if (!cipher) { - cipher = olm_cipher_aes_sha_256_init( + cipher = _olm_cipher_aes_sha_256_init( &OLM_CIPHER, CIPHER_KDF_INFO, sizeof(CIPHER_KDF_INFO) - 1 ); @@ -216,7 +216,7 @@ std::size_t olm::Session::session_id( pos = olm::store_array(pos, alice_identity_key.public_key); pos = olm::store_array(pos, alice_base_key.public_key); pos = olm::store_array(pos, bob_one_time_key.public_key); - crypto_sha256(tmp, sizeof(tmp), id); + _olm_crypto_sha256(tmp, sizeof(tmp), id); return session_id_length(); } diff --git a/src/utility.cpp b/src/utility.cpp index 2169e60..67029c9 100644 --- a/src/utility.cpp +++ b/src/utility.cpp @@ -35,7 +35,7 @@ size_t olm::Utility::sha256( last_error = OlmErrorCode::OLM_OUTPUT_BUFFER_TOO_SMALL; return std::size_t(-1); } - crypto_sha256(input, input_length, output); + _olm_crypto_sha256(input, input_length, output); return SHA256_OUTPUT_LENGTH; } diff --git a/tests/test_base64.cpp b/tests/test_base64.cpp index a1efe17..c95e3c9 100644 --- a/tests/test_base64.cpp +++ b/tests/test_base64.cpp @@ -26,11 +26,11 @@ std::uint8_t input[] = "Hello World"; std::uint8_t expected_output[] = "SGVsbG8gV29ybGQ"; std::size_t input_length = sizeof(input) - 1; -std::size_t output_length = ::olm_encode_base64_length(input_length); +std::size_t output_length = ::_olm_encode_base64_length(input_length); assert_equals(std::size_t(15), output_length); std::uint8_t output[output_length]; -output_length = ::olm_encode_base64(input, input_length, output); +output_length = ::_olm_encode_base64(input, input_length, output); assert_equals(std::size_t(15), output_length); assert_equals(expected_output, output, output_length); } @@ -57,11 +57,11 @@ std::uint8_t input[] = "SGVsbG8gV29ybGQ"; std::uint8_t expected_output[] = "Hello World"; std::size_t input_length = sizeof(input) - 1; -std::size_t output_length = ::olm_decode_base64_length(input_length); +std::size_t output_length = ::_olm_decode_base64_length(input_length); assert_equals(std::size_t(11), output_length); std::uint8_t output[output_length]; -output_length = ::olm_decode_base64(input, input_length, output); +output_length = ::_olm_decode_base64(input, input_length, output); assert_equals(std::size_t(11), output_length); assert_equals(expected_output, output, output_length); } diff --git a/tests/test_crypto.cpp b/tests/test_crypto.cpp index e86f3ab..1041538 100644 --- a/tests/test_crypto.cpp +++ b/tests/test_crypto.cpp @@ -186,7 +186,7 @@ std::uint8_t expected[32] = { std::uint8_t actual[32]; -crypto_sha256(input, sizeof(input), actual); +_olm_crypto_sha256(input, sizeof(input), actual); assert_equals(expected, actual, 32); @@ -207,7 +207,7 @@ std::uint8_t expected[32] = { std::uint8_t actual[32]; -crypto_hmac_sha256(input, sizeof(input), input, sizeof(input), actual); +_olm_crypto_hmac_sha256(input, sizeof(input), input, sizeof(input), actual); assert_equals(expected, actual, 32); @@ -242,7 +242,7 @@ std::uint8_t hmac_expected_output[32] = { std::uint8_t hmac_actual_output[32] = {}; -crypto_hmac_sha256( +_olm_crypto_hmac_sha256( salt, sizeof(salt), input, sizeof(input), hmac_actual_output @@ -261,7 +261,7 @@ std::uint8_t hkdf_expected_output[42] = { std::uint8_t hkdf_actual_output[42] = {}; -crypto_hkdf_sha256( +_olm_crypto_hkdf_sha256( input, sizeof(input), salt, sizeof(salt), info, sizeof(info), diff --git a/tests/test_ratchet.cpp b/tests/test_ratchet.cpp index 2c8bc1b..3997eb3 100644 --- a/tests/test_ratchet.cpp +++ b/tests/test_ratchet.cpp @@ -28,8 +28,8 @@ olm::KdfInfo kdf_info = { ratchet_info, sizeof(ratchet_info) - 1 }; -olm_cipher_aes_sha_256 cipher0; -olm_cipher *cipher = olm_cipher_aes_sha_256_init( +_olm_cipher_aes_sha_256 cipher0; +_olm_cipher *cipher = _olm_cipher_aes_sha_256_init( &cipher0, message_info, sizeof(message_info) - 1 ); |