summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2014-06-13 15:05:05 -0400
committerirungentoo <irungentoo@gmail.com>2014-06-13 15:05:05 -0400
commit0b4640a508d6ceeb8983aa819cd70f01ceeec481 (patch)
treeea46e84ca88902d04e1cfabb3a0efdcf3a5e19a0
parent8d8083b38c4ab5779cdc22dc793fa341d363a172 (diff)
Fixed typo.
This typo doesn't seem to cause any issue because according to the code in vanilla NaCl the first crypto_box_ZEROBYTES (for encryption) and crypto_box_BOXZEROBYTES (for decryption) of the array passed to the crypto_box*() functions don't need to be zero for it to work. The documentation however clearly states that they need to be zero which means they need to be zero.
-rw-r--r--toxcore/crypto_core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toxcore/crypto_core.c b/toxcore/crypto_core.c
index 6c753007..87e276e7 100644
--- a/toxcore/crypto_core.c
+++ b/toxcore/crypto_core.c
@@ -105,7 +105,7 @@ int decrypt_data_symmetric(const uint8_t *secret_key, const uint8_t *nonce, cons
105 uint8_t temp_plain[length + crypto_box_ZEROBYTES]; 105 uint8_t temp_plain[length + crypto_box_ZEROBYTES];
106 uint8_t temp_encrypted[length + crypto_box_BOXZEROBYTES]; 106 uint8_t temp_encrypted[length + crypto_box_BOXZEROBYTES];
107 107
108 memset(temp_plain, 0, crypto_box_BOXZEROBYTES); 108 memset(temp_encrypted, 0, crypto_box_BOXZEROBYTES);
109 memcpy(temp_encrypted + crypto_box_BOXZEROBYTES, encrypted, length); // Pad the message with 16 0 bytes. 109 memcpy(temp_encrypted + crypto_box_BOXZEROBYTES, encrypted, length); // Pad the message with 16 0 bytes.
110 110
111 if (crypto_box_open_afternm(temp_plain, temp_encrypted, length + crypto_box_BOXZEROBYTES, nonce, secret_key) != 0) 111 if (crypto_box_open_afternm(temp_plain, temp_encrypted, length + crypto_box_BOXZEROBYTES, nonce, secret_key) != 0)