diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-05-29 16:06:57 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-05-31 01:24:51 +0200 |
commit | 101b71c192047d5966b3c59dba088957ca51e588 (patch) | |
tree | 1cb72ed6ff1916eb71d038b6b426eef1962f7350 /src/crypto/poly1305.h | |
parent | 520af047f5b84c92202e3f42f49281f37034d1c0 (diff) |
chacha20poly1305: split up into separate files
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/crypto/poly1305.h')
-rw-r--r-- | src/crypto/poly1305.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/crypto/poly1305.h b/src/crypto/poly1305.h new file mode 100644 index 0000000..21833be --- /dev/null +++ b/src/crypto/poly1305.h @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0 + * + * Copyright (C) 2015-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved. + */ + +#ifndef _WG_POLY1305_H +#define _WG_POLY1305_H + +#include <linux/types.h> + +enum poly1305_lengths { + POLY1305_BLOCK_SIZE = 16, + POLY1305_KEY_SIZE = 32, + POLY1305_MAC_SIZE = 16 +}; + +struct poly1305_ctx { + u8 opaque[24 * sizeof(u64)]; + u32 nonce[4]; + u8 data[POLY1305_BLOCK_SIZE]; + size_t num; +} __aligned(8); + +void poly1305_fpu_init(void); + +void poly1305_init(struct poly1305_ctx *ctx, const u8 key[POLY1305_KEY_SIZE], bool have_simd); +void poly1305_update(struct poly1305_ctx *ctx, const u8 *inp, size_t len, bool have_simd); +void poly1305_finish(struct poly1305_ctx *ctx, u8 mac[POLY1305_MAC_SIZE], bool have_simd); + +#ifdef DEBUG +bool poly1305_selftest(void); +#endif + +#endif /* _WG_POLY1305_H */ |