| 1 |
// Copyright (c) 2014, Google Inc. |
| 2 |
// SPDX-License-Identifier: ISC |
| 3 |
|
| 4 |
#ifndef OPENSSL_HEADER_POLY1305_H |
| 5 |
#define OPENSSL_HEADER_POLY1305_H |
| 6 |
|
| 7 |
#include <openssl/base.h> |
| 8 |
|
| 9 |
#ifdef __cplusplus |
| 10 |
extern "C" { |
| 11 |
#endif |
| 12 |
|
| 13 |
|
| 14 |
typedef uint8_t poly1305_state[512]; |
| 15 |
|
| 16 |
// CRYPTO_poly1305_init sets up |state| so that it can be used to calculate an |
| 17 |
// authentication tag with the one-time key |key|. Note that |key| is a |
| 18 |
// one-time key and therefore there is no `reset' method because that would |
| 19 |
// enable several messages to be authenticated with the same key. |
| 20 |
OPENSSL_EXPORT void CRYPTO_poly1305_init(poly1305_state *state, |
| 21 |
const uint8_t key[32]); |
| 22 |
|
| 23 |
// CRYPTO_poly1305_update processes |in_len| bytes from |in|. It can be called |
| 24 |
// zero or more times after poly1305_init. |
| 25 |
OPENSSL_EXPORT void CRYPTO_poly1305_update(poly1305_state *state, |
| 26 |
const uint8_t *in, size_t in_len); |
| 27 |
|
| 28 |
// CRYPTO_poly1305_finish completes the poly1305 calculation and writes a 16 |
| 29 |
// byte authentication tag to |mac|. |
| 30 |
OPENSSL_EXPORT void CRYPTO_poly1305_finish(poly1305_state *state, |
| 31 |
uint8_t mac[16]); |
| 32 |
|
| 33 |
|
| 34 |
#if defined(__cplusplus) |
| 35 |
} // extern C |
| 36 |
#endif |
| 37 |
|
| 38 |
#endif // OPENSSL_HEADER_POLY1305_H |