mbed TLS v2.26.0
poly1305.h
Go to the documentation of this file.
1
15/*
16 * Copyright The Mbed TLS Contributors
17 * SPDX-License-Identifier: Apache-2.0
18 *
19 * Licensed under the Apache License, Version 2.0 (the "License"); you may
20 * not use this file except in compliance with the License.
21 * You may obtain a copy of the License at
22 *
23 * http://www.apache.org/licenses/LICENSE-2.0
24 *
25 * Unless required by applicable law or agreed to in writing, software
26 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
27 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28 * See the License for the specific language governing permissions and
29 * limitations under the License.
30 */
31
32#ifndef MBEDTLS_POLY1305_H
33#define MBEDTLS_POLY1305_H
34
35#if !defined(MBEDTLS_CONFIG_FILE)
36#include "mbedtls/config.h"
37#else
38#include MBEDTLS_CONFIG_FILE
39#endif
40
41#include <stdint.h>
42#include <stddef.h>
43
44#define MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA -0x0057
46/* MBEDTLS_ERR_POLY1305_FEATURE_UNAVAILABLE is deprecated and should not be
47 * used. */
48#define MBEDTLS_ERR_POLY1305_FEATURE_UNAVAILABLE -0x0059
50/* MBEDTLS_ERR_POLY1305_HW_ACCEL_FAILED is deprecated and should not be used.
51 */
52#define MBEDTLS_ERR_POLY1305_HW_ACCEL_FAILED -0x005B
54#ifdef __cplusplus
55extern "C" {
56#endif
57
58#if !defined(MBEDTLS_POLY1305_ALT)
59
61{
62 uint32_t r[4];
63 uint32_t s[4];
64 uint32_t acc[5];
65 uint8_t queue[16];
66 size_t queue_len;
67}
69
70#else /* MBEDTLS_POLY1305_ALT */
71#include "poly1305_alt.h"
72#endif /* MBEDTLS_POLY1305_ALT */
73
90
100
115 const unsigned char key[32] );
116
136 const unsigned char *input,
137 size_t ilen );
138
152 unsigned char mac[16] );
153
172int mbedtls_poly1305_mac( const unsigned char key[32],
173 const unsigned char *input,
174 size_t ilen,
175 unsigned char mac[16] );
176
177#if defined(MBEDTLS_SELF_TEST)
184int mbedtls_poly1305_self_test( int verbose );
185#endif /* MBEDTLS_SELF_TEST */
186
187#ifdef __cplusplus
188}
189#endif
190
191#endif /* MBEDTLS_POLY1305_H */
Configuration options (set of defines)
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.