Botan 3.6.1
Crypto and TLS for C&
Botan::TLS::Group_Params Class Referencefinal

#include <tls_algos.h>

Public Member Functions

constexpr Group_Params_Code code () const
 
constexpr Group_Params ()
 
constexpr Group_Params (Group_Params_Code code)
 
constexpr Group_Params (uint16_t code)
 
constexpr bool is_dh_named_group () const
 
constexpr bool is_ecdh_named_curve () const
 
constexpr bool is_in_ffdhe_range () const
 
constexpr bool is_kem () const
 
constexpr bool is_post_quantum () const
 
constexpr bool is_pqc_hybrid () const
 
constexpr bool is_pure_ecc_group () const
 
constexpr bool is_pure_frodokem () const
 
constexpr bool is_pure_kyber () const
 
constexpr bool is_x25519 () const
 
constexpr bool is_x448 () const
 
constexpr bool operator< (Group_Params other) const
 
constexpr bool operator== (Group_Params other) const
 
constexpr bool operator== (Group_Params_Code code) const
 
std::optional< std::string > to_string () const
 
constexpr uint16_t wire_code () const
 

Static Public Member Functions

static std::optional< Group_Paramsfrom_string (std::string_view group_name)
 

Detailed Description

Definition at line 159 of file tls_algos.h.

Constructor & Destructor Documentation

◆ Group_Params() [1/3]

Botan::TLS::Group_Params::Group_Params ( )
inlineconstexpr

Definition at line 163 of file tls_algos.h.

References Botan::NONE.

◆ Group_Params() [2/3]

Botan::TLS::Group_Params::Group_Params ( Group_Params_Code code)
inlineconstexpr

Definition at line 165 of file tls_algos.h.

165: m_code(code) {}
constexpr Group_Params_Code code() const
Definition tls_algos.h:180

◆ Group_Params() [3/3]

Botan::TLS::Group_Params::Group_Params ( uint16_t code)
inlineconstexpr

Definition at line 167 of file tls_algos.h.

167: m_code(static_cast<Group_Params_Code>(code)) {}

Member Function Documentation

◆ code()

Group_Params_Code Botan::TLS::Group_Params::code ( ) const
inlineconstexpr

Definition at line 180 of file tls_algos.h.

180{ return m_code; }

◆ from_string()

std::optional< Group_Params > Botan::TLS::Group_Params::from_string ( std::string_view group_name)
static
Returns
std::nullopt if an unknown name

Definition at line 137 of file tls_algos.cpp.

