summaryrefslogtreecommitdiff
path: root/toxencryptsave
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2017-01-08 15:18:36 +0000
committeriphydf <iphydf@users.noreply.github.com>2017-01-12 01:09:44 +0000
commit64807652223f27de23e7173e3fa6ca7eb2ff9351 (patch)
tree7acc33a79dcbcd4e0b1e608c7e1f2086b5b998f7 /toxencryptsave
parent8b4eae4038db87f2df1c40856c99c3ffca8887fe (diff)
Clarify that the pass key `new` function can fail.
Also clarify that passwords can be empty or NULL.
Diffstat (limited to 'toxencryptsave')
-rw-r--r--toxencryptsave/toxencryptsave.api.h11
-rw-r--r--toxencryptsave/toxencryptsave.h11
2 files changed, 14 insertions, 8 deletions
diff --git a/toxencryptsave/toxencryptsave.api.h b/toxencryptsave/toxencryptsave.api.h
index b0e29b50..0356d756 100644
--- a/toxencryptsave/toxencryptsave.api.h
+++ b/toxencryptsave/toxencryptsave.api.h
@@ -146,7 +146,7 @@ error for decryption {
146 * 146 *
147 * @param plaintext A byte array of length `plaintext_len`. 147 * @param plaintext A byte array of length `plaintext_len`.
148 * @param plaintext_len The length of the plain text array. Bigger than 0. 148 * @param plaintext_len The length of the plain text array. Bigger than 0.
149 * @param passphrase The user-provided password. 149 * @param passphrase The user-provided password. Can be empty.
150 * @param passphrase_len The length of the password. 150 * @param passphrase_len The length of the password.
151 * @param ciphertext The cipher text array to write the encrypted data to. 151 * @param ciphertext The cipher text array to write the encrypted data to.
152 * 152 *
@@ -164,7 +164,7 @@ static bool pass_encrypt(const uint8_t[plaintext_len] plaintext, const uint8_t[p
164 * 164 *
165 * @param ciphertext A byte array of length `ciphertext_len`. 165 * @param ciphertext A byte array of length `ciphertext_len`.
166 * @param ciphertext_len The length of the cipher text array. At least $PASS_ENCRYPTION_EXTRA_LENGTH. 166 * @param ciphertext_len The length of the cipher text array. At least $PASS_ENCRYPTION_EXTRA_LENGTH.
167 * @param passphrase The user-provided password. 167 * @param passphrase The user-provided password. Can be empty.
168 * @param passphrase_len The length of the password. 168 * @param passphrase_len The length of the password.
169 * @param plaintext The plain text array to write the decrypted data to. 169 * @param plaintext The plain text array to write the decrypted data to.
170 * 170 *
@@ -200,6 +200,9 @@ class pass_Key {
200 /** 200 /**
201 * Create a new $this. The initial value of it is indeterminate. To 201 * Create a new $this. The initial value of it is indeterminate. To
202 * initialise it, use one of the derive_* functions below. 202 * initialise it, use one of the derive_* functions below.
203 *
204 * In case of failure, this function returns NULL. The only failure mode at
205 * this time is memory allocation failure, so this function has no error code.
203 */ 206 */
204 static this new(); 207 static this new();
205 208
@@ -219,7 +222,7 @@ class pass_Key {
219 * a password, you also must know the random salt that was used. A 222 * a password, you also must know the random salt that was used. A
220 * deterministic version of this function is $derive_with_salt. 223 * deterministic version of this function is $derive_with_salt.
221 * 224 *
222 * @param passphrase The user-provided password. 225 * @param passphrase The user-provided password. Can be empty.
223 * @param passphrase_len The length of the password. 226 * @param passphrase_len The length of the password.
224 * 227 *
225 * @return true on success. 228 * @return true on success.
@@ -230,7 +233,7 @@ class pass_Key {
230 /** 233 /**
231 * Same as above, except use the given salt for deterministic key derivation. 234 * Same as above, except use the given salt for deterministic key derivation.
232 * 235 *
233 * @param passphrase The user-provided password. 236 * @param passphrase The user-provided password. Can be empty.
234 * @param passphrase_len The length of the password. 237 * @param passphrase_len The length of the password.
235 * @param salt An array of at least $PASS_SALT_LENGTH bytes. 238 * @param salt An array of at least $PASS_SALT_LENGTH bytes.
236 * 239 *
diff --git a/toxencryptsave/toxencryptsave.h b/toxencryptsave/toxencryptsave.h
index d03383e9..13641273 100644
--- a/toxencryptsave/toxencryptsave.h
+++ b/toxencryptsave/toxencryptsave.h
@@ -195,7 +195,7 @@ typedef enum TOX_ERR_DECRYPTION {
195 * 195 *
196 * @param plaintext A byte array of length `plaintext_len`. 196 * @param plaintext A byte array of length `plaintext_len`.
197 * @param plaintext_len The length of the plain text array. Bigger than 0. 197 * @param plaintext_len The length of the plain text array. Bigger than 0.
198 * @param passphrase The user-provided password. 198 * @param passphrase The user-provided password. Can be empty.
199 * @param passphrase_len The length of the password. 199 * @param passphrase_len The length of the password.
200 * @param ciphertext The cipher text array to write the encrypted data to. 200 * @param ciphertext The cipher text array to write the encrypted data to.
201 * 201 *
@@ -212,7 +212,7 @@ bool tox_pass_encrypt(const uint8_t *plaintext, size_t plaintext_len, const uint
212 * 212 *
213 * @param ciphertext A byte array of length `ciphertext_len`. 213 * @param ciphertext A byte array of length `ciphertext_len`.
214 * @param ciphertext_len The length of the cipher text array. At least TOX_PASS_ENCRYPTION_EXTRA_LENGTH. 214 * @param ciphertext_len The length of the cipher text array. At least TOX_PASS_ENCRYPTION_EXTRA_LENGTH.
215 * @param passphrase The user-provided password. 215 * @param passphrase The user-provided password. Can be empty.
216 * @param passphrase_len The length of the password. 216 * @param passphrase_len The length of the password.
217 * @param plaintext The plain text array to write the decrypted data to. 217 * @param plaintext The plain text array to write the decrypted data to.
218 * 218 *
@@ -252,6 +252,9 @@ typedef struct Tox_Pass_Key Tox_Pass_Key;
252/** 252/**
253 * Create a new Tox_Pass_Key. The initial value of it is indeterminate. To 253 * Create a new Tox_Pass_Key. The initial value of it is indeterminate. To
254 * initialise it, use one of the derive_* functions below. 254 * initialise it, use one of the derive_* functions below.
255 *
256 * In case of failure, this function returns NULL. The only failure mode at
257 * this time is memory allocation failure, so this function has no error code.
255 */ 258 */
256struct Tox_Pass_Key *tox_pass_key_new(void); 259struct Tox_Pass_Key *tox_pass_key_new(void);
257 260
@@ -271,7 +274,7 @@ void tox_pass_key_free(struct Tox_Pass_Key *_key);
271 * a password, you also must know the random salt that was used. A 274 * a password, you also must know the random salt that was used. A
272 * deterministic version of this function is tox_pass_key_derive_with_salt. 275 * deterministic version of this function is tox_pass_key_derive_with_salt.
273 * 276 *
274 * @param passphrase The user-provided password. 277 * @param passphrase The user-provided password. Can be empty.
275 * @param passphrase_len The length of the password. 278 * @param passphrase_len The length of the password.
276 * 279 *
277 * @return true on success. 280 * @return true on success.
@@ -282,7 +285,7 @@ bool tox_pass_key_derive(struct Tox_Pass_Key *_key, const uint8_t *passphrase, s
282/** 285/**
283 * Same as above, except use the given salt for deterministic key derivation. 286 * Same as above, except use the given salt for deterministic key derivation.
284 * 287 *
285 * @param passphrase The user-provided password. 288 * @param passphrase The user-provided password. Can be empty.
286 * @param passphrase_len The length of the password. 289 * @param passphrase_len The length of the password.
287 * @param salt An array of at least TOX_PASS_SALT_LENGTH bytes. 290 * @param salt An array of at least TOX_PASS_SALT_LENGTH bytes.
288 * 291 *