curve448.h
Go to the documentation of this file.
1 /**
2  * @file curve448.h
3  * @brief Curve448 elliptic curve
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2026 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.6.6
29  **/
30 
31 #ifndef _CURVE448_H
32 #define _CURVE448_H
33 
34 //Dependencies
35 #include "core/crypto.h"
36 
37 //Length of the elliptic curve
38 #define CURVE448_BIT_LEN 448
39 #define CURVE448_BYTE_LEN 56
40 #define CURVE448_WORD_LEN 14
41 
42 //A24 constant
43 #define CURVE448_A24 39082
44 
45 //C++ guard
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
50 //Curve448 related functions
51 void curve448SetInt(int32_t *a, int32_t b);
52 
53 void curve448Add(int32_t *r, const int32_t *a, const int32_t *b);
54 void curve448AddInt(int32_t *r, const int32_t *a, int32_t b);
55 
56 void curve448Sub(int32_t *r, const int32_t *a, const int32_t *b);
57 void curve448SubInt(int32_t *r, const int32_t *a, int32_t b);
58 
59 void curve448Mul(int32_t *r, const int32_t *a, const int32_t *b);
60 void curve448MulInt(int32_t *r, const int32_t *a, int32_t b);
61 void curve448Sqr(int32_t *r, const int32_t *a);
62 void curve448Pwr2(int32_t *r, const int32_t *a, uint_t n);
63 
64 void curve448Inv(int32_t *r, const int32_t *a);
65 
66 uint32_t curve448Sqrt(int32_t *r, const int32_t *a, const int32_t *b);
67 
68 void curve448Canonicalize(int32_t *r, const int32_t *a);
69 
70 void curve448Copy(int32_t *a, const int32_t *b);
71 void curve448Swap(int32_t *a, int32_t *b, uint32_t c);
72 
73 void curve448Select(int32_t *r, const int32_t *a, const int32_t *b,
74  uint32_t c);
75 
76 uint32_t curve448Comp(const int32_t *a, const int32_t *b);
77 
78 void curve448Import(int32_t *a, const uint8_t *data);
79 void curve448Export(int32_t *a, uint8_t *data);
80 
81 //C++ guard
82 #ifdef __cplusplus
83 }
84 #endif
85 
86 #endif
void curve448AddInt(int32_t *r, const int32_t *a, int32_t b)
Modular addition.
Definition: curve448.c:139
void curve448Copy(int32_t *a, const int32_t *b)
Copy an integer.
Definition: curve448.c:720
uint8_t b
Definition: nbns_common.h:122
void curve448MulInt(int32_t *r, const int32_t *a, int32_t b)
Modular multiplication.
Definition: curve448.c:479
uint8_t a
Definition: ndp.h:411
void curve448Pwr2(int32_t *r, const int32_t *a, uint_t n)
Raise an integer to power 2^n.
Definition: curve448.c:518
void curve448Sqr(int32_t *r, const int32_t *a)
Modular squaring.
Definition: curve448.c:504
uint8_t data[]
Definition: ethernet.h:224
void curve448Sub(int32_t *r, const int32_t *a, const int32_t *b)
Modular subtraction.
Definition: curve448.c:165
void curve448Add(int32_t *r, const int32_t *a, const int32_t *b)
Modular addition.
Definition: curve448.c:72
uint8_t r
Definition: ndp.h:346
void curve448Swap(int32_t *a, int32_t *b, uint32_t c)
Conditional swap.
Definition: curve448.c:739
General definitions for cryptographic algorithms.
void curve448SetInt(int32_t *a, int32_t b)
Set integer value.
Definition: curve448.c:50
void curve448SubInt(int32_t *r, const int32_t *a, int32_t b)
Modular subtraction.
Definition: curve448.c:232
uint32_t curve448Sqrt(int32_t *r, const int32_t *a, const int32_t *b)
Compute the square root of (A / B) modulo p.
Definition: curve448.c:588
void curve448Select(int32_t *r, const int32_t *a, const int32_t *b, uint32_t c)
Select an integer.
Definition: curve448.c:767
void curve448Inv(int32_t *r, const int32_t *a)
Modular multiplicative inverse.
Definition: curve448.c:539
uint8_t n
void curve448Import(int32_t *a, const uint8_t *data)
Import an octet string.
Definition: curve448.c:818
void curve448Mul(int32_t *r, const int32_t *a, const int32_t *b)
Modular multiplication.
Definition: curve448.c:373
uint32_t curve448Comp(const int32_t *a, const int32_t *b)
Compare integers.
Definition: curve448.c:792
unsigned int uint_t
Definition: compiler_port.h:57
uint8_t c
Definition: ndp.h:514
void curve448Canonicalize(int32_t *r, const int32_t *a)
Reduce non-canonical value.
Definition: curve448.c:669
void curve448Export(int32_t *a, uint8_t *data)
Export an octet string.
Definition: curve448.c:846