diff options
Diffstat (limited to 'include/olm')
-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 |
5 files changed, 36 insertions, 34 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; |