]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/dev/if_wg/include/zinc/poly1305.h
service(8): use an environment more consistent with init(8)
[FreeBSD/FreeBSD.git] / sys / dev / if_wg / include / zinc / poly1305.h
1 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
2 /*
3  * Copyright (C) 2015-2019 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
4  */
5
6 #ifndef _ZINC_POLY1305_H
7 #define _ZINC_POLY1305_H
8
9
10 enum poly1305_lengths {
11         POLY1305_BLOCK_SIZE = 16,
12         POLY1305_KEY_SIZE = 32,
13         POLY1305_MAC_SIZE = 16
14 };
15
16 struct poly1305_ctx {
17         u8 opaque[24 * sizeof(u64)];
18         u32 nonce[4];
19         u8 data[POLY1305_BLOCK_SIZE];
20         size_t num;
21 } __aligned(8);
22
23 void poly1305_init(struct poly1305_ctx *ctx, const u8 key[POLY1305_KEY_SIZE]);
24 void poly1305_update(struct poly1305_ctx *ctx, const u8 *input, size_t len,
25                      simd_context_t *simd_context);
26 void poly1305_final(struct poly1305_ctx *ctx, u8 mac[POLY1305_MAC_SIZE],
27                     simd_context_t *simd_context);
28
29 #endif /* _ZINC_POLY1305_H */