poly1305.h
Go to the documentation of this file.
1 /**
2  * @file poly1305.h
3  * @brief Poly1305 message-authentication code
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneCRYPTO Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.0
29  **/
30 
31 #ifndef _POLY1305_H
32 #define _POLY1305_H
33 
34 //Dependencies
35 #include "core/crypto.h"
36 
37 //C++ guard
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 
43 /**
44  * @brief Poly1305 context
45  **/
46 
47 typedef struct
48 {
49  uint32_t r[4];
50  uint32_t s[4];
51  uint64_t a[8];
52  uint8_t buffer[17];
53  size_t size;
55 
56 
57 //Poly1305 related functions
58 void poly1305Init(Poly1305Context *context, const uint8_t *key);
59 void poly1305Update(Poly1305Context *context, const void *data, size_t length);
60 void poly1305Final(Poly1305Context *context, uint8_t *tag);
61 
63 
64 //C++ guard
65 #ifdef __cplusplus
66 }
67 #endif
68 
69 #endif
General definitions for cryptographic algorithms.
uint8_t data[]
Definition: ethernet.h:222
uint8_t r
Definition: ndp.h:346
uint8_t s
Definition: ndp.h:345
uint8_t a
Definition: ndp.h:411
void poly1305Init(Poly1305Context *context, const uint8_t *key)
Initialize Poly1305 message-authentication code computation.
Definition: poly1305.c:49
void poly1305ProcessBlock(Poly1305Context *context)
Process message in 16-byte blocks.
Definition: poly1305.c:213
void poly1305Update(Poly1305Context *context, const void *data, size_t length)
Update Poly1305 message-authentication code computation.
Definition: poly1305.c:89
void poly1305Final(Poly1305Context *context, uint8_t *tag)
Finalize Poly1305 message-authentication code computation.
Definition: poly1305.c:127
Poly1305 context.
Definition: poly1305.h:48
size_t size
Definition: poly1305.h:53
uint8_t length
Definition: tcp.h:368