137 {
138 if(group_name == "secp256r1") {
139 return Group_Params::SECP256R1;
140 }
141 if(group_name == "secp384r1") {
142 return Group_Params::SECP384R1;
143 }
144 if(group_name == "secp521r1") {
145 return Group_Params::SECP521R1;
146 }
147 if(group_name == "brainpool256r1") {
148 return Group_Params::BRAINPOOL256R1;
149 }
150 if(group_name == "brainpool384r1") {
151 return Group_Params::BRAINPOOL384R1;
152 }
153 if(group_name == "brainpool512r1") {
154 return Group_Params::BRAINPOOL512R1;
155 }
156 if(group_name == "x25519") {
157 return Group_Params::X25519;
158 }
159 if(group_name == "x448") {
160 return Group_Params::X448;
161 }
162
163 if(group_name == "ffdhe/ietf/2048") {
164 return Group_Params::FFDHE_2048;
165 }
166 if(group_name == "ffdhe/ietf/3072") {
167 return Group_Params::FFDHE_3072;
168 }
169 if(group_name == "ffdhe/ietf/4096") {
170 return Group_Params::FFDHE_4096;
171 }
172 if(group_name == "ffdhe/ietf/6144") {
173 return Group_Params::FFDHE_6144;
174 }
175 if(group_name == "ffdhe/ietf/8192") {
176 return Group_Params::FFDHE_8192;
177 }
178
179 if(group_name == "Kyber-512-r3") {
180 return Group_Params::KYBER_512_R3_OQS;
181 }
182 if(group_name == "Kyber-768-r3") {
183 return Group_Params::KYBER_768_R3_OQS;
184 }
185 if(group_name == "Kyber-1024-r3") {
186 return Group_Params::KYBER_1024_R3_OQS;
187 }
188
189 if(group_name == "eFrodoKEM-640-SHAKE") {
190 return Group_Params::eFRODOKEM_640_SHAKE_OQS;
191 }
192 if(group_name == "eFrodoKEM-976-SHAKE") {
193 return Group_Params::eFRODOKEM_976_SHAKE_OQS;
194 }
195 if(group_name == "eFrodoKEM-1344-SHAKE") {
196 return Group_Params::eFRODOKEM_1344_SHAKE_OQS;
197 }
198 if(group_name == "eFrodoKEM-640-AES") {
199 return Group_Params::eFRODOKEM_640_AES_OQS;
200 }
201 if(group_name == "eFrodoKEM-976-AES") {
202 return Group_Params::eFRODOKEM_976_AES_OQS;
203 }
204 if(group_name == "eFrodoKEM-1344-AES") {
205 return Group_Params::eFRODOKEM_1344_AES_OQS;
206 }
207
208 if(group_name == "x25519/Kyber-512-r3/cloudflare") {
209 return Group_Params::HYBRID_X25519_KYBER_512_R3_CLOUDFLARE;
210 }
211 if(group_name == "x25519/Kyber-512-r3") {
212 return Group_Params::HYBRID_X25519_KYBER_512_R3_OQS;
213 }
214 if(group_name == "x25519/Kyber-768-r3") {
215 return Group_Params::HYBRID_X25519_KYBER_768_R3_OQS;
216 }
217
218 if(group_name == "x25519/ML-KEM-768") {
219 return Group_Params::HYBRID_X25519_ML_KEM_768;
220 }
221 if(group_name == "secp256r1/ML-KEM-768") {
222 return Group_Params::HYBRID_SECP256R1_ML_KEM_768;
223 }
224
225 if(group_name == "x448/Kyber-768-r3") {
226 return Group_Params::HYBRID_X448_KYBER_768_R3_OQS;
227 }
228 if(group_name == "x25519/eFrodoKEM-640-SHAKE") {
229 return Group_Params::HYBRID_X25519_eFRODOKEM_640_SHAKE_OQS;
230 }
231 if(group_name == "x25519/eFrodoKEM-640-AES") {
232 return Group_Params::HYBRID_X25519_eFRODOKEM_640_AES_OQS;
233 }
234 if(group_name == "x448/eFrodoKEM-976-SHAKE") {
235 return Group_Params::HYBRID_X448_eFRODOKEM_976_SHAKE_OQS;
236 }
237 if(group_name == "x448/eFrodoKEM-976-AES") {
238 return Group_Params::HYBRID_X448_eFRODOKEM_976_AES_OQS;
239 }
240
241 if(group_name == "secp256r1/Kyber-512-r3") {
242 return Group_Params::HYBRID_SECP256R1_KYBER_512_R3_OQS;
243 }
244 if(group_name == "secp256r1/Kyber-768-r3") {
245 return Group_Params::HYBRID_SECP256R1_KYBER_768_R3_OQS;
246 }
247 if(group_name == "secp256r1/eFrodoKEM-640-SHAKE") {
248 return Group_Params::HYBRID_SECP256R1_eFRODOKEM_640_SHAKE_OQS;
249 }
250 if(group_name == "secp256r1/eFrodoKEM-640-AES") {
251 return Group_Params::HYBRID_SECP256R1_eFRODOKEM_640_AES_OQS;
252 }
253
254 if(group_name == "secp384r1/Kyber-768-r3") {
255 return Group_Params::HYBRID_SECP384R1_KYBER_768_R3_OQS;
256 }
257 if(group_name == "secp384r1/eFrodoKEM-976-SHAKE") {
258 return Group_Params::HYBRID_SECP384R1_eFRODOKEM_976_SHAKE_OQS;
259 }
260 if(group_name == "secp384r1/eFrodoKEM-976-AES") {
261 return Group_Params::HYBRID_SECP384R1_eFRODOKEM_976_AES_OQS;
262 }
263
264 if(group_name == "secp521r1/Kyber-1024-r3") {
265 return Group_Params::HYBRID_SECP521R1_KYBER_1024_R3_OQS;
266 }
267 if(group_name == "secp521r1/eFrodoKEM-1344-SHAKE") {
268 return Group_Params::HYBRID_SECP521R1_eFRODOKEM_1344_SHAKE_OQS;
269 }
270 if(group_name == "secp521r1/eFrodoKEM-1344-AES") {
271 return Group_Params::HYBRID_SECP521R1_eFRODOKEM_1344_AES_OQS;
272 }
273
274 return std::nullopt;
275}

Referenced by Botan::TLS::Text_Policy::read_group_list().

◆ is_dh_named_group()

bool Botan::TLS::Group_Params::is_dh_named_group ( ) const
inlineconstexpr

◆ is_ecdh_named_curve()

◆ is_in_ffdhe_range()

