add more comments describing the pk encrypt/decrypt functions

This commit is contained in:
Hubert Chathi 2018-07-12 17:54:03 -04:00
parent bad14db8da
commit 173339ae9a

View file

@ -72,11 +72,15 @@ size_t olm_pk_encrypt_random_length(
); );
/** Encrypt a plaintext for the recipient set using /** Encrypt a plaintext for the recipient set using
* olm_pk_encryption_set_recipient_key. Returns olm_error() on failure. If the * olm_pk_encryption_set_recipient_key. Writes to the ciphertext, mac, and
* ciphertext, mac, or ephemeral_key buffers were too small then * ephemeral_key buffers, whose values should be sent to the recipient. mac is
* olm_pk_encryption_last_error() will be "OUTPUT_BUFFER_TOO_SMALL". If there * a Message Authentication Code to ensure that the data is received and
* weren't enough random bytes then olm_pk_encryption_last_error() will be * decrypted properly. ephemeral_key is the public part of the ephemeral key
* "NOT_ENOUGH_RANDOM". */ * used (together with the recipient's key) to generate a symmetric encryption
* key. Returns olm_error() on failure. If the ciphertext, mac, or
* ephemeral_key buffers were too small then olm_pk_encryption_last_error()
* will be "OUTPUT_BUFFER_TOO_SMALL". If there weren't enough random bytes then
* olm_pk_encryption_last_error() will be "NOT_ENOUGH_RANDOM". */
size_t olm_pk_encrypt( size_t olm_pk_encrypt(
OlmPkEncryption *encryption, OlmPkEncryption *encryption,
void const * plaintext, size_t plaintext_length, void const * plaintext, size_t plaintext_length,
@ -160,10 +164,11 @@ size_t olm_pk_max_plaintext_length(
size_t ciphertext_length size_t ciphertext_length
); );
/** Decrypt a ciphertext. The input ciphertext buffer is destroyed. Returns /** Decrypt a ciphertext. The input ciphertext buffer is destroyed. See the
* the length of the plaintext on success. Returns olm_error() on failure. If * olm_pk_encrypt function for descriptions of the ephemeral_key and mac
* the plaintext buffer is too small then olm_pk_encryption_last_error() will * arguments. Returns the length of the plaintext on success. Returns
* be "OUTPUT_BUFFER_TOO_SMALL". */ * olm_error() on failure. If the plaintext buffer is too small then
* olm_pk_encryption_last_error() will be "OUTPUT_BUFFER_TOO_SMALL". */
size_t olm_pk_decrypt( size_t olm_pk_decrypt(
OlmPkDecryption * decryption, OlmPkDecryption * decryption,
void const * ephemeral_key, size_t ephemeral_key_length, void const * ephemeral_key, size_t ephemeral_key_length,