mbed TLS v2.28.1
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
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
45#define MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA -0x0057
46
47/* MBEDTLS_ERR_POLY1305_FEATURE_UNAVAILABLE is deprecated and should not be
48 * used. */
50#define MBEDTLS_ERR_POLY1305_FEATURE_UNAVAILABLE -0x0059
51
52/* MBEDTLS_ERR_POLY1305_HW_ACCEL_FAILED is deprecated and should not be used.
53 */
55#define MBEDTLS_ERR_POLY1305_HW_ACCEL_FAILED -0x005B
56
57#ifdef __cplusplus
58extern "C" {
59#endif
60
61#if !defined(MBEDTLS_POLY1305_ALT)
62
64{
65 uint32_t r[4];
66 uint32_t s[4];
67 uint32_t acc[5];
68 uint8_t queue[16];
69 size_t queue_len;
70}
72
73#else /* MBEDTLS_POLY1305_ALT */
74#include "poly1305_alt.h"
75#endif /* MBEDTLS_POLY1305_ALT */
76
93
103
118 const unsigned char key[32] );
119
139 const unsigned char *input,
140 size_t ilen );
141
155 unsigned char mac[16] );
156
175int mbedtls_poly1305_mac( const unsigned char key[32],
176 const unsigned char *input,
177 size_t ilen,
178 unsigned char mac[16] );
179
180#if defined(MBEDTLS_SELF_TEST)
187int mbedtls_poly1305_self_test( int verbose );
188#endif /* MBEDTLS_SELF_TEST */
189
190#ifdef __cplusplus
191}
192#endif
193
194#endif /* MBEDTLS_POLY1305_H */
Configuration options (set of defines)
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.