bool Botan::TLS::Group_Params::is_in_ffdhe_range ( ) const
inlineconstexpr

Definition at line 194 of file tls_algos.h.

194 {
195 // See RFC 7919
196 return wire_code() >= 256 && wire_code() < 512;
197 }
constexpr uint16_t wire_code() const
Definition tls_algos.h:182

◆ is_kem()

bool Botan::TLS::Group_Params::is_kem ( ) const
inlineconstexpr

Definition at line 263 of file tls_algos.h.

263 {
266
268
270 }
constexpr bool is_pqc_hybrid() const
Definition tls_algos.h:235
constexpr bool is_pure_frodokem() const
Definition tls_algos.h:215
constexpr bool is_pure_kyber() const
Definition tls_algos.h:205
#define BOTAN_DIAGNOSTIC_POP
Definition compiler.h:191
#define BOTAN_DIAGNOSTIC_PUSH
Definition compiler.h:188
#define BOTAN_DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS
Definition compiler.h:189

References BOTAN_DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS, BOTAN_DIAGNOSTIC_POP, and BOTAN_DIAGNOSTIC_PUSH.

Referenced by Botan::TLS::Callbacks::tls_kem_decapsulate(), and Botan::TLS::Callbacks::tls_kem_encapsulate().

◆ is_post_quantum()

bool Botan::TLS::Group_Params::is_post_quantum ( ) const
inlineconstexpr

◆ is_pqc_hybrid()

bool Botan::TLS::Group_Params::is_pqc_hybrid ( ) const
inlineconstexpr

Definition at line 235 of file tls_algos.h.

235 {
238
259
261 }

References BOTAN_DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS, BOTAN_DIAGNOSTIC_POP, and BOTAN_DIAGNOSTIC_PUSH.

Referenced by Botan::TLS::Callbacks::tls_kem_generate_key().

◆ is_pure_ecc_group()

bool Botan::TLS::Group_Params::is_pure_ecc_group ( ) const
inlineconstexpr

Definition at line 224 of file tls_algos.h.

224{ return is_x25519() || is_x448() || is_ecdh_named_curve(); }
constexpr bool is_ecdh_named_curve() const
Definition tls_algos.h:188
constexpr bool is_x448() const
Definition tls_algos.h:186
constexpr bool is_x25519() const
Definition tls_algos.h:184

◆ is_pure_frodokem()

◆ is_pure_kyber()

◆ is_x25519()

bool Botan::TLS::Group_Params::is_x25519 ( ) const
inlineconstexpr

◆ is_x448()

bool Botan::TLS::Group_Params::is_x448 ( ) const
inlineconstexpr

◆ operator<()

bool Botan::TLS::Group_Params::operator< ( Group_Params other) const
inlineconstexpr

Definition at line 178 of file tls_algos.h.

178{ return m_code < other.m_code; }

◆ operator==() [1/2]

bool Botan::TLS::Group_Params::operator== ( Group_Params other) const
inlineconstexpr

Definition at line 176 of file tls_algos.h.

176{ return m_code == other.m_code; }

◆ operator==() [2/2]

bool Botan::TLS::Group_Params::operator== ( Group_Params_Code code) const
inlineconstexpr

Definition at line 174 of file tls_algos.h.

174{ return m_code == code; }

◆ to_string()

std::optional< std::string > Botan::TLS::Group_Params::to_string ( ) const

Definition at line 277 of file tls_algos.cpp.

