Loading...
Searching...
No Matches
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
32extern "C" {
33#endif
34
35#include <stddef.h>
36#include <stdint.h>
37
41#define POLY1305_BLOCK_SIZE 16
42
46typedef 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
60void poly1305_init(poly1305_ctx_t *ctx, const uint8_t *key);
61
69void poly1305_update(poly1305_ctx_t *ctx, const uint8_t *data, size_t len);
70
77void poly1305_finish(poly1305_ctx_t *ctx, uint8_t *mac);
78
87void 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 */
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:46
size_t c_idx
Chunk length
Definition poly1305.h:51