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 FILE_SECBOOT ( PERMITTED );
26 
27 /** @file
28  *
29  * NIST P-384 elliptic curve
30  *
31  */
32 
33 #include <ipxe/p384.h>
34 
35 /** P-384 field prime */
36 static const uint8_t p384_prime[P384_LEN] = {
37  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
38  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
39  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff,
40  0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
41  0xff, 0xff, 0xff, 0xff
42 };
43 
44 /** P-384 constant "a" */
45 static const uint8_t p384_a[P384_LEN] = {
46  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
47  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
48  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff,
49  0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
50  0xff, 0xff, 0xff, 0xfc
51 };
52 
53 /** P-384 constant "b" */
54 static const uint8_t p384_b[P384_LEN] = {
55  0xb3, 0x31, 0x2f, 0xa7, 0xe2, 0x3e, 0xe7, 0xe4, 0x98, 0x8e, 0x05,
56  0x6b, 0xe3, 0xf8, 0x2d, 0x19, 0x18, 0x1d, 0x9c, 0x6e, 0xfe, 0x81,
57  0x41, 0x12, 0x03, 0x14, 0x08, 0x8f, 0x50, 0x13, 0x87, 0x5a, 0xc6,
58  0x56, 0x39, 0x8d, 0x8a, 0x2e, 0xd1, 0x9d, 0x2a, 0x85, 0xc8, 0xed,
59  0xd3, 0xec, 0x2a, 0xef
60 };
61 
62 /** P-384 base point */
63 static const uint8_t p384_base[ P384_LEN * 2 ] = {
64  0xaa, 0x87, 0xca, 0x22, 0xbe, 0x8b, 0x05, 0x37, 0x8e, 0xb1, 0xc7,
65  0x1e, 0xf3, 0x20, 0xad, 0x74, 0x6e, 0x1d, 0x3b, 0x62, 0x8b, 0xa7,
66  0x9b, 0x98, 0x59, 0xf7, 0x41, 0xe0, 0x82, 0x54, 0x2a, 0x38, 0x55,
67  0x02, 0xf2, 0x5d, 0xbf, 0x55, 0x29, 0x6c, 0x3a, 0x54, 0x5e, 0x38,
68  0x72, 0x76, 0x0a, 0xb7, 0x36, 0x17, 0xde, 0x4a, 0x96, 0x26, 0x2c,
69  0x6f, 0x5d, 0x9e, 0x98, 0xbf, 0x92, 0x92, 0xdc, 0x29, 0xf8, 0xf4,
70  0x1d, 0xbd, 0x28, 0x9a, 0x14, 0x7c, 0xe9, 0xda, 0x31, 0x13, 0xb5,
71  0xf0, 0xb8, 0xc0, 0x0a, 0x60, 0xb1, 0xce, 0x1d, 0x7e, 0x81, 0x9d,
72  0x7a, 0x43, 0x1d, 0x7c, 0x90, 0xea, 0x0e, 0x5f
73 };
74 
75 /** P-384 group order */
76 static const uint8_t p384_order[P384_LEN] = {
77  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
78  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
79  0xff, 0xff, 0xc7, 0x63, 0x4d, 0x81, 0xf4, 0x37, 0x2d, 0xdf, 0x58,
80  0x1a, 0x0d, 0xb2, 0x48, 0xb0, 0xa7, 0x7a, 0xec, 0xec, 0x19, 0x6a,
81  0xcc, 0xc5, 0x29, 0x73
82 };
83 
84 /** P-384 elliptic curve */
NIST P-384 elliptic curve.
FILE_SECBOOT(PERMITTED)
struct elliptic_curve p384_curve
static const uint8_t p384_prime[P384_LEN]
P-384 field prime.
Definition: p384.c:36
#define P384_LEN
P-384 value length.
Definition: p384.h:16
static const uint8_t p384_b[P384_LEN]
P-384 constant "b".
Definition: p384.c:54
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
static const uint8_t p384_base[P384_LEN *2]
P-384 base point.
Definition: p384.c:63
unsigned char uint8_t
Definition: stdint.h:10
static const uint8_t p384_a[P384_LEN]
P-384 constant "a".
Definition: p384.c:45
static const uint8_t p384_order[P384_LEN]
P-384 group order.
Definition: p384.c:76
WEIERSTRASS_CURVE(p384, p384_curve, P384_LEN, p384_prime, p384_a, p384_b, p384_base, p384_order)
P-384 elliptic curve.