tls_ffdhe.h
Go to the documentation of this file.
1 /**
2  * @file tls_ffdhe.h
3  * @brief FFDHE key exchange
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2025 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneSSL 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.5.2
29  **/
30 
31 #ifndef _TLS_FFDHE_H
32 #define _TLS_FFDHE_H
33 
34 //Dependencies
35 #include "tls.h"
36 #include "pkc/dh.h"
37 
38 //Maximum size of FFDHE prime modulus
39 #if (TLS_FFDHE4096_SUPPORT == ENABLED)
40  #define TLS_MAX_FFDHE_MODULUS_SIZE 512
41 #elif (TLS_FFDHE3072_SUPPORT == ENABLED)
42  #define TLS_MAX_FFDHE_MODULUS_SIZE 384
43 #else
44  #define TLS_MAX_FFDHE_MODULUS_SIZE 256
45 #endif
46 
47 //C++ guard
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 
53 /**
54  * @brief FFDHE parameters
55  **/
56 
57 typedef struct
58 {
59  const char_t *name; ///<Group name
60  const uint8_t p[TLS_MAX_FFDHE_MODULUS_SIZE]; ///<Prime modulus
61  size_t pLen; ///<Length of the prime modulus, in bytes
62  uint8_t g; ///<Generator
64 
65 
66 //TLS related functions
68  const TlsSupportedGroupList *groupList);
69 
71  uint16_t namedGroup);
72 
74  const TlsFfdheGroup *ffdheGroup);
75 
76 //C++ guard
77 #ifdef __cplusplus
78 }
79 #endif
80 
81 #endif
uint8_t p
Definition: ndp.h:300
error_t tlsLoadFfdheParameters(DhParameters *params, const TlsFfdheGroup *ffdheGroup)
Load FFDHE parameters.
Definition: tls_ffdhe.c:376
FFDHE parameters.
Definition: tls_ffdhe.h:58
Diffie-Hellman key exchange.
#define TlsContext
Definition: tls.h:36
error_t
Error codes.
Definition: error.h:43
const TlsFfdheGroup * tlsGetFfdheGroup(TlsContext *context, uint16_t namedGroup)
Get the FFDHE parameters that match the specified named group.
Definition: tls_ffdhe.c:314
char char_t
Definition: compiler_port.h:55
const char_t * name
Group name.
Definition: tls_ffdhe.h:59
#define TLS_MAX_FFDHE_MODULUS_SIZE
Definition: tls_ffdhe.h:40
TLS (Transport Layer Security)
error_t tlsSelectFfdheGroup(TlsContext *context, const TlsSupportedGroupList *groupList)
Select the named group to be used when performing FFDHE key exchange.
Definition: tls_ffdhe.c:174
uint8_t g
Generator.
Definition: tls_ffdhe.h:62
Diffie-Hellman parameters.
Definition: dh.h:49
TlsSupportedGroupList
Definition: tls.h:1707
size_t pLen
Length of the prime modulus, in bytes.
Definition: tls_ffdhe.h:61