Mbed TLS v3.6.0
Loading...
Searching...
No Matches
poly1305.h
Go to the documentation of this file.
1
15/*
16 * Copyright The Mbed TLS Contributors
17 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
18 */
19
20#ifndef MBEDTLS_POLY1305_H
21#define MBEDTLS_POLY1305_H
23
24#include "mbedtls/build_info.h"
25
26#include <stdint.h>
27#include <stddef.h>
28
30#define MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA -0x0057
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36#if !defined(MBEDTLS_POLY1305_ALT)
37
39 uint32_t MBEDTLS_PRIVATE(r)[4];
40 uint32_t MBEDTLS_PRIVATE(s)[4];
41 uint32_t MBEDTLS_PRIVATE(acc)[5];
42 uint8_t MBEDTLS_PRIVATE(queue)[16];
43 size_t MBEDTLS_PRIVATE(queue_len);
44}
46
47#else /* MBEDTLS_POLY1305_ALT */
48#include "poly1305_alt.h"
49#endif /* MBEDTLS_POLY1305_ALT */
50
67
77
92 const unsigned char key[32]);
93
113 const unsigned char *input,
114 size_t ilen);
115
129 unsigned char mac[16]);
130
149int mbedtls_poly1305_mac(const unsigned char key[32],
150 const unsigned char *input,
151 size_t ilen,
152 unsigned char mac[16]);
153
154#if defined(MBEDTLS_SELF_TEST)
162#endif /* MBEDTLS_SELF_TEST */
163
164#ifdef __cplusplus
165}
166#endif
167
168#endif /* MBEDTLS_POLY1305_H */
Build-time configuration info.
struct mbedtls_poly1305_context mbedtls_poly1305_context
int mbedtls_poly1305_self_test(int verbose)
The Poly1305 checkup routine.
int mbedtls_poly1305_update(mbedtls_poly1305_context *ctx, const unsigned char *input, size_t ilen)
This functions feeds an input buffer into an ongoing Poly1305 computation.
int mbedtls_poly1305_mac(const unsigned char key[32], const unsigned char *input, size_t ilen, unsigned char mac[16])
This function calculates the Poly1305 MAC of the input buffer with the provided key.
int mbedtls_poly1305_finish(mbedtls_poly1305_context *ctx, unsigned char mac[16])
This function generates the Poly1305 Message Authentication Code (MAC).
void mbedtls_poly1305_init(mbedtls_poly1305_context *ctx)
This function initializes the specified Poly1305 context.
int mbedtls_poly1305_starts(mbedtls_poly1305_context *ctx, const unsigned char key[32])
This function sets the one-time authentication key.
void mbedtls_poly1305_free(mbedtls_poly1305_context *ctx)
This function releases and clears the specified Poly1305 context.
Macro wrapper for struct's members.
#define MBEDTLS_PRIVATE(member)