summaryrefslogtreecommitdiff
path: root/protocols/Tox/libtox/src/toxencryptsave/toxencryptsave.h
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Tox/libtox/src/toxencryptsave/toxencryptsave.h')
-rw-r--r--protocols/Tox/libtox/src/toxencryptsave/toxencryptsave.h61
1 files changed, 31 insertions, 30 deletions
diff --git a/protocols/Tox/libtox/src/toxencryptsave/toxencryptsave.h b/protocols/Tox/libtox/src/toxencryptsave/toxencryptsave.h
index 4b58165e7d..3f22b75884 100644
--- a/protocols/Tox/libtox/src/toxencryptsave/toxencryptsave.h
+++ b/protocols/Tox/libtox/src/toxencryptsave/toxencryptsave.h
@@ -3,23 +3,22 @@
* Copyright © 2013-2016 Tox Developers.
*/
-/*
+/**
* Batch encryption functions.
*/
+
#ifndef C_TOXCORE_TOXENCRYPTSAVE_TOXENCRYPTSAVE_H
#define C_TOXCORE_TOXENCRYPTSAVE_TOXENCRYPTSAVE_H
-//!TOKSTYLE-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*******************************************************************************
*
* This module is organized into two parts.
@@ -72,7 +71,7 @@ uint32_t tox_pass_key_length(void);
uint32_t tox_pass_encryption_extra_length(void);
-typedef enum TOX_ERR_KEY_DERIVATION {
+typedef enum Tox_Err_Key_Derivation {
/**
* The function returned successfully.
@@ -90,10 +89,10 @@ typedef enum TOX_ERR_KEY_DERIVATION {
*/
TOX_ERR_KEY_DERIVATION_FAILED,
-} TOX_ERR_KEY_DERIVATION;
+} Tox_Err_Key_Derivation;
-typedef enum TOX_ERR_ENCRYPTION {
+typedef enum Tox_Err_Encryption {
/**
* The function returned successfully.
@@ -117,10 +116,10 @@ typedef enum TOX_ERR_ENCRYPTION {
*/
TOX_ERR_ENCRYPTION_FAILED,
-} TOX_ERR_ENCRYPTION;
+} Tox_Err_Encryption;
-typedef enum TOX_ERR_DECRYPTION {
+typedef enum Tox_Err_Decryption {
/**
* The function returned successfully.
@@ -156,7 +155,7 @@ typedef enum TOX_ERR_DECRYPTION {
*/
TOX_ERR_DECRYPTION_FAILED,
-} TOX_ERR_DECRYPTION;
+} Tox_Err_Decryption;
@@ -188,7 +187,7 @@ typedef enum TOX_ERR_DECRYPTION {
* @return true on success.
*/
bool tox_pass_encrypt(const uint8_t *plaintext, size_t plaintext_len, const uint8_t *passphrase, size_t passphrase_len,
- uint8_t *ciphertext, TOX_ERR_ENCRYPTION *error);
+ uint8_t *ciphertext, Tox_Err_Encryption *error);
/**
* Decrypts the given data with the given passphrase.
@@ -205,7 +204,7 @@ bool tox_pass_encrypt(const uint8_t *plaintext, size_t plaintext_len, const uint
* @return true on success.
*/
bool tox_pass_decrypt(const uint8_t *ciphertext, size_t ciphertext_len, const uint8_t *passphrase,
- size_t passphrase_len, uint8_t *plaintext, TOX_ERR_DECRYPTION *error);
+ size_t passphrase_len, uint8_t *plaintext, Tox_Err_Decryption *error);
/*******************************************************************************
@@ -239,7 +238,7 @@ typedef struct Tox_Pass_Key Tox_Pass_Key;
* Deallocate a Tox_Pass_Key. This function behaves like free(), so NULL is an
* acceptable argument value.
*/
-void tox_pass_key_free(struct Tox_Pass_Key *_key);
+void tox_pass_key_free(struct Tox_Pass_Key *key);
/**
* Generates a secret symmetric key from the given passphrase.
@@ -249,7 +248,7 @@ void tox_pass_key_free(struct Tox_Pass_Key *_key);
*
* Note that this function is not deterministic; to derive the same key from
* a password, you also must know the random salt that was used. A
- * deterministic version of this function is tox_pass_key_derive_with_salt.
+ * deterministic version of this function is `tox_pass_key_derive_with_salt`.
*
* @param passphrase The user-provided password. Can be empty.
* @param passphrase_len The length of the password.
@@ -257,7 +256,7 @@ void tox_pass_key_free(struct Tox_Pass_Key *_key);
* @return true on success.
*/
struct Tox_Pass_Key *tox_pass_key_derive(const uint8_t *passphrase, size_t passphrase_len,
- TOX_ERR_KEY_DERIVATION *error);
+ Tox_Err_Key_Derivation *error);
/**
* Same as above, except use the given salt for deterministic key derivation.
@@ -269,7 +268,7 @@ struct Tox_Pass_Key *tox_pass_key_derive(const uint8_t *passphrase, size_t passp
* @return true on success.
*/
struct Tox_Pass_Key *tox_pass_key_derive_with_salt(const uint8_t *passphrase, size_t passphrase_len,
- const uint8_t *salt, TOX_ERR_KEY_DERIVATION *error);
+ const uint8_t *salt, Tox_Err_Key_Derivation *error);
/**
* Encrypt a plain text with a key produced by tox_pass_key_derive or tox_pass_key_derive_with_salt.
@@ -283,8 +282,8 @@ struct Tox_Pass_Key *tox_pass_key_derive_with_salt(const uint8_t *passphrase, si
*
* @return true on success.
*/
-bool tox_pass_key_encrypt(const struct Tox_Pass_Key *_key, const uint8_t *plaintext, size_t plaintext_len,
- uint8_t *ciphertext, TOX_ERR_ENCRYPTION *error);
+bool tox_pass_key_encrypt(const struct Tox_Pass_Key *key, const uint8_t *plaintext, size_t plaintext_len,
+ uint8_t *ciphertext, Tox_Err_Encryption *error);
/**
* This is the inverse of tox_pass_key_encrypt, also using only keys produced by
@@ -296,10 +295,10 @@ bool tox_pass_key_encrypt(const struct Tox_Pass_Key *_key, const uint8_t *plaint
*
* @return true on success.
*/
-bool tox_pass_key_decrypt(const struct Tox_Pass_Key *_key, const uint8_t *ciphertext, size_t ciphertext_len,
- uint8_t *plaintext, TOX_ERR_DECRYPTION *error);
+bool tox_pass_key_decrypt(const struct Tox_Pass_Key *key, const uint8_t *ciphertext, size_t ciphertext_len,
+ uint8_t *plaintext, Tox_Err_Decryption *error);
-typedef enum TOX_ERR_GET_SALT {
+typedef enum Tox_Err_Get_Salt {
/**
* The function returned successfully.
@@ -317,7 +316,7 @@ typedef enum TOX_ERR_GET_SALT {
*/
TOX_ERR_GET_SALT_BAD_FORMAT,
-} TOX_ERR_GET_SALT;
+} Tox_Err_Get_Salt;
/**
@@ -339,7 +338,7 @@ typedef enum TOX_ERR_GET_SALT {
*
* @return true on success.
*/
-bool tox_get_salt(const uint8_t *ciphertext, uint8_t *salt, TOX_ERR_GET_SALT *error);
+bool tox_get_salt(const uint8_t *ciphertext, uint8_t *salt, Tox_Err_Get_Salt *error);
/**
* Determines whether or not the given data is encrypted by this module.
@@ -362,10 +361,12 @@ bool tox_is_data_encrypted(const uint8_t *data);
}
#endif
-typedef TOX_ERR_KEY_DERIVATION Tox_Err_Key_Derivation;
-typedef TOX_ERR_ENCRYPTION Tox_Err_Encryption;
-typedef TOX_ERR_DECRYPTION Tox_Err_Decryption;
-typedef TOX_ERR_GET_SALT Tox_Err_Get_Salt;
+//!TOKSTYLE-
+
+typedef Tox_Err_Key_Derivation TOX_ERR_KEY_DERIVATION;
+typedef Tox_Err_Encryption TOX_ERR_ENCRYPTION;
+typedef Tox_Err_Decryption TOX_ERR_DECRYPTION;
+typedef Tox_Err_Get_Salt TOX_ERR_GET_SALT;
//!TOKSTYLE+