summaryrefslogtreecommitdiff
path: root/crypto.h
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-06-15 19:16:29 +0200
committerDaniel Borkmann <dborkman@redhat.com>2013-06-15 19:16:29 +0200
commit2dbc1750eabb3781ec8181b5a73b54f6b8d64ef6 (patch)
treead3480617fb0fb43289ae599f895d6a3034323bb /crypto.h
parent5bc9299f0d1b0baf220b75da86520606e87c4b3a (diff)
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 <dborkman@redhat.com>
Diffstat (limited to 'crypto.h')
-rw-r--r--crypto.h4
1 files changed, 4 insertions, 0 deletions
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 */