From 2dbc1750eabb3781ec8181b5a73b54f6b8d64ef6 Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Sat, 15 Jun 2013 19:16:29 +0200 Subject: curve: curve25519_encode/curve25519_decode: simplify crypto transforms Simplify curve25519_encode() and curve25519_decode() transforms by making the code more clear and by introducing macro accessors to nonces. Signed-off-by: Daniel Borkmann --- crypto.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'crypto.h') diff --git a/crypto.h b/crypto.h index 5e3af32..dc14585 100644 --- a/crypto.h +++ b/crypto.h @@ -19,6 +19,10 @@ #define crypto_box_sec_key_size crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES #define NONCE_LENGTH (sizeof(struct taia)) +#define NONCE_RND_LENGTH (crypto_box_boxzerobytes - NONCE_LENGTH) +#define NONCE_ALL_LENGTH (crypto_box_boxzerobytes + NONCE_LENGTH) #define NONCE_OFFSET (crypto_box_noncebytes - NONCE_LENGTH) +#define NONCE_EDN_OFFSET(x) ((x) + NONCE_OFFSET) +#define NONCE_PKT_OFFSET(x) ((x) + NONCE_RND_LENGTH) #endif /* CRYPTO_H */ -- cgit v1.2.3-54-g00ecf