summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2014-01-16 16:45:59 +0100
committerNiels Möller <nisse@lysator.liu.se>2014-01-16 16:45:59 +0100
commitbfe4d48d291a3dc75a15fe217f5d1a012abbb1f8 (patch)
tree45951e72f6134f55839a9b1238b9a1002a1e7345
parent5a66bb56433be58f1b1b6a044e49c692327df455 (diff)
downloadnettle-bfe4d48d291a3dc75a15fe217f5d1a012abbb1f8.tar.gz
Reorder declarations.
-rw-r--r--poly1305.h27
1 files changed, 14 insertions, 13 deletions
diff --git a/poly1305.h b/poly1305.h
index 7afa387e..16fdfc03 100644
--- a/poly1305.h
+++ b/poly1305.h
@@ -6,6 +6,7 @@
/* nettle, low-level cryptographics library
*
* Copyright (C) 2013 Nikos Mavrogiannopoulos
+ * Copyright (C) 2013, 2014 Niels Möller
*
* The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@@ -26,13 +27,20 @@
#ifndef NETTLE_POLY1305_H_INCLUDED
#define NETTLE_POLY1305_H_INCLUDED
+#include "nettle-types.h"
+
#ifdef __cplusplus
extern "C" {
#endif
-/* Low level functions/macros for the poly1305 construction. */
+/* Name mangling */
+#define poly1305_set_key nettle_poly1305_set_key
+#define poly1305_set_nonce nettle_poly1305_set_nonce
+#define poly1305_update nettle_poly1305_update
+#define poly1305_block nettle_poly1305_block
+#define poly1305_digest nettle_poly1305_digest
-#include "nettle-types.h"
+/* Low level functions/macros for the poly1305 construction. */
struct poly1305_ctx {
/* Key, 128-bit value and some cached multiples. */
@@ -57,16 +65,6 @@ struct poly1305_ctx {
unsigned index;
};
-/* All-in-one context, with cipher, and state. Cipher must have a 128-bit block */
-#define POLY1305_CTX(type) \
-{ struct poly1305_ctx pctx; type cipher; }
-
-#define poly1305_set_key nettle_poly1305_set_key
-#define poly1305_set_nonce nettle_poly1305_set_nonce
-#define poly1305_update nettle_poly1305_update
-#define poly1305_block nettle_poly1305_block
-#define poly1305_digest nettle_poly1305_digest
-
void poly1305_set_key(struct poly1305_ctx *ctx, const uint8_t key[16]);
void poly1305_set_nonce (struct poly1305_ctx *ctx, const uint8_t * nonce);
void poly1305_block (struct poly1305_ctx *ctx, const uint8_t m[16]);
@@ -74,6 +72,10 @@ void poly1305_update (struct poly1305_ctx *ctx, size_t size, const uint8_t *data
void poly1305_digest (struct poly1305_ctx *ctx,
size_t length, uint8_t *digest, const uint8_t *s);
+/* All-in-one context, with cipher, and state. Cipher must have a 128-bit block */
+#define POLY1305_CTX(type) \
+{ struct poly1305_ctx pctx; type cipher; }
+
#define POLY1305_SET_KEY(ctx, set_key, key) \
do { \
poly1305_set_key(&(ctx)->pctx, (key+16)); \
@@ -94,7 +96,6 @@ void poly1305_digest (struct poly1305_ctx *ctx,
} while(0);
-
#ifdef __cplusplus
}
#endif