aboutsummaryrefslogtreecommitdiff
path: root/include/olm/cipher.h
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2016-05-20 11:59:31 +0100
committerRichard van der Hoff <richard@matrix.org>2016-05-23 18:55:06 +0100
commit444ef1f70687c340ba1b0b2a22d6e63c734d5f9e (patch)
tree08e39a888a262acab58d2c0616a966a5e1034ca1 /include/olm/cipher.h
parentc57b2b71c5a1314e79a0ee110ed9e1168a70b921 (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.
Diffstat (limited to 'include/olm/cipher.h')
-rw-r--r--include/olm/cipher.h32
1 files changed, 17 insertions, 15 deletions
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);