Mbed TLS v3.5.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
35
36#include "mbedtls/build_info.h"
37
38#include <stdint.h>
39#include <stddef.h>
40
42#define MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA -0x0057
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48#if !defined(MBEDTLS_POLY1305_ALT)
49
51 uint32_t MBEDTLS_PRIVATE(r)[4];
52 uint32_t MBEDTLS_PRIVATE(s)[4];
53 uint32_t MBEDTLS_PRIVATE(acc)[5];
54 uint8_t MBEDTLS_PRIVATE(queue)[16];
55 size_t MBEDTLS_PRIVATE(queue_len);
56}
58
59#else /* MBEDTLS_POLY1305_ALT */
60#include "poly1305_alt.h"
61#endif /* MBEDTLS_POLY1305_ALT */
62
79
89
104 const unsigned char key[32]);
105
125 const unsigned char *input,
126 size_t ilen);
127
141 unsigned char mac[16]);
142
161int mbedtls_poly1305_mac(const unsigned char key[32],
162 const unsigned char *input,
163 size_t ilen,
164 unsigned char mac[16]);
165
166#if defined(MBEDTLS_SELF_TEST)
174#endif /* MBEDTLS_SELF_TEST */
175
176#ifdef __cplusplus
177}
178#endif
179
180#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)