From: Daniel Borkmann Date: Tue, 29 Jan 2013 17:15:25 +0000 (+0100) Subject: curve: use sizeof instead of hard coded value X-Git-Url: https://repo.or.cz/w/netsniff-ng.git/commitdiff_plain/dee3bca665d8edfe4972beaee2d065961e6e46e0 curve: use sizeof instead of hard coded value Signed-off-by: Daniel Borkmann --- diff --git a/curve.c b/curve.c index 5d033c9e..6d04266c 100644 --- a/curve.c +++ b/curve.c @@ -33,7 +33,7 @@ #define crypto_box_afternm crypto_box_curve25519xsalsa20poly1305_afternm #define crypto_box_open_afternm crypto_box_curve25519xsalsa20poly1305_open_afternm -#define NONCE_LENGTH 16 /* size of taia */ +#define NONCE_LENGTH (sizeof(struct taia)) #define NONCE_OFFSET (crypto_box_curve25519xsalsa20poly1305_NONCEBYTES - NONCE_LENGTH) void curve25519_selftest(void) @@ -102,6 +102,8 @@ void curve25519_selftest(void) 0xe3, 0x55, 0xa5 }; + bug_on(NONCE_LENGTH != 16); + crypto_box_curve25519xsalsa20poly1305(c, m, 163, nonce, bobpk, alicesk); for (i = 16; i < 163; ++i) {