commit a86d915a5ecf1dbf93e58b7461a7e6fc97d0643f
parent 9fcd9f91190ab89a777da608d52215631ba4da91
Author: sin <sin@2f30.org>
Date: Fri, 3 May 2019 12:37:07 +0100
Check against KEYSIZE for consistency
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/key.c b/key.c
@@ -13,7 +13,7 @@ int
keygen(unsigned char *key, size_t n)
{
assert(KEYSIZE == crypto_aead_xchacha20poly1305_ietf_KEYBYTES);
- if (n != crypto_aead_xchacha20poly1305_ietf_KEYBYTES)
+ if (n != KEYSIZE)
return -1;
if (sodium_init() < 0)
return -1;
@@ -25,7 +25,7 @@ int
savekey(int fd, unsigned char *key, size_t n)
{
assert(KEYSIZE == crypto_aead_xchacha20poly1305_ietf_KEYBYTES);
- if (n != crypto_aead_xchacha20poly1305_ietf_KEYBYTES)
+ if (n != KEYSIZE)
return -1;
if (xwrite(fd, key, n) != n)
return -1;
@@ -36,7 +36,7 @@ int
loadkey(int fd, unsigned char *key, size_t n)
{
assert(KEYSIZE == crypto_aead_xchacha20poly1305_ietf_KEYBYTES);
- if (n != crypto_aead_xchacha20poly1305_ietf_KEYBYTES)
+ if (n != KEYSIZE)
return -1;
if (xread(fd, key, n) != n)
return -1;