iPXE
p384.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2025 Michael Brown <mbrown@fensystems.co.uk>.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * License, or any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  * 02110-1301, USA.
18  *
19  * You can also choose to distribute this program under the terms of
20  * the Unmodified Binary Distribution Licence (as given in the file
21  * COPYING.UBDL), provided that you have satisfied its requirements.
22  */
23 
24 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
25 
26 /** @file
27  *
28  * NIST P-384 elliptic curve
29  *
30  */
31 
32 #include <ipxe/p384.h>
33 
34 /** P-384 field prime */
35 static const uint8_t p384_prime[P384_LEN] = {
36  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
37  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
38  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff,
39  0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
40  0xff, 0xff, 0xff, 0xff
41 };
42 
43 /** P-384 constant "a" */
44 static const uint8_t p384_a[P384_LEN] = {
45  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
46  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
47  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff,
48  0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
49  0xff, 0xff, 0xff, 0xfc
50 };
51 
52 /** P-384 constant "b" */
53 static const uint8_t p384_b[P384_LEN] = {
54  0xb3, 0x31, 0x2f, 0xa7, 0xe2, 0x3e, 0xe7, 0xe4, 0x98, 0x8e, 0x05,
55  0x6b, 0xe3, 0xf8, 0x2d, 0x19, 0x18, 0x1d, 0x9c, 0x6e, 0xfe, 0x81,
56  0x41, 0x12, 0x03, 0x14, 0x08, 0x8f, 0x50, 0x13, 0x87, 0x5a, 0xc6,
57  0x56, 0x39, 0x8d, 0x8a, 0x2e, 0xd1, 0x9d, 0x2a, 0x85, 0xc8, 0xed,
58  0xd3, 0xec, 0x2a, 0xef
59 };
60 
61 /** P-384 base point */
62 static const uint8_t p384_base[ P384_LEN * 2 ] = {
63  0xaa, 0x87, 0xca, 0x22, 0xbe, 0x8b, 0x05, 0x37, 0x8e, 0xb1, 0xc7,
64  0x1e, 0xf3, 0x20, 0xad, 0x74, 0x6e, 0x1d, 0x3b, 0x62, 0x8b, 0xa7,
65  0x9b, 0x98, 0x59, 0xf7, 0x41, 0xe0, 0x82, 0x54, 0x2a, 0x38, 0x55,
66  0x02, 0xf2, 0x5d, 0xbf, 0x55, 0x29, 0x6c, 0x3a, 0x54, 0x5e, 0x38,
67  0x72, 0x76, 0x0a, 0xb7, 0x36, 0x17, 0xde, 0x4a, 0x96, 0x26, 0x2c,
68  0x6f, 0x5d, 0x9e, 0x98, 0xbf, 0x92, 0x92, 0xdc, 0x29, 0xf8, 0xf4,
69  0x1d, 0xbd, 0x28, 0x9a, 0x14, 0x7c, 0xe9, 0xda, 0x31, 0x13, 0xb5,
70  0xf0, 0xb8, 0xc0, 0x0a, 0x60, 0xb1, 0xce, 0x1d, 0x7e, 0x81, 0x9d,
71  0x7a, 0x43, 0x1d, 0x7c, 0x90, 0xea, 0x0e, 0x5f
72 };
73 
74 /** P-384 elliptic curve */
NIST P-384 elliptic curve.
struct elliptic_curve p384_curve
WEIERSTRASS_CURVE(p384, p384_curve, P384_LEN, p384_prime, p384_a, p384_b, p384_base)
P-384 elliptic curve.
static const uint8_t p384_prime[P384_LEN]
P-384 field prime.
Definition: p384.c:35
#define P384_LEN
P-384 value length.
Definition: p384.h:15
static const uint8_t p384_b[P384_LEN]
P-384 constant "b".
Definition: p384.c:53
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
static const uint8_t p384_base[P384_LEN *2]
P-384 base point.
Definition: p384.c:62
unsigned char uint8_t
Definition: stdint.h:10
static const uint8_t p384_a[P384_LEN]
P-384 constant "a".
Definition: p384.c:44