poly1305.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2016 Andrew Moon (dedicated to the public domain)
3  * SPDX-FileCopyrightText: 2018 Freie Universität Berlin
4  * SPDX-FileCopyrightText: 2018 Inria
5  * SPDX-License-Identifier: LGPL-2.1-only
6  */
7 
8 #pragma once
9 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #include <stddef.h>
33 #include <stdint.h>
34 
38 #define POLY1305_BLOCK_SIZE 16
39 
43 typedef struct {
44  uint32_t r[4];
45  uint32_t pad[4];
46  uint32_t h[5];
47  uint32_t c[4];
48  size_t c_idx;
50 
57 void poly1305_init(poly1305_ctx_t *ctx, const uint8_t *key);
58 
66 void poly1305_update(poly1305_ctx_t *ctx, const uint8_t *data, size_t len);
67 
74 void poly1305_finish(poly1305_ctx_t *ctx, uint8_t *mac);
75 
84 void poly1305_auth(uint8_t *mac, const uint8_t *data, size_t len,
85  const uint8_t *key);
86 
87 #ifdef __cplusplus
88 }
89 #endif
void poly1305_finish(poly1305_ctx_t *ctx, uint8_t *mac)
Finish the poly1305 operation.
void poly1305_init(poly1305_ctx_t *ctx, const uint8_t *key)
Initialize a poly1305 context.
void poly1305_update(poly1305_ctx_t *ctx, const uint8_t *data, size_t len)
Update the poly1305 context with a block of message.
void poly1305_auth(uint8_t *mac, const uint8_t *data, size_t len, const uint8_t *key)
Calculate a single poly1305 tag.
Poly1305 context.
Definition: poly1305.h:43
size_t c_idx
Chunk length
Definition: poly1305.h:48