Navigation Menu

Skip to content

Commit

Permalink
even more checks
Browse files Browse the repository at this point in the history
  • Loading branch information
gafferongames committed Jan 10, 2017
1 parent 82bf51d commit 8950d59
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions yojimbo_encryption.cpp
Expand Up @@ -52,6 +52,7 @@ namespace yojimbo
bool Encrypt( const uint8_t * message, int messageLength, uint8_t * encryptedMessage, int & encryptedMessageLength, const uint8_t * nonce, const uint8_t * key )
{
assert( KeyBytes == crypto_secretbox_KEYBYTES );
assert( MacBytes == crypto_secretbox_MACBYTES );

uint8_t actual_nonce[crypto_secretbox_NONCEBYTES];
memset( actual_nonce, 0, sizeof( actual_nonce ) );
Expand All @@ -70,6 +71,7 @@ namespace yojimbo
const uint8_t * nonce, const uint8_t * key )
{
assert( KeyBytes == crypto_secretbox_KEYBYTES );
assert( MacBytes == crypto_secretbox_MACBYTES );

uint8_t actual_nonce[crypto_secretbox_NONCEBYTES];
memset( actual_nonce, 0, sizeof( actual_nonce ) );
Expand All @@ -90,6 +92,7 @@ namespace yojimbo
const uint8_t * key )
{
assert( KeyBytes == crypto_aead_chacha20poly1305_KEYBYTES );
assert( MacBytes == crypto_aead_chacha20poly1305_ABYTES );

uint8_t actual_nonce[crypto_aead_chacha20poly1305_NPUBBYTES];
memset( actual_nonce, 0, sizeof( actual_nonce ) );
Expand All @@ -114,6 +117,7 @@ namespace yojimbo
const uint8_t * key )
{
assert( KeyBytes == crypto_aead_chacha20poly1305_KEYBYTES );
assert( MacBytes == crypto_aead_chacha20poly1305_ABYTES );

uint8_t actual_nonce[crypto_aead_chacha20poly1305_NPUBBYTES];
memset( actual_nonce, 0, sizeof( actual_nonce ) );
Expand Down

0 comments on commit 8950d59

Please sign in to comment.