Merge commit 'aae086cc650e42eec1eea8db28cd01fa868d7f90'

This commit is contained in:
2024-03-07 23:12:55 +01:00
358 changed files with 8093 additions and 5229 deletions

View File

@ -14,7 +14,6 @@
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -46,8 +45,6 @@ extern "C" {
*
******************************************************************************/
/**
* The size of the salt part of a pass-key.
*/
@ -91,7 +88,6 @@ typedef enum Tox_Err_Key_Derivation {
} Tox_Err_Key_Derivation;
typedef enum Tox_Err_Encryption {
/**
@ -118,7 +114,6 @@ typedef enum Tox_Err_Encryption {
} Tox_Err_Encryption;
typedef enum Tox_Err_Decryption {
/**
@ -157,8 +152,6 @@ typedef enum Tox_Err_Decryption {
} Tox_Err_Decryption;
/*******************************************************************************
*
* BEGIN PART 1
@ -169,8 +162,6 @@ typedef enum Tox_Err_Decryption {
*
******************************************************************************/
/**
* Encrypts the given data with the given passphrase.
*
@ -206,7 +197,6 @@ bool tox_pass_encrypt(const uint8_t plaintext[], size_t plaintext_len, const uin
bool tox_pass_decrypt(const uint8_t ciphertext[], size_t ciphertext_len, const uint8_t passphrase[],
size_t passphrase_len, uint8_t plaintext[/*! ciphertext_len - TOX_PASS_ENCRYPTION_EXTRA_LENGTH */], Tox_Err_Decryption *error);
/*******************************************************************************
*
* BEGIN PART 2
@ -216,8 +206,6 @@ bool tox_pass_decrypt(const uint8_t ciphertext[], size_t ciphertext_len, const u
*
******************************************************************************/
/**
* This type represents a pass-key.
*
@ -256,8 +244,8 @@ void tox_pass_key_free(Tox_Pass_Key *key);
* @return new symmetric key on success, NULL on failure.
*/
Tox_Pass_Key *tox_pass_key_derive(
const uint8_t passphrase[], size_t passphrase_len,
Tox_Err_Key_Derivation *error);
const uint8_t passphrase[], size_t passphrase_len,
Tox_Err_Key_Derivation *error);
/**
* Same as above, except use the given salt for deterministic key derivation.
@ -269,8 +257,8 @@ Tox_Pass_Key *tox_pass_key_derive(
* @return new symmetric key on success, NULL on failure.
*/
Tox_Pass_Key *tox_pass_key_derive_with_salt(
const uint8_t passphrase[], size_t passphrase_len,
const uint8_t salt[TOX_PASS_SALT_LENGTH], Tox_Err_Key_Derivation *error);
const uint8_t passphrase[], size_t passphrase_len,
const uint8_t salt[TOX_PASS_SALT_LENGTH], 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.
@ -320,7 +308,6 @@ typedef enum Tox_Err_Get_Salt {
} Tox_Err_Get_Salt;
/**
* Retrieves the salt used to encrypt the given data.
*
@ -341,8 +328,8 @@ typedef enum Tox_Err_Get_Salt {
* @return true on success.
*/
bool tox_get_salt(
const uint8_t ciphertext[TOX_PASS_ENCRYPTION_EXTRA_LENGTH],
uint8_t salt[TOX_PASS_SALT_LENGTH], Tox_Err_Get_Salt *error);
const uint8_t ciphertext[TOX_PASS_ENCRYPTION_EXTRA_LENGTH],
uint8_t salt[TOX_PASS_SALT_LENGTH], Tox_Err_Get_Salt *error);
/**
* Determines whether or not the given data is encrypted by this module.
@ -360,9 +347,8 @@ bool tox_get_salt(
*/
bool tox_is_data_encrypted(const uint8_t data[TOX_PASS_ENCRYPTION_EXTRA_LENGTH]);
#ifdef __cplusplus
}
} /* extern "C" */
#endif
//!TOKSTYLE-
@ -374,4 +360,4 @@ typedef Tox_Err_Get_Salt TOX_ERR_GET_SALT;
//!TOKSTYLE+
#endif // C_TOXCORE_TOXENCRYPTSAVE_TOXENCRYPTSAVE_H
#endif /* C_TOXCORE_TOXENCRYPTSAVE_TOXENCRYPTSAVE_H */