poly1305.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Andrew Moon (dedicated to the public domain)
3  * Copyright (C) 2018 Freie Universität Berlin
4  * Copyright (C) 2018 Inria
5  *
6  * This file is subject to the terms and conditions of the GNU Lesser
7  * General Public License v2.1. See the file LICENSE in the top level
8  * directory for more details.
9  */
10 
28 #ifndef CRYPTO_POLY1305_H
29 #define CRYPTO_POLY1305_H
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 #include <stddef.h>
36 #include <stdint.h>
37 
41 #define POLY1305_BLOCK_SIZE 16
42 
46 typedef struct {
47  uint32_t r[4];
48  uint32_t pad[4];
49  uint32_t h[5];
50  uint32_t c[4];
51  size_t c_idx;
53 
60 void poly1305_init(poly1305_ctx_t *ctx, const uint8_t *key);
61 
69 void poly1305_update(poly1305_ctx_t *ctx, const uint8_t *data, size_t len);
70 
77 void poly1305_finish(poly1305_ctx_t *ctx, uint8_t *mac);
78 
87 void poly1305_auth(uint8_t *mac, const uint8_t *data, size_t len,
88  const uint8_t *key);
89 
90 #ifdef __cplusplus
91 }
92 #endif
93 #endif /* CRYPTO_POLY1305_H */
94 
poly1305_finish
void poly1305_finish(poly1305_ctx_t *ctx, uint8_t *mac)
Finish the poly1305 operation.
poly1305_ctx_t::c_idx
size_t c_idx
Chunk length
Definition: poly1305.h:51
poly1305_init
void poly1305_init(poly1305_ctx_t *ctx, const uint8_t *key)
Initialize a poly1305 context.
poly1305_update
void poly1305_update(poly1305_ctx_t *ctx, const uint8_t *data, size_t len)
Update the poly1305 context with a block of message.
poly1305_auth
void poly1305_auth(uint8_t *mac, const uint8_t *data, size_t len, const uint8_t *key)
Calculate a single poly1305 tag.
poly1305_ctx_t
Poly1305 context.
Definition: poly1305.h:46