277 {
278 switch(m_code) {
279 case Group_Params::SECP256R1:
280 return "secp256r1";
281 case Group_Params::SECP384R1:
282 return "secp384r1";
283 case Group_Params::SECP521R1:
284 return "secp521r1";
285 case Group_Params::BRAINPOOL256R1:
286 return "brainpool256r1";
287 case Group_Params::BRAINPOOL384R1:
288 return "brainpool384r1";
289 case Group_Params::BRAINPOOL512R1:
290 return "brainpool512r1";
291 case Group_Params::X25519:
292 return "x25519";
293 case Group_Params::X448:
294 return "x448";
295
296 case Group_Params::FFDHE_2048:
297 return "ffdhe/ietf/2048";
298 case Group_Params::FFDHE_3072:
299 return "ffdhe/ietf/3072";
300 case Group_Params::FFDHE_4096:
301 return "ffdhe/ietf/4096";
302 case Group_Params::FFDHE_6144:
303 return "ffdhe/ietf/6144";
304 case Group_Params::FFDHE_8192:
305 return "ffdhe/ietf/8192";
306
307 case Group_Params::KYBER_512_R3_OQS:
308 return "Kyber-512-r3";
309 case Group_Params::KYBER_768_R3_OQS:
310 return "Kyber-768-r3";
311 case Group_Params::KYBER_1024_R3_OQS:
312 return "Kyber-1024-r3";
313
314 case Group_Params::eFRODOKEM_640_SHAKE_OQS:
315 return "eFrodoKEM-640-SHAKE";
316 case Group_Params::eFRODOKEM_976_SHAKE_OQS:
317 return "eFrodoKEM-976-SHAKE";
318 case Group_Params::eFRODOKEM_1344_SHAKE_OQS:
319 return "eFrodoKEM-1344-SHAKE";
320 case Group_Params::eFRODOKEM_640_AES_OQS:
321 return "eFrodoKEM-640-AES";
322 case Group_Params::eFRODOKEM_976_AES_OQS:
323 return "eFrodoKEM-976-AES";
324 case Group_Params::eFRODOKEM_1344_AES_OQS:
325 return "eFrodoKEM-1344-AES";
326
327 case Group_Params::HYBRID_X25519_eFRODOKEM_640_SHAKE_OQS:
328 return "x25519/eFrodoKEM-640-SHAKE";
329 case Group_Params::HYBRID_X25519_eFRODOKEM_640_AES_OQS:
330 return "x25519/eFrodoKEM-640-AES";
331 case Group_Params::HYBRID_X448_eFRODOKEM_976_SHAKE_OQS:
332 return "x448/eFrodoKEM-976-SHAKE";
333 case Group_Params::HYBRID_X448_eFRODOKEM_976_AES_OQS:
334 return "x448/eFrodoKEM-976-AES";
335 case Group_Params::HYBRID_SECP256R1_eFRODOKEM_640_SHAKE_OQS:
336 return "secp256r1/eFrodoKEM-640-SHAKE";
337 case Group_Params::HYBRID_SECP256R1_eFRODOKEM_640_AES_OQS:
338 return "secp256r1/eFrodoKEM-640-AES";
339 case Group_Params::HYBRID_SECP384R1_eFRODOKEM_976_SHAKE_OQS:
340 return "secp384r1/eFrodoKEM-976-SHAKE";
341 case Group_Params::HYBRID_SECP384R1_eFRODOKEM_976_AES_OQS:
342 return "secp384r1/eFrodoKEM-976-AES";
343 case Group_Params::HYBRID_SECP521R1_eFRODOKEM_1344_SHAKE_OQS:
344 return "secp521r1/eFrodoKEM-1344-SHAKE";
345 case Group_Params::HYBRID_SECP521R1_eFRODOKEM_1344_AES_OQS:
346 return "secp521r1/eFrodoKEM-1344-AES";
347
348 case Group_Params::HYBRID_X25519_KYBER_512_R3_CLOUDFLARE:
349 return "x25519/Kyber-512-r3/cloudflare";
350
351 case Group_Params::HYBRID_X25519_KYBER_512_R3_OQS:
352 return "x25519/Kyber-512-r3";
353 case Group_Params::HYBRID_X25519_KYBER_768_R3_OQS:
354 return "x25519/Kyber-768-r3";
355
356 case Group_Params::HYBRID_X25519_ML_KEM_768:
357 return "x25519/ML-KEM-768";
358 case Group_Params::HYBRID_SECP256R1_ML_KEM_768:
359 return "secp256r1/ML-KEM-768";
360
361 case Group_Params::HYBRID_X448_KYBER_768_R3_OQS:
362 return "x448/Kyber-768-r3";
363
364 case Group_Params::HYBRID_SECP256R1_KYBER_512_R3_OQS:
365 return "secp256r1/Kyber-512-r3";
366 case Group_Params::HYBRID_SECP256R1_KYBER_768_R3_OQS:
367 return "secp256r1/Kyber-768-r3";
368 case Group_Params::HYBRID_SECP384R1_KYBER_768_R3_OQS:
369 return "secp384r1/Kyber-768-r3";
370 case Group_Params::HYBRID_SECP521R1_KYBER_1024_R3_OQS:
371 return "secp521r1/Kyber-1024-r3";
372
373 default:
374 return std::nullopt;
375 }
376}

Referenced by Botan::TLS::Callbacks::tls_kem_generate_key().

◆ wire_code()

uint16_t Botan::TLS::Group_Params::wire_code ( ) const
inlineconstexpr

Definition at line 182 of file tls_algos.h.

182{ return static_cast<uint16_t>(m_code); }

The documentation for this class was generated from the following files: