blob: 75baed951b7580c03c208c1533cb1e6a90a56b98 [file] [log] [blame]
Paul Bakker5121ce52009-01-03 21:22:43 +00001/**
2 * \file dhm.h
Paul Bakkere0ccd0a2009-01-04 16:27:10 +00003 *
Darryl Green11999bb2018-03-13 15:22:58 +00004 * \brief This file contains Diffie-Hellman-Merkle (DHM) key exchange
Rose Zadikee963592018-04-18 09:46:12 +01005 * definitions and functions.
Rose Zadikf763f2b2018-04-17 11:00:40 +01006 *
7 * Diffie-Hellman-Merkle (DHM) key exchange is defined in
Darryl Green11999bb2018-03-13 15:22:58 +00008 * <em>RFC-2631: Diffie-Hellman Key Agreement Method</em> and
9 * <em>Public-Key Cryptography Standards (PKCS) #3: Diffie
Rose Zadikf763f2b2018-04-17 11:00:40 +010010 * Hellman Key Agreement Standard</em>.
Rose Zadik41ad0822018-01-26 10:54:57 +000011 *
12 * <em>RFC-3526: More Modular Exponential (MODP) Diffie-Hellman groups for
13 * Internet Key Exchange (IKE)</em> defines a number of standardized
14 * Diffie-Hellman groups for IKE.
15 *
16 * <em>RFC-5114: Additional Diffie-Hellman Groups for Use with IETF
17 * Standards</em> defines a number of standardized Diffie-Hellman
18 * groups that can be used.
Paul Bakker37ca75d2011-01-06 12:28:03 +000019 *
Jaeden Amero784de592018-01-26 17:52:01 +000020 * \warning The security of the DHM key exchange relies on the proper choice
21 * of prime modulus - optimally, it should be a safe prime. The usage
22 * of non-safe primes both decreases the difficulty of the underlying
23 * discrete logarithm problem and can lead to small subgroup attacks
24 * leaking private exponent bits when invalid public keys are used
25 * and not detected. This is especially relevant if the same DHM
26 * parameters are reused for multiple key exchanges as in static DHM,
27 * while the criticality of small-subgroup attacks is lower for
28 * ephemeral DHM.
29 *
30 * \warning For performance reasons, the code does neither perform primality
31 * nor safe primality tests, nor the expensive checks for invalid
32 * subgroups. Moreover, even if these were performed, non-standardized
33 * primes cannot be trusted because of the possibility of backdoors
34 * that can't be effectively checked for.
35 *
36 * \warning Diffie-Hellman-Merkle is therefore a security risk when not using
37 * standardized primes generated using a trustworthy ("nothing up
38 * my sleeve") method, such as the RFC 3526 / 7919 primes. In the TLS
39 * protocol, DH parameters need to be negotiated, so using the default
40 * primes systematically is not always an option. If possible, use
41 * Elliptic Curve Diffie-Hellman (ECDH), which has better performance,
42 * and for which the TLS protocol mandates the use of standard
43 * parameters.
44 *
Darryl Greena40a1012018-01-05 15:33:17 +000045 */
46/*
Bence Szépkúti1e148272020-08-07 13:07:28 +020047 * Copyright The Mbed TLS Contributors
Manuel Pégourié-Gonnard37ff1402015-09-04 14:21:07 +020048 * SPDX-License-Identifier: Apache-2.0
49 *
50 * Licensed under the Apache License, Version 2.0 (the "License"); you may
51 * not use this file except in compliance with the License.
52 * You may obtain a copy of the License at
53 *
54 * http://www.apache.org/licenses/LICENSE-2.0
55 *
56 * Unless required by applicable law or agreed to in writing, software
57 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
58 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
59 * See the License for the specific language governing permissions and
60 * limitations under the License.
Paul Bakker5121ce52009-01-03 21:22:43 +000061 */
Rose Zadik41ad0822018-01-26 10:54:57 +000062
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020063#ifndef MBEDTLS_DHM_H
64#define MBEDTLS_DHM_H
Mateusz Starzyk846f0212021-05-19 19:44:07 +020065#include "mbedtls/private_access.h"
Paul Bakker5121ce52009-01-03 21:22:43 +000066
Bence Szépkútic662b362021-05-27 11:25:03 +020067#include "mbedtls/build_info.h"
Jaeden Ameroc49fbbf2019-07-04 20:01:14 +010068#include "mbedtls/bignum.h"
Reuven Levin1f35ca92017-12-07 10:09:32 +000069
Paul Bakkerf3b86c12011-01-27 15:24:17 +000070/*
71 * DHM Error codes
72 */
Rose Zadik41ad0822018-01-26 10:54:57 +000073#define MBEDTLS_ERR_DHM_BAD_INPUT_DATA -0x3080 /**< Bad input parameters. */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020074#define MBEDTLS_ERR_DHM_READ_PARAMS_FAILED -0x3100 /**< Reading of the DHM parameters failed. */
75#define MBEDTLS_ERR_DHM_MAKE_PARAMS_FAILED -0x3180 /**< Making of the DHM parameters failed. */
76#define MBEDTLS_ERR_DHM_READ_PUBLIC_FAILED -0x3200 /**< Reading of the public values failed. */
77#define MBEDTLS_ERR_DHM_MAKE_PUBLIC_FAILED -0x3280 /**< Making of the public value failed. */
78#define MBEDTLS_ERR_DHM_CALC_SECRET_FAILED -0x3300 /**< Calculation of the DHM secret failed. */
79#define MBEDTLS_ERR_DHM_INVALID_FORMAT -0x3380 /**< The ASN.1 data is not formatted correctly. */
Manuel Pégourié-Gonnard6a8ca332015-05-28 09:33:39 +020080#define MBEDTLS_ERR_DHM_ALLOC_FAILED -0x3400 /**< Allocation of memory failed. */
Rose Zadik41ad0822018-01-26 10:54:57 +000081#define MBEDTLS_ERR_DHM_FILE_IO_ERROR -0x3480 /**< Read or write of file failed. */
Jaeden Amero2acbf172018-01-26 20:57:38 +000082#define MBEDTLS_ERR_DHM_SET_GROUP_FAILED -0x3580 /**< Setting the modulus and generator failed. */
Paul Bakker29b64762012-09-25 09:36:44 +000083
Gilles Peskine71acc6e2021-05-27 22:50:53 +020084/** Which parameter to access in mbedtls_dhm_get_value(). */
85typedef enum
86{
87 MBEDTLS_DHM_PARAM_P, /*!< The prime modulus. */
88 MBEDTLS_DHM_PARAM_G, /*!< The generator. */
89 MBEDTLS_DHM_PARAM_X, /*!< Our secret value. */
90 MBEDTLS_DHM_PARAM_GX, /*!< Our public key = \c G^X mod \c P. */
91 MBEDTLS_DHM_PARAM_GY, /*!< The public key of the peer = \c G^Y mod \c P. */
92 MBEDTLS_DHM_PARAM_K, /*!< The shared secret = \c G^(XY) mod \c P. */
93} mbedtls_dhm_parameter;
94
Paul Bakker407a0da2013-06-27 14:29:21 +020095#ifdef __cplusplus
96extern "C" {
97#endif
98
Ron Eldor4e6d55d2018-02-07 16:36:15 +020099#if !defined(MBEDTLS_DHM_ALT)
100
Paul Bakker29b64762012-09-25 09:36:44 +0000101/**
Rose Zadik41ad0822018-01-26 10:54:57 +0000102 * \brief The DHM context structure.
Paul Bakkerf3b86c12011-01-27 15:24:17 +0000103 */
Dawid Drozd428cc522018-07-24 10:02:47 +0200104typedef struct mbedtls_dhm_context
Paul Bakker5121ce52009-01-03 21:22:43 +0000105{
Mateusz Starzyk846f0212021-05-19 19:44:07 +0200106 mbedtls_mpi MBEDTLS_PRIVATE(P); /*!< The prime modulus. */
107 mbedtls_mpi MBEDTLS_PRIVATE(G); /*!< The generator. */
108 mbedtls_mpi MBEDTLS_PRIVATE(X); /*!< Our secret value. */
109 mbedtls_mpi MBEDTLS_PRIVATE(GX); /*!< Our public key = \c G^X mod \c P. */
110 mbedtls_mpi MBEDTLS_PRIVATE(GY); /*!< The public key of the peer = \c G^Y mod \c P. */
111 mbedtls_mpi MBEDTLS_PRIVATE(K); /*!< The shared secret = \c G^(XY) mod \c P. */
112 mbedtls_mpi MBEDTLS_PRIVATE(RP); /*!< The cached value = \c R^2 mod \c P. */
113 mbedtls_mpi MBEDTLS_PRIVATE(Vi); /*!< The blinding value. */
114 mbedtls_mpi MBEDTLS_PRIVATE(Vf); /*!< The unblinding value. */
115 mbedtls_mpi MBEDTLS_PRIVATE(pX); /*!< The previous \c X. */
Paul Bakker5121ce52009-01-03 21:22:43 +0000116}
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200117mbedtls_dhm_context;
Paul Bakker5121ce52009-01-03 21:22:43 +0000118
Ron Eldor4e6d55d2018-02-07 16:36:15 +0200119#else /* MBEDTLS_DHM_ALT */
120#include "dhm_alt.h"
121#endif /* MBEDTLS_DHM_ALT */
122
Paul Bakker5121ce52009-01-03 21:22:43 +0000123/**
Rose Zadik41ad0822018-01-26 10:54:57 +0000124 * \brief This function initializes the DHM context.
Paul Bakker8f870b02014-06-20 13:32:38 +0200125 *
Rose Zadik41ad0822018-01-26 10:54:57 +0000126 * \param ctx The DHM context to initialize.
Paul Bakker8f870b02014-06-20 13:32:38 +0200127 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200128void mbedtls_dhm_init( mbedtls_dhm_context *ctx );
Paul Bakker8f870b02014-06-20 13:32:38 +0200129
130/**
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500131 * \brief This function parses the DHM parameters in a
132 * TLS ServerKeyExchange handshake message
133 * (DHM modulus, generator, and public key).
Paul Bakker5121ce52009-01-03 21:22:43 +0000134 *
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500135 * \note In a TLS handshake, this is the how the client
136 * sets up its DHM context from the server's public
137 * DHM key material.
138 *
139 * \param ctx The DHM context to use. This must be initialized.
Hanno Beckerf240ea02017-10-02 15:09:14 +0100140 * \param p On input, *p must be the start of the input buffer.
141 * On output, *p is updated to point to the end of the data
142 * that has been read. On success, this is the first byte
143 * past the end of the ServerKeyExchange parameters.
144 * On error, this is the point at which an error has been
145 * detected, which is usually not useful except to debug
146 * failures.
Rose Zadik41ad0822018-01-26 10:54:57 +0000147 * \param end The end of the input buffer.
Paul Bakker5121ce52009-01-03 21:22:43 +0000148 *
Rose Zadikf763f2b2018-04-17 11:00:40 +0100149 * \return \c 0 on success.
150 * \return An \c MBEDTLS_ERR_DHM_XXX error code on failure.
Paul Bakker5121ce52009-01-03 21:22:43 +0000151 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200152int mbedtls_dhm_read_params( mbedtls_dhm_context *ctx,
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500153 unsigned char **p,
154 const unsigned char *end );
Paul Bakker5121ce52009-01-03 21:22:43 +0000155
156/**
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500157 * \brief This function generates a DHM key pair and exports its
158 * public part together with the DHM parameters in the format
159 * used in a TLS ServerKeyExchange handshake message.
Paul Bakker5121ce52009-01-03 21:22:43 +0000160 *
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500161 * \note This function assumes that the DHM parameters \c ctx->P
162 * and \c ctx->G have already been properly set. For that, use
Jaeden Amero9564e972018-01-30 16:56:13 +0000163 * mbedtls_dhm_set_group() below in conjunction with
164 * mbedtls_mpi_read_binary() and mbedtls_mpi_read_string().
Paul Bakker5121ce52009-01-03 21:22:43 +0000165 *
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500166 * \note In a TLS handshake, this is the how the server generates
167 * and exports its DHM key material.
168 *
169 * \param ctx The DHM context to use. This must be initialized
170 * and have the DHM parameters set. It may or may not
171 * already have imported the peer's public key.
Rose Zadikf763f2b2018-04-17 11:00:40 +0100172 * \param x_size The private key size in Bytes.
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500173 * \param olen The address at which to store the number of Bytes
174 * written on success. This must not be \c NULL.
175 * \param output The destination buffer. This must be a writable buffer of
176 * sufficient size to hold the reduced binary presentation of
177 * the modulus, the generator and the public key, each wrapped
178 * with a 2-byte length field. It is the responsibility of the
179 * caller to ensure that enough space is available. Refer to
180 * mbedtls_mpi_size() to computing the byte-size of an MPI.
181 * \param f_rng The RNG function. Must not be \c NULL.
182 * \param p_rng The RNG context to be passed to \p f_rng. This may be
183 * \c NULL if \p f_rng doesn't need a context parameter.
Rose Zadikf763f2b2018-04-17 11:00:40 +0100184 *
185 * \return \c 0 on success.
186 * \return An \c MBEDTLS_ERR_DHM_XXX error code on failure.
Paul Bakker5121ce52009-01-03 21:22:43 +0000187 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200188int mbedtls_dhm_make_params( mbedtls_dhm_context *ctx, int x_size,
Paul Bakker23986e52011-04-24 08:57:21 +0000189 unsigned char *output, size_t *olen,
Paul Bakkera3d195c2011-11-27 21:07:34 +0000190 int (*f_rng)(void *, unsigned char *, size_t),
191 void *p_rng );
Paul Bakker5121ce52009-01-03 21:22:43 +0000192
193/**
Rose Zadikf763f2b2018-04-17 11:00:40 +0100194 * \brief This function sets the prime modulus and generator.
195 *
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500196 * \note This function can be used to set \c ctx->P, \c ctx->G
Rose Zadikf763f2b2018-04-17 11:00:40 +0100197 * in preparation for mbedtls_dhm_make_params().
Hanno Becker8880e752017-10-04 13:15:08 +0100198 *
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500199 * \param ctx The DHM context to configure. This must be initialized.
200 * \param P The MPI holding the DHM prime modulus. This must be
201 * an initialized MPI.
202 * \param G The MPI holding the DHM generator. This must be an
203 * initialized MPI.
Hanno Becker8880e752017-10-04 13:15:08 +0100204 *
Rose Zadikf763f2b2018-04-17 11:00:40 +0100205 * \return \c 0 if successful.
206 * \return An \c MBEDTLS_ERR_DHM_XXX error code on failure.
Hanno Becker8880e752017-10-04 13:15:08 +0100207 */
208int mbedtls_dhm_set_group( mbedtls_dhm_context *ctx,
209 const mbedtls_mpi *P,
210 const mbedtls_mpi *G );
211
212/**
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500213 * \brief This function imports the raw public value of the peer.
Paul Bakker5121ce52009-01-03 21:22:43 +0000214 *
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500215 * \note In a TLS handshake, this is the how the server imports
216 * the Client's public DHM key.
217 *
218 * \param ctx The DHM context to use. This must be initialized and have
219 * its DHM parameters set, e.g. via mbedtls_dhm_set_group().
220 * It may or may not already have generated its own private key.
221 * \param input The input buffer containing the \c G^Y value of the peer.
222 * This must be a readable buffer of size \p ilen Bytes.
223 * \param ilen The size of the input buffer \p input in Bytes.
Paul Bakker5121ce52009-01-03 21:22:43 +0000224 *
Rose Zadikf763f2b2018-04-17 11:00:40 +0100225 * \return \c 0 on success.
226 * \return An \c MBEDTLS_ERR_DHM_XXX error code on failure.
Paul Bakker5121ce52009-01-03 21:22:43 +0000227 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200228int mbedtls_dhm_read_public( mbedtls_dhm_context *ctx,
Paul Bakker23986e52011-04-24 08:57:21 +0000229 const unsigned char *input, size_t ilen );
Paul Bakker5121ce52009-01-03 21:22:43 +0000230
231/**
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500232 * \brief This function creates a DHM key pair and exports
233 * the raw public key in big-endian format.
Paul Bakker5121ce52009-01-03 21:22:43 +0000234 *
Rose Zadikf763f2b2018-04-17 11:00:40 +0100235 * \note The destination buffer is always fully written
236 * so as to contain a big-endian representation of G^X mod P.
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500237 * If it is larger than \c ctx->len, it is padded accordingly
Rose Zadikf763f2b2018-04-17 11:00:40 +0100238 * with zero-bytes at the beginning.
239 *
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500240 * \param ctx The DHM context to use. This must be initialized and
241 * have the DHM parameters set. It may or may not already
242 * have imported the peer's public key.
Rose Zadikf763f2b2018-04-17 11:00:40 +0100243 * \param x_size The private key size in Bytes.
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500244 * \param output The destination buffer. This must be a writable buffer of
245 * size \p olen Bytes.
246 * \param olen The length of the destination buffer. This must be at least
247 * equal to `ctx->len` (the size of \c P).
248 * \param f_rng The RNG function. This must not be \c NULL.
249 * \param p_rng The RNG context to be passed to \p f_rng. This may be \c NULL
250 * if \p f_rng doesn't need a context argument.
Paul Bakker5121ce52009-01-03 21:22:43 +0000251 *
Rose Zadikf763f2b2018-04-17 11:00:40 +0100252 * \return \c 0 on success.
253 * \return An \c MBEDTLS_ERR_DHM_XXX error code on failure.
Paul Bakker5121ce52009-01-03 21:22:43 +0000254 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200255int mbedtls_dhm_make_public( mbedtls_dhm_context *ctx, int x_size,
Paul Bakker23986e52011-04-24 08:57:21 +0000256 unsigned char *output, size_t olen,
Paul Bakkera3d195c2011-11-27 21:07:34 +0000257 int (*f_rng)(void *, unsigned char *, size_t),
258 void *p_rng );
Paul Bakker5121ce52009-01-03 21:22:43 +0000259
260/**
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500261 * \brief This function derives and exports the shared secret
262 * \c (G^Y)^X mod \c P.
Paul Bakker5121ce52009-01-03 21:22:43 +0000263 *
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500264 * \note If \p f_rng is not \c NULL, it is used to blind the input as
265 * a countermeasure against timing attacks. Blinding is used
266 * only if our private key \c X is re-used, and not used
267 * otherwise. We recommend always passing a non-NULL
268 * \p f_rng argument.
Rose Zadikf763f2b2018-04-17 11:00:40 +0100269 *
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500270 * \param ctx The DHM context to use. This must be initialized
271 * and have its own private key generated and the peer's
272 * public key imported.
273 * \param output The buffer to write the generated shared key to. This
274 * must be a writable buffer of size \p output_size Bytes.
275 * \param output_size The size of the destination buffer. This must be at
276 * least the size of \c ctx->len (the size of \c P).
Rose Zadik41ad0822018-01-26 10:54:57 +0000277 * \param olen On exit, holds the actual number of Bytes written.
Manuel Pégourié-Gonnard1a877222021-06-15 11:29:26 +0200278 * \param f_rng The RNG function. Must not be \c NULL. Used for
279 * blinding.
280 * \param p_rng The RNG context to be passed to \p f_rng. This may be
281 * \c NULL if \p f_rng doesn't need a context parameter.
Paul Bakker5121ce52009-01-03 21:22:43 +0000282 *
Rose Zadikf763f2b2018-04-17 11:00:40 +0100283 * \return \c 0 on success.
284 * \return An \c MBEDTLS_ERR_DHM_XXX error code on failure.
Paul Bakker5121ce52009-01-03 21:22:43 +0000285 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200286int mbedtls_dhm_calc_secret( mbedtls_dhm_context *ctx,
Manuel Pégourié-Gonnard33352052015-06-02 16:17:08 +0100287 unsigned char *output, size_t output_size, size_t *olen,
Manuel Pégourié-Gonnard2d627642013-09-04 14:22:07 +0200288 int (*f_rng)(void *, unsigned char *, size_t),
289 void *p_rng );
Paul Bakker5121ce52009-01-03 21:22:43 +0000290
Paul Bakker9a736322012-11-14 12:39:52 +0000291/**
Gilles Peskine487bbf62021-05-27 22:17:07 +0200292 * \brief This function returns the size of the prime modulus in bits.
293 *
294 * \param ctx The DHM context to query.
295 *
296 * \return The size of the prime modulus in bits,
297 * i.e. the number n such that 2^(n-1) <= P < 2^n.
298 */
299size_t mbedtls_dhm_get_bitlen( const mbedtls_dhm_context *ctx );
300
301/**
302 * \brief This function returns the size of the prime modulus in bytes.
303 *
304 * \param ctx The DHM context to query.
305 *
306 * \return The size of the prime modulus in bytes,
307 * i.e. the number n such that 2^(8*(n-1)) <= P < 2^(8*n).
308 */
309size_t mbedtls_dhm_get_len( const mbedtls_dhm_context *ctx );
310
311/**
Gilles Peskine71acc6e2021-05-27 22:50:53 +0200312 * \brief This function copies a parameter of a DHM key.
313 *
Gilles Peskine71acc6e2021-05-27 22:50:53 +0200314 * \param ctx The DHM context to query.
315 * \param param The parameter to copy.
Gilles Peskinee5702482021-06-11 21:59:08 +0200316 * \param dest The MPI object to copy the value into. It must be
317 * initialized.
Gilles Peskine71acc6e2021-05-27 22:50:53 +0200318 *
319 * \return \c 0 on success.
320 * \return #MBEDTLS_ERR_DHM_BAD_INPUT_DATA if \p field is invalid.
321 * \return An \c MBEDTLS_ERR_MPI_XXX error code if the copy fails.
322 */
Gilles Peskinee5702482021-06-11 21:59:08 +0200323int mbedtls_dhm_get_value( const mbedtls_dhm_context *ctx,
324 mbedtls_dhm_parameter param,
325 mbedtls_mpi *dest );
Gilles Peskine71acc6e2021-05-27 22:50:53 +0200326
327/**
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500328 * \brief This function frees and clears the components
329 * of a DHM context.
Paul Bakker8f870b02014-06-20 13:32:38 +0200330 *
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500331 * \param ctx The DHM context to free and clear. This may be \c NULL,
332 * in which case this function is a no-op. If it is not \c NULL,
333 * it must point to an initialized DHM context.
Paul Bakker5121ce52009-01-03 21:22:43 +0000334 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200335void mbedtls_dhm_free( mbedtls_dhm_context *ctx );
Paul Bakker5121ce52009-01-03 21:22:43 +0000336
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200337#if defined(MBEDTLS_ASN1_PARSE_C)
Paul Bakker40ce79f2013-09-15 17:43:54 +0200338/**
Rose Zadik41ad0822018-01-26 10:54:57 +0000339 * \brief This function parses DHM parameters in PEM or DER format.
Paul Bakker40ce79f2013-09-15 17:43:54 +0200340 *
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500341 * \param dhm The DHM context to import the DHM parameters into.
342 * This must be initialized.
343 * \param dhmin The input buffer. This must be a readable buffer of
344 * length \p dhminlen Bytes.
345 * \param dhminlen The size of the input buffer \p dhmin, including the
346 * terminating \c NULL Byte for PEM data.
Paul Bakker40ce79f2013-09-15 17:43:54 +0200347 *
Rose Zadikf763f2b2018-04-17 11:00:40 +0100348 * \return \c 0 on success.
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500349 * \return An \c MBEDTLS_ERR_DHM_XXX or \c MBEDTLS_ERR_PEM_XXX error
350 * code on failure.
Paul Bakker40ce79f2013-09-15 17:43:54 +0200351 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200352int mbedtls_dhm_parse_dhm( mbedtls_dhm_context *dhm, const unsigned char *dhmin,
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500353 size_t dhminlen );
Paul Bakker40ce79f2013-09-15 17:43:54 +0200354
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200355#if defined(MBEDTLS_FS_IO)
Paul Bakker40ce79f2013-09-15 17:43:54 +0200356/**
Rose Zadik41ad0822018-01-26 10:54:57 +0000357 * \brief This function loads and parses DHM parameters from a file.
Paul Bakker40ce79f2013-09-15 17:43:54 +0200358 *
Rose Zadik41ad0822018-01-26 10:54:57 +0000359 * \param dhm The DHM context to load the parameters to.
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500360 * This must be initialized.
Rose Zadik41ad0822018-01-26 10:54:57 +0000361 * \param path The filename to read the DHM parameters from.
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500362 * This must not be \c NULL.
Paul Bakker40ce79f2013-09-15 17:43:54 +0200363 *
Rose Zadikf763f2b2018-04-17 11:00:40 +0100364 * \return \c 0 on success.
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500365 * \return An \c MBEDTLS_ERR_DHM_XXX or \c MBEDTLS_ERR_PEM_XXX
366 * error code on failure.
Paul Bakker40ce79f2013-09-15 17:43:54 +0200367 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200368int mbedtls_dhm_parse_dhmfile( mbedtls_dhm_context *dhm, const char *path );
369#endif /* MBEDTLS_FS_IO */
370#endif /* MBEDTLS_ASN1_PARSE_C */
nirekh01d569ecf2018-01-09 16:43:21 +0000371
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500372#if defined(MBEDTLS_SELF_TEST)
373
Paul Bakker5121ce52009-01-03 21:22:43 +0000374/**
Rose Zadik41ad0822018-01-26 10:54:57 +0000375 * \brief The DMH checkup routine.
Paul Bakker5121ce52009-01-03 21:22:43 +0000376 *
Rose Zadikf763f2b2018-04-17 11:00:40 +0100377 * \return \c 0 on success.
378 * \return \c 1 on failure.
Paul Bakker5121ce52009-01-03 21:22:43 +0000379 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200380int mbedtls_dhm_self_test( int verbose );
Paul Bakker5121ce52009-01-03 21:22:43 +0000381
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500382#endif /* MBEDTLS_SELF_TEST */
Paul Bakker5121ce52009-01-03 21:22:43 +0000383#ifdef __cplusplus
384}
385#endif
386
Hanno Beckere2fcfa82017-10-04 13:12:15 +0100387/**
Gilles Peskined40f0072020-02-26 19:52:04 +0100388 * RFC 3526, RFC 5114 and RFC 7919 standardize a number of
389 * Diffie-Hellman groups, some of which are included here
390 * for use within the SSL/TLS module and the user's convenience
391 * when configuring the Diffie-Hellman parameters by hand
392 * through \c mbedtls_ssl_conf_dh_param.
Hanno Beckere2fcfa82017-10-04 13:12:15 +0100393 *
Jaeden Amero9564e972018-01-30 16:56:13 +0000394 * The following lists the source of the above groups in the standards:
395 * - RFC 5114 section 2.2: 2048-bit MODP Group with 224-bit Prime Order Subgroup
396 * - RFC 3526 section 3: 2048-bit MODP Group
397 * - RFC 3526 section 4: 3072-bit MODP Group
398 * - RFC 3526 section 5: 4096-bit MODP Group
399 * - RFC 7919 section A.1: ffdhe2048
400 * - RFC 7919 section A.2: ffdhe3072
401 * - RFC 7919 section A.3: ffdhe4096
402 * - RFC 7919 section A.4: ffdhe6144
403 * - RFC 7919 section A.5: ffdhe8192
Hanno Beckere2fcfa82017-10-04 13:12:15 +0100404 *
405 * The constants with suffix "_p" denote the chosen prime moduli, while
406 * the constants with suffix "_g" denote the chosen generator
407 * of the associated prime field.
408 *
409 * The constants further suffixed with "_bin" are provided in binary format,
410 * while all other constants represent null-terminated strings holding the
411 * hexadecimal presentation of the respective numbers.
412 *
413 * The primes from RFC 3526 and RFC 7919 have been generating by the following
414 * trust-worthy procedure:
415 * - Fix N in { 2048, 3072, 4096, 6144, 8192 } and consider the N-bit number
416 * the first and last 64 bits are all 1, and the remaining N - 128 bits of
417 * which are 0x7ff...ff.
418 * - Add the smallest multiple of the first N - 129 bits of the binary expansion
419 * of pi (for RFC 5236) or e (for RFC 7919) to this intermediate bit-string
420 * such that the resulting integer is a safe-prime.
421 * - The result is the respective RFC 3526 / 7919 prime, and the corresponding
422 * generator is always chosen to be 2 (which is a square for these prime,
423 * hence the corresponding subgroup has order (p-1)/2 and avoids leaking a
424 * bit in the private exponent).
425 *
Hanno Beckere2fcfa82017-10-04 13:12:15 +0100426 */
427
Hanno Beckere2fcfa82017-10-04 13:12:15 +0100428/*
429 * Trustworthy DHM parameters in binary form
430 */
431
432#define MBEDTLS_DHM_RFC3526_MODP_2048_P_BIN { \
433 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
434 0xC9, 0x0F, 0xDA, 0xA2, 0x21, 0x68, 0xC2, 0x34, \
435 0xC4, 0xC6, 0x62, 0x8B, 0x80, 0xDC, 0x1C, 0xD1, \
436 0x29, 0x02, 0x4E, 0x08, 0x8A, 0x67, 0xCC, 0x74, \
437 0x02, 0x0B, 0xBE, 0xA6, 0x3B, 0x13, 0x9B, 0x22, \
438 0x51, 0x4A, 0x08, 0x79, 0x8E, 0x34, 0x04, 0xDD, \
439 0xEF, 0x95, 0x19, 0xB3, 0xCD, 0x3A, 0x43, 0x1B, \
440 0x30, 0x2B, 0x0A, 0x6D, 0xF2, 0x5F, 0x14, 0x37, \
441 0x4F, 0xE1, 0x35, 0x6D, 0x6D, 0x51, 0xC2, 0x45, \
442 0xE4, 0x85, 0xB5, 0x76, 0x62, 0x5E, 0x7E, 0xC6, \
443 0xF4, 0x4C, 0x42, 0xE9, 0xA6, 0x37, 0xED, 0x6B, \
444 0x0B, 0xFF, 0x5C, 0xB6, 0xF4, 0x06, 0xB7, 0xED, \
445 0xEE, 0x38, 0x6B, 0xFB, 0x5A, 0x89, 0x9F, 0xA5, \
446 0xAE, 0x9F, 0x24, 0x11, 0x7C, 0x4B, 0x1F, 0xE6, \
447 0x49, 0x28, 0x66, 0x51, 0xEC, 0xE4, 0x5B, 0x3D, \
448 0xC2, 0x00, 0x7C, 0xB8, 0xA1, 0x63, 0xBF, 0x05, \
449 0x98, 0xDA, 0x48, 0x36, 0x1C, 0x55, 0xD3, 0x9A, \
450 0x69, 0x16, 0x3F, 0xA8, 0xFD, 0x24, 0xCF, 0x5F, \
451 0x83, 0x65, 0x5D, 0x23, 0xDC, 0xA3, 0xAD, 0x96, \
452 0x1C, 0x62, 0xF3, 0x56, 0x20, 0x85, 0x52, 0xBB, \
453 0x9E, 0xD5, 0x29, 0x07, 0x70, 0x96, 0x96, 0x6D, \
454 0x67, 0x0C, 0x35, 0x4E, 0x4A, 0xBC, 0x98, 0x04, \
455 0xF1, 0x74, 0x6C, 0x08, 0xCA, 0x18, 0x21, 0x7C, \
456 0x32, 0x90, 0x5E, 0x46, 0x2E, 0x36, 0xCE, 0x3B, \
457 0xE3, 0x9E, 0x77, 0x2C, 0x18, 0x0E, 0x86, 0x03, \
458 0x9B, 0x27, 0x83, 0xA2, 0xEC, 0x07, 0xA2, 0x8F, \
459 0xB5, 0xC5, 0x5D, 0xF0, 0x6F, 0x4C, 0x52, 0xC9, \
460 0xDE, 0x2B, 0xCB, 0xF6, 0x95, 0x58, 0x17, 0x18, \
461 0x39, 0x95, 0x49, 0x7C, 0xEA, 0x95, 0x6A, 0xE5, \
462 0x15, 0xD2, 0x26, 0x18, 0x98, 0xFA, 0x05, 0x10, \
463 0x15, 0x72, 0x8E, 0x5A, 0x8A, 0xAC, 0xAA, 0x68, \
464 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }
465
466#define MBEDTLS_DHM_RFC3526_MODP_2048_G_BIN { 0x02 }
467
468#define MBEDTLS_DHM_RFC3526_MODP_3072_P_BIN { \
469 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
470 0xC9, 0x0F, 0xDA, 0xA2, 0x21, 0x68, 0xC2, 0x34, \
471 0xC4, 0xC6, 0x62, 0x8B, 0x80, 0xDC, 0x1C, 0xD1, \
472 0x29, 0x02, 0x4E, 0x08, 0x8A, 0x67, 0xCC, 0x74, \
473 0x02, 0x0B, 0xBE, 0xA6, 0x3B, 0x13, 0x9B, 0x22, \
474 0x51, 0x4A, 0x08, 0x79, 0x8E, 0x34, 0x04, 0xDD, \
475 0xEF, 0x95, 0x19, 0xB3, 0xCD, 0x3A, 0x43, 0x1B, \
476 0x30, 0x2B, 0x0A, 0x6D, 0xF2, 0x5F, 0x14, 0x37, \
477 0x4F, 0xE1, 0x35, 0x6D, 0x6D, 0x51, 0xC2, 0x45, \
478 0xE4, 0x85, 0xB5, 0x76, 0x62, 0x5E, 0x7E, 0xC6, \
479 0xF4, 0x4C, 0x42, 0xE9, 0xA6, 0x37, 0xED, 0x6B, \
480 0x0B, 0xFF, 0x5C, 0xB6, 0xF4, 0x06, 0xB7, 0xED, \
481 0xEE, 0x38, 0x6B, 0xFB, 0x5A, 0x89, 0x9F, 0xA5, \
482 0xAE, 0x9F, 0x24, 0x11, 0x7C, 0x4B, 0x1F, 0xE6, \
483 0x49, 0x28, 0x66, 0x51, 0xEC, 0xE4, 0x5B, 0x3D, \
484 0xC2, 0x00, 0x7C, 0xB8, 0xA1, 0x63, 0xBF, 0x05, \
485 0x98, 0xDA, 0x48, 0x36, 0x1C, 0x55, 0xD3, 0x9A, \
486 0x69, 0x16, 0x3F, 0xA8, 0xFD, 0x24, 0xCF, 0x5F, \
487 0x83, 0x65, 0x5D, 0x23, 0xDC, 0xA3, 0xAD, 0x96, \
488 0x1C, 0x62, 0xF3, 0x56, 0x20, 0x85, 0x52, 0xBB, \
489 0x9E, 0xD5, 0x29, 0x07, 0x70, 0x96, 0x96, 0x6D, \
490 0x67, 0x0C, 0x35, 0x4E, 0x4A, 0xBC, 0x98, 0x04, \
491 0xF1, 0x74, 0x6C, 0x08, 0xCA, 0x18, 0x21, 0x7C, \
492 0x32, 0x90, 0x5E, 0x46, 0x2E, 0x36, 0xCE, 0x3B, \
493 0xE3, 0x9E, 0x77, 0x2C, 0x18, 0x0E, 0x86, 0x03, \
494 0x9B, 0x27, 0x83, 0xA2, 0xEC, 0x07, 0xA2, 0x8F, \
495 0xB5, 0xC5, 0x5D, 0xF0, 0x6F, 0x4C, 0x52, 0xC9, \
496 0xDE, 0x2B, 0xCB, 0xF6, 0x95, 0x58, 0x17, 0x18, \
497 0x39, 0x95, 0x49, 0x7C, 0xEA, 0x95, 0x6A, 0xE5, \
498 0x15, 0xD2, 0x26, 0x18, 0x98, 0xFA, 0x05, 0x10, \
499 0x15, 0x72, 0x8E, 0x5A, 0x8A, 0xAA, 0xC4, 0x2D, \
500 0xAD, 0x33, 0x17, 0x0D, 0x04, 0x50, 0x7A, 0x33, \
501 0xA8, 0x55, 0x21, 0xAB, 0xDF, 0x1C, 0xBA, 0x64, \
502 0xEC, 0xFB, 0x85, 0x04, 0x58, 0xDB, 0xEF, 0x0A, \
503 0x8A, 0xEA, 0x71, 0x57, 0x5D, 0x06, 0x0C, 0x7D, \
504 0xB3, 0x97, 0x0F, 0x85, 0xA6, 0xE1, 0xE4, 0xC7, \
505 0xAB, 0xF5, 0xAE, 0x8C, 0xDB, 0x09, 0x33, 0xD7, \
506 0x1E, 0x8C, 0x94, 0xE0, 0x4A, 0x25, 0x61, 0x9D, \
507 0xCE, 0xE3, 0xD2, 0x26, 0x1A, 0xD2, 0xEE, 0x6B, \
508 0xF1, 0x2F, 0xFA, 0x06, 0xD9, 0x8A, 0x08, 0x64, \
509 0xD8, 0x76, 0x02, 0x73, 0x3E, 0xC8, 0x6A, 0x64, \
510 0x52, 0x1F, 0x2B, 0x18, 0x17, 0x7B, 0x20, 0x0C, \
511 0xBB, 0xE1, 0x17, 0x57, 0x7A, 0x61, 0x5D, 0x6C, \
512 0x77, 0x09, 0x88, 0xC0, 0xBA, 0xD9, 0x46, 0xE2, \
513 0x08, 0xE2, 0x4F, 0xA0, 0x74, 0xE5, 0xAB, 0x31, \
514 0x43, 0xDB, 0x5B, 0xFC, 0xE0, 0xFD, 0x10, 0x8E, \
515 0x4B, 0x82, 0xD1, 0x20, 0xA9, 0x3A, 0xD2, 0xCA, \
516 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }
517
518#define MBEDTLS_DHM_RFC3526_MODP_3072_G_BIN { 0x02 }
519
520#define MBEDTLS_DHM_RFC3526_MODP_4096_P_BIN { \
521 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
522 0xC9, 0x0F, 0xDA, 0xA2, 0x21, 0x68, 0xC2, 0x34, \
523 0xC4, 0xC6, 0x62, 0x8B, 0x80, 0xDC, 0x1C, 0xD1, \
524 0x29, 0x02, 0x4E, 0x08, 0x8A, 0x67, 0xCC, 0x74, \
525 0x02, 0x0B, 0xBE, 0xA6, 0x3B, 0x13, 0x9B, 0x22, \
526 0x51, 0x4A, 0x08, 0x79, 0x8E, 0x34, 0x04, 0xDD, \
527 0xEF, 0x95, 0x19, 0xB3, 0xCD, 0x3A, 0x43, 0x1B, \
528 0x30, 0x2B, 0x0A, 0x6D, 0xF2, 0x5F, 0x14, 0x37, \
529 0x4F, 0xE1, 0x35, 0x6D, 0x6D, 0x51, 0xC2, 0x45, \
530 0xE4, 0x85, 0xB5, 0x76, 0x62, 0x5E, 0x7E, 0xC6, \
531 0xF4, 0x4C, 0x42, 0xE9, 0xA6, 0x37, 0xED, 0x6B, \
532 0x0B, 0xFF, 0x5C, 0xB6, 0xF4, 0x06, 0xB7, 0xED, \
533 0xEE, 0x38, 0x6B, 0xFB, 0x5A, 0x89, 0x9F, 0xA5, \
534 0xAE, 0x9F, 0x24, 0x11, 0x7C, 0x4B, 0x1F, 0xE6, \
535 0x49, 0x28, 0x66, 0x51, 0xEC, 0xE4, 0x5B, 0x3D, \
536 0xC2, 0x00, 0x7C, 0xB8, 0xA1, 0x63, 0xBF, 0x05, \
537 0x98, 0xDA, 0x48, 0x36, 0x1C, 0x55, 0xD3, 0x9A, \
538 0x69, 0x16, 0x3F, 0xA8, 0xFD, 0x24, 0xCF, 0x5F, \
539 0x83, 0x65, 0x5D, 0x23, 0xDC, 0xA3, 0xAD, 0x96, \
540 0x1C, 0x62, 0xF3, 0x56, 0x20, 0x85, 0x52, 0xBB, \
541 0x9E, 0xD5, 0x29, 0x07, 0x70, 0x96, 0x96, 0x6D, \
542 0x67, 0x0C, 0x35, 0x4E, 0x4A, 0xBC, 0x98, 0x04, \
543 0xF1, 0x74, 0x6C, 0x08, 0xCA, 0x18, 0x21, 0x7C, \
544 0x32, 0x90, 0x5E, 0x46, 0x2E, 0x36, 0xCE, 0x3B, \
545 0xE3, 0x9E, 0x77, 0x2C, 0x18, 0x0E, 0x86, 0x03, \
546 0x9B, 0x27, 0x83, 0xA2, 0xEC, 0x07, 0xA2, 0x8F, \
547 0xB5, 0xC5, 0x5D, 0xF0, 0x6F, 0x4C, 0x52, 0xC9, \
548 0xDE, 0x2B, 0xCB, 0xF6, 0x95, 0x58, 0x17, 0x18, \
549 0x39, 0x95, 0x49, 0x7C, 0xEA, 0x95, 0x6A, 0xE5, \
550 0x15, 0xD2, 0x26, 0x18, 0x98, 0xFA, 0x05, 0x10, \
551 0x15, 0x72, 0x8E, 0x5A, 0x8A, 0xAA, 0xC4, 0x2D, \
552 0xAD, 0x33, 0x17, 0x0D, 0x04, 0x50, 0x7A, 0x33, \
553 0xA8, 0x55, 0x21, 0xAB, 0xDF, 0x1C, 0xBA, 0x64, \
554 0xEC, 0xFB, 0x85, 0x04, 0x58, 0xDB, 0xEF, 0x0A, \
555 0x8A, 0xEA, 0x71, 0x57, 0x5D, 0x06, 0x0C, 0x7D, \
556 0xB3, 0x97, 0x0F, 0x85, 0xA6, 0xE1, 0xE4, 0xC7, \
557 0xAB, 0xF5, 0xAE, 0x8C, 0xDB, 0x09, 0x33, 0xD7, \
558 0x1E, 0x8C, 0x94, 0xE0, 0x4A, 0x25, 0x61, 0x9D, \
559 0xCE, 0xE3, 0xD2, 0x26, 0x1A, 0xD2, 0xEE, 0x6B, \
560 0xF1, 0x2F, 0xFA, 0x06, 0xD9, 0x8A, 0x08, 0x64, \
561 0xD8, 0x76, 0x02, 0x73, 0x3E, 0xC8, 0x6A, 0x64, \
562 0x52, 0x1F, 0x2B, 0x18, 0x17, 0x7B, 0x20, 0x0C, \
563 0xBB, 0xE1, 0x17, 0x57, 0x7A, 0x61, 0x5D, 0x6C, \
564 0x77, 0x09, 0x88, 0xC0, 0xBA, 0xD9, 0x46, 0xE2, \
565 0x08, 0xE2, 0x4F, 0xA0, 0x74, 0xE5, 0xAB, 0x31, \
566 0x43, 0xDB, 0x5B, 0xFC, 0xE0, 0xFD, 0x10, 0x8E, \
567 0x4B, 0x82, 0xD1, 0x20, 0xA9, 0x21, 0x08, 0x01, \
568 0x1A, 0x72, 0x3C, 0x12, 0xA7, 0x87, 0xE6, 0xD7, \
569 0x88, 0x71, 0x9A, 0x10, 0xBD, 0xBA, 0x5B, 0x26, \
570 0x99, 0xC3, 0x27, 0x18, 0x6A, 0xF4, 0xE2, 0x3C, \
571 0x1A, 0x94, 0x68, 0x34, 0xB6, 0x15, 0x0B, 0xDA, \
572 0x25, 0x83, 0xE9, 0xCA, 0x2A, 0xD4, 0x4C, 0xE8, \
573 0xDB, 0xBB, 0xC2, 0xDB, 0x04, 0xDE, 0x8E, 0xF9, \
574 0x2E, 0x8E, 0xFC, 0x14, 0x1F, 0xBE, 0xCA, 0xA6, \
575 0x28, 0x7C, 0x59, 0x47, 0x4E, 0x6B, 0xC0, 0x5D, \
576 0x99, 0xB2, 0x96, 0x4F, 0xA0, 0x90, 0xC3, 0xA2, \
577 0x23, 0x3B, 0xA1, 0x86, 0x51, 0x5B, 0xE7, 0xED, \
578 0x1F, 0x61, 0x29, 0x70, 0xCE, 0xE2, 0xD7, 0xAF, \
579 0xB8, 0x1B, 0xDD, 0x76, 0x21, 0x70, 0x48, 0x1C, \
580 0xD0, 0x06, 0x91, 0x27, 0xD5, 0xB0, 0x5A, 0xA9, \
581 0x93, 0xB4, 0xEA, 0x98, 0x8D, 0x8F, 0xDD, 0xC1, \
582 0x86, 0xFF, 0xB7, 0xDC, 0x90, 0xA6, 0xC0, 0x8F, \
583 0x4D, 0xF4, 0x35, 0xC9, 0x34, 0x06, 0x31, 0x99, \
584 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }
585
586#define MBEDTLS_DHM_RFC3526_MODP_4096_G_BIN { 0x02 }
587
588#define MBEDTLS_DHM_RFC7919_FFDHE2048_P_BIN { \
589 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
590 0xAD, 0xF8, 0x54, 0x58, 0xA2, 0xBB, 0x4A, 0x9A, \
591 0xAF, 0xDC, 0x56, 0x20, 0x27, 0x3D, 0x3C, 0xF1, \
592 0xD8, 0xB9, 0xC5, 0x83, 0xCE, 0x2D, 0x36, 0x95, \
593 0xA9, 0xE1, 0x36, 0x41, 0x14, 0x64, 0x33, 0xFB, \
594 0xCC, 0x93, 0x9D, 0xCE, 0x24, 0x9B, 0x3E, 0xF9, \
595 0x7D, 0x2F, 0xE3, 0x63, 0x63, 0x0C, 0x75, 0xD8, \
596 0xF6, 0x81, 0xB2, 0x02, 0xAE, 0xC4, 0x61, 0x7A, \
597 0xD3, 0xDF, 0x1E, 0xD5, 0xD5, 0xFD, 0x65, 0x61, \
598 0x24, 0x33, 0xF5, 0x1F, 0x5F, 0x06, 0x6E, 0xD0, \
599 0x85, 0x63, 0x65, 0x55, 0x3D, 0xED, 0x1A, 0xF3, \
600 0xB5, 0x57, 0x13, 0x5E, 0x7F, 0x57, 0xC9, 0x35, \
601 0x98, 0x4F, 0x0C, 0x70, 0xE0, 0xE6, 0x8B, 0x77, \
602 0xE2, 0xA6, 0x89, 0xDA, 0xF3, 0xEF, 0xE8, 0x72, \
603 0x1D, 0xF1, 0x58, 0xA1, 0x36, 0xAD, 0xE7, 0x35, \
604 0x30, 0xAC, 0xCA, 0x4F, 0x48, 0x3A, 0x79, 0x7A, \
605 0xBC, 0x0A, 0xB1, 0x82, 0xB3, 0x24, 0xFB, 0x61, \
606 0xD1, 0x08, 0xA9, 0x4B, 0xB2, 0xC8, 0xE3, 0xFB, \
607 0xB9, 0x6A, 0xDA, 0xB7, 0x60, 0xD7, 0xF4, 0x68, \
608 0x1D, 0x4F, 0x42, 0xA3, 0xDE, 0x39, 0x4D, 0xF4, \
609 0xAE, 0x56, 0xED, 0xE7, 0x63, 0x72, 0xBB, 0x19, \
610 0x0B, 0x07, 0xA7, 0xC8, 0xEE, 0x0A, 0x6D, 0x70, \
611 0x9E, 0x02, 0xFC, 0xE1, 0xCD, 0xF7, 0xE2, 0xEC, \
612 0xC0, 0x34, 0x04, 0xCD, 0x28, 0x34, 0x2F, 0x61, \
613 0x91, 0x72, 0xFE, 0x9C, 0xE9, 0x85, 0x83, 0xFF, \
614 0x8E, 0x4F, 0x12, 0x32, 0xEE, 0xF2, 0x81, 0x83, \
615 0xC3, 0xFE, 0x3B, 0x1B, 0x4C, 0x6F, 0xAD, 0x73, \
616 0x3B, 0xB5, 0xFC, 0xBC, 0x2E, 0xC2, 0x20, 0x05, \
617 0xC5, 0x8E, 0xF1, 0x83, 0x7D, 0x16, 0x83, 0xB2, \
618 0xC6, 0xF3, 0x4A, 0x26, 0xC1, 0xB2, 0xEF, 0xFA, \
619 0x88, 0x6B, 0x42, 0x38, 0x61, 0x28, 0x5C, 0x97, \
620 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, }
621
622#define MBEDTLS_DHM_RFC7919_FFDHE2048_G_BIN { 0x02 }
623
624#define MBEDTLS_DHM_RFC7919_FFDHE3072_P_BIN { \
625 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
626 0xAD, 0xF8, 0x54, 0x58, 0xA2, 0xBB, 0x4A, 0x9A, \
627 0xAF, 0xDC, 0x56, 0x20, 0x27, 0x3D, 0x3C, 0xF1, \
628 0xD8, 0xB9, 0xC5, 0x83, 0xCE, 0x2D, 0x36, 0x95, \
629 0xA9, 0xE1, 0x36, 0x41, 0x14, 0x64, 0x33, 0xFB, \
630 0xCC, 0x93, 0x9D, 0xCE, 0x24, 0x9B, 0x3E, 0xF9, \
631 0x7D, 0x2F, 0xE3, 0x63, 0x63, 0x0C, 0x75, 0xD8, \
632 0xF6, 0x81, 0xB2, 0x02, 0xAE, 0xC4, 0x61, 0x7A, \
633 0xD3, 0xDF, 0x1E, 0xD5, 0xD5, 0xFD, 0x65, 0x61, \
634 0x24, 0x33, 0xF5, 0x1F, 0x5F, 0x06, 0x6E, 0xD0, \
635 0x85, 0x63, 0x65, 0x55, 0x3D, 0xED, 0x1A, 0xF3, \
636 0xB5, 0x57, 0x13, 0x5E, 0x7F, 0x57, 0xC9, 0x35, \
637 0x98, 0x4F, 0x0C, 0x70, 0xE0, 0xE6, 0x8B, 0x77, \
638 0xE2, 0xA6, 0x89, 0xDA, 0xF3, 0xEF, 0xE8, 0x72, \
639 0x1D, 0xF1, 0x58, 0xA1, 0x36, 0xAD, 0xE7, 0x35, \
640 0x30, 0xAC, 0xCA, 0x4F, 0x48, 0x3A, 0x79, 0x7A, \
641 0xBC, 0x0A, 0xB1, 0x82, 0xB3, 0x24, 0xFB, 0x61, \
642 0xD1, 0x08, 0xA9, 0x4B, 0xB2, 0xC8, 0xE3, 0xFB, \
643 0xB9, 0x6A, 0xDA, 0xB7, 0x60, 0xD7, 0xF4, 0x68, \
644 0x1D, 0x4F, 0x42, 0xA3, 0xDE, 0x39, 0x4D, 0xF4, \
645 0xAE, 0x56, 0xED, 0xE7, 0x63, 0x72, 0xBB, 0x19, \
646 0x0B, 0x07, 0xA7, 0xC8, 0xEE, 0x0A, 0x6D, 0x70, \
647 0x9E, 0x02, 0xFC, 0xE1, 0xCD, 0xF7, 0xE2, 0xEC, \
648 0xC0, 0x34, 0x04, 0xCD, 0x28, 0x34, 0x2F, 0x61, \
649 0x91, 0x72, 0xFE, 0x9C, 0xE9, 0x85, 0x83, 0xFF, \
650 0x8E, 0x4F, 0x12, 0x32, 0xEE, 0xF2, 0x81, 0x83, \
651 0xC3, 0xFE, 0x3B, 0x1B, 0x4C, 0x6F, 0xAD, 0x73, \
652 0x3B, 0xB5, 0xFC, 0xBC, 0x2E, 0xC2, 0x20, 0x05, \
653 0xC5, 0x8E, 0xF1, 0x83, 0x7D, 0x16, 0x83, 0xB2, \
654 0xC6, 0xF3, 0x4A, 0x26, 0xC1, 0xB2, 0xEF, 0xFA, \
655 0x88, 0x6B, 0x42, 0x38, 0x61, 0x1F, 0xCF, 0xDC, \
656 0xDE, 0x35, 0x5B, 0x3B, 0x65, 0x19, 0x03, 0x5B, \
657 0xBC, 0x34, 0xF4, 0xDE, 0xF9, 0x9C, 0x02, 0x38, \
658 0x61, 0xB4, 0x6F, 0xC9, 0xD6, 0xE6, 0xC9, 0x07, \
659 0x7A, 0xD9, 0x1D, 0x26, 0x91, 0xF7, 0xF7, 0xEE, \
660 0x59, 0x8C, 0xB0, 0xFA, 0xC1, 0x86, 0xD9, 0x1C, \
661 0xAE, 0xFE, 0x13, 0x09, 0x85, 0x13, 0x92, 0x70, \
662 0xB4, 0x13, 0x0C, 0x93, 0xBC, 0x43, 0x79, 0x44, \
663 0xF4, 0xFD, 0x44, 0x52, 0xE2, 0xD7, 0x4D, 0xD3, \
664 0x64, 0xF2, 0xE2, 0x1E, 0x71, 0xF5, 0x4B, 0xFF, \
665 0x5C, 0xAE, 0x82, 0xAB, 0x9C, 0x9D, 0xF6, 0x9E, \
666 0xE8, 0x6D, 0x2B, 0xC5, 0x22, 0x36, 0x3A, 0x0D, \
667 0xAB, 0xC5, 0x21, 0x97, 0x9B, 0x0D, 0xEA, 0xDA, \
668 0x1D, 0xBF, 0x9A, 0x42, 0xD5, 0xC4, 0x48, 0x4E, \
669 0x0A, 0xBC, 0xD0, 0x6B, 0xFA, 0x53, 0xDD, 0xEF, \
670 0x3C, 0x1B, 0x20, 0xEE, 0x3F, 0xD5, 0x9D, 0x7C, \
671 0x25, 0xE4, 0x1D, 0x2B, 0x66, 0xC6, 0x2E, 0x37, \
672 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }
673
674#define MBEDTLS_DHM_RFC7919_FFDHE3072_G_BIN { 0x02 }
675
676#define MBEDTLS_DHM_RFC7919_FFDHE4096_P_BIN { \
677 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
678 0xAD, 0xF8, 0x54, 0x58, 0xA2, 0xBB, 0x4A, 0x9A, \
679 0xAF, 0xDC, 0x56, 0x20, 0x27, 0x3D, 0x3C, 0xF1, \
680 0xD8, 0xB9, 0xC5, 0x83, 0xCE, 0x2D, 0x36, 0x95, \
681 0xA9, 0xE1, 0x36, 0x41, 0x14, 0x64, 0x33, 0xFB, \
682 0xCC, 0x93, 0x9D, 0xCE, 0x24, 0x9B, 0x3E, 0xF9, \
683 0x7D, 0x2F, 0xE3, 0x63, 0x63, 0x0C, 0x75, 0xD8, \
684 0xF6, 0x81, 0xB2, 0x02, 0xAE, 0xC4, 0x61, 0x7A, \
685 0xD3, 0xDF, 0x1E, 0xD5, 0xD5, 0xFD, 0x65, 0x61, \
686 0x24, 0x33, 0xF5, 0x1F, 0x5F, 0x06, 0x6E, 0xD0, \
687 0x85, 0x63, 0x65, 0x55, 0x3D, 0xED, 0x1A, 0xF3, \
688 0xB5, 0x57, 0x13, 0x5E, 0x7F, 0x57, 0xC9, 0x35, \
689 0x98, 0x4F, 0x0C, 0x70, 0xE0, 0xE6, 0x8B, 0x77, \
690 0xE2, 0xA6, 0x89, 0xDA, 0xF3, 0xEF, 0xE8, 0x72, \
691 0x1D, 0xF1, 0x58, 0xA1, 0x36, 0xAD, 0xE7, 0x35, \
692 0x30, 0xAC, 0xCA, 0x4F, 0x48, 0x3A, 0x79, 0x7A, \
693 0xBC, 0x0A, 0xB1, 0x82, 0xB3, 0x24, 0xFB, 0x61, \
694 0xD1, 0x08, 0xA9, 0x4B, 0xB2, 0xC8, 0xE3, 0xFB, \
695 0xB9, 0x6A, 0xDA, 0xB7, 0x60, 0xD7, 0xF4, 0x68, \
696 0x1D, 0x4F, 0x42, 0xA3, 0xDE, 0x39, 0x4D, 0xF4, \
697 0xAE, 0x56, 0xED, 0xE7, 0x63, 0x72, 0xBB, 0x19, \
698 0x0B, 0x07, 0xA7, 0xC8, 0xEE, 0x0A, 0x6D, 0x70, \
699 0x9E, 0x02, 0xFC, 0xE1, 0xCD, 0xF7, 0xE2, 0xEC, \
700 0xC0, 0x34, 0x04, 0xCD, 0x28, 0x34, 0x2F, 0x61, \
701 0x91, 0x72, 0xFE, 0x9C, 0xE9, 0x85, 0x83, 0xFF, \
702 0x8E, 0x4F, 0x12, 0x32, 0xEE, 0xF2, 0x81, 0x83, \
703 0xC3, 0xFE, 0x3B, 0x1B, 0x4C, 0x6F, 0xAD, 0x73, \
704 0x3B, 0xB5, 0xFC, 0xBC, 0x2E, 0xC2, 0x20, 0x05, \
705 0xC5, 0x8E, 0xF1, 0x83, 0x7D, 0x16, 0x83, 0xB2, \
706 0xC6, 0xF3, 0x4A, 0x26, 0xC1, 0xB2, 0xEF, 0xFA, \
707 0x88, 0x6B, 0x42, 0x38, 0x61, 0x1F, 0xCF, 0xDC, \
708 0xDE, 0x35, 0x5B, 0x3B, 0x65, 0x19, 0x03, 0x5B, \
709 0xBC, 0x34, 0xF4, 0xDE, 0xF9, 0x9C, 0x02, 0x38, \
710 0x61, 0xB4, 0x6F, 0xC9, 0xD6, 0xE6, 0xC9, 0x07, \
711 0x7A, 0xD9, 0x1D, 0x26, 0x91, 0xF7, 0xF7, 0xEE, \
712 0x59, 0x8C, 0xB0, 0xFA, 0xC1, 0x86, 0xD9, 0x1C, \
713 0xAE, 0xFE, 0x13, 0x09, 0x85, 0x13, 0x92, 0x70, \
714 0xB4, 0x13, 0x0C, 0x93, 0xBC, 0x43, 0x79, 0x44, \
715 0xF4, 0xFD, 0x44, 0x52, 0xE2, 0xD7, 0x4D, 0xD3, \
716 0x64, 0xF2, 0xE2, 0x1E, 0x71, 0xF5, 0x4B, 0xFF, \
717 0x5C, 0xAE, 0x82, 0xAB, 0x9C, 0x9D, 0xF6, 0x9E, \
718 0xE8, 0x6D, 0x2B, 0xC5, 0x22, 0x36, 0x3A, 0x0D, \
719 0xAB, 0xC5, 0x21, 0x97, 0x9B, 0x0D, 0xEA, 0xDA, \
720 0x1D, 0xBF, 0x9A, 0x42, 0xD5, 0xC4, 0x48, 0x4E, \
721 0x0A, 0xBC, 0xD0, 0x6B, 0xFA, 0x53, 0xDD, 0xEF, \
722 0x3C, 0x1B, 0x20, 0xEE, 0x3F, 0xD5, 0x9D, 0x7C, \
723 0x25, 0xE4, 0x1D, 0x2B, 0x66, 0x9E, 0x1E, 0xF1, \
724 0x6E, 0x6F, 0x52, 0xC3, 0x16, 0x4D, 0xF4, 0xFB, \
725 0x79, 0x30, 0xE9, 0xE4, 0xE5, 0x88, 0x57, 0xB6, \
726 0xAC, 0x7D, 0x5F, 0x42, 0xD6, 0x9F, 0x6D, 0x18, \
727 0x77, 0x63, 0xCF, 0x1D, 0x55, 0x03, 0x40, 0x04, \
728 0x87, 0xF5, 0x5B, 0xA5, 0x7E, 0x31, 0xCC, 0x7A, \
729 0x71, 0x35, 0xC8, 0x86, 0xEF, 0xB4, 0x31, 0x8A, \
730 0xED, 0x6A, 0x1E, 0x01, 0x2D, 0x9E, 0x68, 0x32, \
731 0xA9, 0x07, 0x60, 0x0A, 0x91, 0x81, 0x30, 0xC4, \
732 0x6D, 0xC7, 0x78, 0xF9, 0x71, 0xAD, 0x00, 0x38, \
733 0x09, 0x29, 0x99, 0xA3, 0x33, 0xCB, 0x8B, 0x7A, \
734 0x1A, 0x1D, 0xB9, 0x3D, 0x71, 0x40, 0x00, 0x3C, \
735 0x2A, 0x4E, 0xCE, 0xA9, 0xF9, 0x8D, 0x0A, 0xCC, \
736 0x0A, 0x82, 0x91, 0xCD, 0xCE, 0xC9, 0x7D, 0xCF, \
737 0x8E, 0xC9, 0xB5, 0x5A, 0x7F, 0x88, 0xA4, 0x6B, \
738 0x4D, 0xB5, 0xA8, 0x51, 0xF4, 0x41, 0x82, 0xE1, \
739 0xC6, 0x8A, 0x00, 0x7E, 0x5E, 0x65, 0x5F, 0x6A, \
740 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }
741
742#define MBEDTLS_DHM_RFC7919_FFDHE4096_G_BIN { 0x02 }
743
744#define MBEDTLS_DHM_RFC7919_FFDHE6144_P_BIN { \
745 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
746 0xAD, 0xF8, 0x54, 0x58, 0xA2, 0xBB, 0x4A, 0x9A, \
747 0xAF, 0xDC, 0x56, 0x20, 0x27, 0x3D, 0x3C, 0xF1, \
748 0xD8, 0xB9, 0xC5, 0x83, 0xCE, 0x2D, 0x36, 0x95, \
749 0xA9, 0xE1, 0x36, 0x41, 0x14, 0x64, 0x33, 0xFB, \
750 0xCC, 0x93, 0x9D, 0xCE, 0x24, 0x9B, 0x3E, 0xF9, \
751 0x7D, 0x2F, 0xE3, 0x63, 0x63, 0x0C, 0x75, 0xD8, \
752 0xF6, 0x81, 0xB2, 0x02, 0xAE, 0xC4, 0x61, 0x7A, \
753 0xD3, 0xDF, 0x1E, 0xD5, 0xD5, 0xFD, 0x65, 0x61, \
754 0x24, 0x33, 0xF5, 0x1F, 0x5F, 0x06, 0x6E, 0xD0, \
755 0x85, 0x63, 0x65, 0x55, 0x3D, 0xED, 0x1A, 0xF3, \
756 0xB5, 0x57, 0x13, 0x5E, 0x7F, 0x57, 0xC9, 0x35, \
757 0x98, 0x4F, 0x0C, 0x70, 0xE0, 0xE6, 0x8B, 0x77, \
758 0xE2, 0xA6, 0x89, 0xDA, 0xF3, 0xEF, 0xE8, 0x72, \
759 0x1D, 0xF1, 0x58, 0xA1, 0x36, 0xAD, 0xE7, 0x35, \
760 0x30, 0xAC, 0xCA, 0x4F, 0x48, 0x3A, 0x79, 0x7A, \
761 0xBC, 0x0A, 0xB1, 0x82, 0xB3, 0x24, 0xFB, 0x61, \
762 0xD1, 0x08, 0xA9, 0x4B, 0xB2, 0xC8, 0xE3, 0xFB, \
763 0xB9, 0x6A, 0xDA, 0xB7, 0x60, 0xD7, 0xF4, 0x68, \
764 0x1D, 0x4F, 0x42, 0xA3, 0xDE, 0x39, 0x4D, 0xF4, \
765 0xAE, 0x56, 0xED, 0xE7, 0x63, 0x72, 0xBB, 0x19, \
766 0x0B, 0x07, 0xA7, 0xC8, 0xEE, 0x0A, 0x6D, 0x70, \
767 0x9E, 0x02, 0xFC, 0xE1, 0xCD, 0xF7, 0xE2, 0xEC, \
768 0xC0, 0x34, 0x04, 0xCD, 0x28, 0x34, 0x2F, 0x61, \
769 0x91, 0x72, 0xFE, 0x9C, 0xE9, 0x85, 0x83, 0xFF, \
770 0x8E, 0x4F, 0x12, 0x32, 0xEE, 0xF2, 0x81, 0x83, \
771 0xC3, 0xFE, 0x3B, 0x1B, 0x4C, 0x6F, 0xAD, 0x73, \
772 0x3B, 0xB5, 0xFC, 0xBC, 0x2E, 0xC2, 0x20, 0x05, \
773 0xC5, 0x8E, 0xF1, 0x83, 0x7D, 0x16, 0x83, 0xB2, \
774 0xC6, 0xF3, 0x4A, 0x26, 0xC1, 0xB2, 0xEF, 0xFA, \
775 0x88, 0x6B, 0x42, 0x38, 0x61, 0x1F, 0xCF, 0xDC, \
776 0xDE, 0x35, 0x5B, 0x3B, 0x65, 0x19, 0x03, 0x5B, \
777 0xBC, 0x34, 0xF4, 0xDE, 0xF9, 0x9C, 0x02, 0x38, \
778 0x61, 0xB4, 0x6F, 0xC9, 0xD6, 0xE6, 0xC9, 0x07, \
779 0x7A, 0xD9, 0x1D, 0x26, 0x91, 0xF7, 0xF7, 0xEE, \
780 0x59, 0x8C, 0xB0, 0xFA, 0xC1, 0x86, 0xD9, 0x1C, \
781 0xAE, 0xFE, 0x13, 0x09, 0x85, 0x13, 0x92, 0x70, \
782 0xB4, 0x13, 0x0C, 0x93, 0xBC, 0x43, 0x79, 0x44, \
783 0xF4, 0xFD, 0x44, 0x52, 0xE2, 0xD7, 0x4D, 0xD3, \
784 0x64, 0xF2, 0xE2, 0x1E, 0x71, 0xF5, 0x4B, 0xFF, \
785 0x5C, 0xAE, 0x82, 0xAB, 0x9C, 0x9D, 0xF6, 0x9E, \
786 0xE8, 0x6D, 0x2B, 0xC5, 0x22, 0x36, 0x3A, 0x0D, \
787 0xAB, 0xC5, 0x21, 0x97, 0x9B, 0x0D, 0xEA, 0xDA, \
788 0x1D, 0xBF, 0x9A, 0x42, 0xD5, 0xC4, 0x48, 0x4E, \
789 0x0A, 0xBC, 0xD0, 0x6B, 0xFA, 0x53, 0xDD, 0xEF, \
790 0x3C, 0x1B, 0x20, 0xEE, 0x3F, 0xD5, 0x9D, 0x7C, \
791 0x25, 0xE4, 0x1D, 0x2B, 0x66, 0x9E, 0x1E, 0xF1, \
792 0x6E, 0x6F, 0x52, 0xC3, 0x16, 0x4D, 0xF4, 0xFB, \
793 0x79, 0x30, 0xE9, 0xE4, 0xE5, 0x88, 0x57, 0xB6, \
794 0xAC, 0x7D, 0x5F, 0x42, 0xD6, 0x9F, 0x6D, 0x18, \
795 0x77, 0x63, 0xCF, 0x1D, 0x55, 0x03, 0x40, 0x04, \
796 0x87, 0xF5, 0x5B, 0xA5, 0x7E, 0x31, 0xCC, 0x7A, \
797 0x71, 0x35, 0xC8, 0x86, 0xEF, 0xB4, 0x31, 0x8A, \
798 0xED, 0x6A, 0x1E, 0x01, 0x2D, 0x9E, 0x68, 0x32, \
799 0xA9, 0x07, 0x60, 0x0A, 0x91, 0x81, 0x30, 0xC4, \
800 0x6D, 0xC7, 0x78, 0xF9, 0x71, 0xAD, 0x00, 0x38, \
801 0x09, 0x29, 0x99, 0xA3, 0x33, 0xCB, 0x8B, 0x7A, \
802 0x1A, 0x1D, 0xB9, 0x3D, 0x71, 0x40, 0x00, 0x3C, \
803 0x2A, 0x4E, 0xCE, 0xA9, 0xF9, 0x8D, 0x0A, 0xCC, \
804 0x0A, 0x82, 0x91, 0xCD, 0xCE, 0xC9, 0x7D, 0xCF, \
805 0x8E, 0xC9, 0xB5, 0x5A, 0x7F, 0x88, 0xA4, 0x6B, \
806 0x4D, 0xB5, 0xA8, 0x51, 0xF4, 0x41, 0x82, 0xE1, \
807 0xC6, 0x8A, 0x00, 0x7E, 0x5E, 0x0D, 0xD9, 0x02, \
808 0x0B, 0xFD, 0x64, 0xB6, 0x45, 0x03, 0x6C, 0x7A, \
809 0x4E, 0x67, 0x7D, 0x2C, 0x38, 0x53, 0x2A, 0x3A, \
810 0x23, 0xBA, 0x44, 0x42, 0xCA, 0xF5, 0x3E, 0xA6, \
811 0x3B, 0xB4, 0x54, 0x32, 0x9B, 0x76, 0x24, 0xC8, \
812 0x91, 0x7B, 0xDD, 0x64, 0xB1, 0xC0, 0xFD, 0x4C, \
813 0xB3, 0x8E, 0x8C, 0x33, 0x4C, 0x70, 0x1C, 0x3A, \
814 0xCD, 0xAD, 0x06, 0x57, 0xFC, 0xCF, 0xEC, 0x71, \
815 0x9B, 0x1F, 0x5C, 0x3E, 0x4E, 0x46, 0x04, 0x1F, \
816 0x38, 0x81, 0x47, 0xFB, 0x4C, 0xFD, 0xB4, 0x77, \
817 0xA5, 0x24, 0x71, 0xF7, 0xA9, 0xA9, 0x69, 0x10, \
818 0xB8, 0x55, 0x32, 0x2E, 0xDB, 0x63, 0x40, 0xD8, \
819 0xA0, 0x0E, 0xF0, 0x92, 0x35, 0x05, 0x11, 0xE3, \
820 0x0A, 0xBE, 0xC1, 0xFF, 0xF9, 0xE3, 0xA2, 0x6E, \
821 0x7F, 0xB2, 0x9F, 0x8C, 0x18, 0x30, 0x23, 0xC3, \
822 0x58, 0x7E, 0x38, 0xDA, 0x00, 0x77, 0xD9, 0xB4, \
823 0x76, 0x3E, 0x4E, 0x4B, 0x94, 0xB2, 0xBB, 0xC1, \
824 0x94, 0xC6, 0x65, 0x1E, 0x77, 0xCA, 0xF9, 0x92, \
825 0xEE, 0xAA, 0xC0, 0x23, 0x2A, 0x28, 0x1B, 0xF6, \
826 0xB3, 0xA7, 0x39, 0xC1, 0x22, 0x61, 0x16, 0x82, \
827 0x0A, 0xE8, 0xDB, 0x58, 0x47, 0xA6, 0x7C, 0xBE, \
828 0xF9, 0xC9, 0x09, 0x1B, 0x46, 0x2D, 0x53, 0x8C, \
829 0xD7, 0x2B, 0x03, 0x74, 0x6A, 0xE7, 0x7F, 0x5E, \
830 0x62, 0x29, 0x2C, 0x31, 0x15, 0x62, 0xA8, 0x46, \
831 0x50, 0x5D, 0xC8, 0x2D, 0xB8, 0x54, 0x33, 0x8A, \
832 0xE4, 0x9F, 0x52, 0x35, 0xC9, 0x5B, 0x91, 0x17, \
833 0x8C, 0xCF, 0x2D, 0xD5, 0xCA, 0xCE, 0xF4, 0x03, \
834 0xEC, 0x9D, 0x18, 0x10, 0xC6, 0x27, 0x2B, 0x04, \
835 0x5B, 0x3B, 0x71, 0xF9, 0xDC, 0x6B, 0x80, 0xD6, \
836 0x3F, 0xDD, 0x4A, 0x8E, 0x9A, 0xDB, 0x1E, 0x69, \
837 0x62, 0xA6, 0x95, 0x26, 0xD4, 0x31, 0x61, 0xC1, \
838 0xA4, 0x1D, 0x57, 0x0D, 0x79, 0x38, 0xDA, 0xD4, \
839 0xA4, 0x0E, 0x32, 0x9C, 0xD0, 0xE4, 0x0E, 0x65, \
840 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }
841
842#define MBEDTLS_DHM_RFC7919_FFDHE6144_G_BIN { 0x02 }
843
844#define MBEDTLS_DHM_RFC7919_FFDHE8192_P_BIN { \
845 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
846 0xAD, 0xF8, 0x54, 0x58, 0xA2, 0xBB, 0x4A, 0x9A, \
847 0xAF, 0xDC, 0x56, 0x20, 0x27, 0x3D, 0x3C, 0xF1, \
848 0xD8, 0xB9, 0xC5, 0x83, 0xCE, 0x2D, 0x36, 0x95, \
849 0xA9, 0xE1, 0x36, 0x41, 0x14, 0x64, 0x33, 0xFB, \
850 0xCC, 0x93, 0x9D, 0xCE, 0x24, 0x9B, 0x3E, 0xF9, \
851 0x7D, 0x2F, 0xE3, 0x63, 0x63, 0x0C, 0x75, 0xD8, \
852 0xF6, 0x81, 0xB2, 0x02, 0xAE, 0xC4, 0x61, 0x7A, \
853 0xD3, 0xDF, 0x1E, 0xD5, 0xD5, 0xFD, 0x65, 0x61, \
854 0x24, 0x33, 0xF5, 0x1F, 0x5F, 0x06, 0x6E, 0xD0, \
855 0x85, 0x63, 0x65, 0x55, 0x3D, 0xED, 0x1A, 0xF3, \
856 0xB5, 0x57, 0x13, 0x5E, 0x7F, 0x57, 0xC9, 0x35, \
857 0x98, 0x4F, 0x0C, 0x70, 0xE0, 0xE6, 0x8B, 0x77, \
858 0xE2, 0xA6, 0x89, 0xDA, 0xF3, 0xEF, 0xE8, 0x72, \
859 0x1D, 0xF1, 0x58, 0xA1, 0x36, 0xAD, 0xE7, 0x35, \
860 0x30, 0xAC, 0xCA, 0x4F, 0x48, 0x3A, 0x79, 0x7A, \
861 0xBC, 0x0A, 0xB1, 0x82, 0xB3, 0x24, 0xFB, 0x61, \
862 0xD1, 0x08, 0xA9, 0x4B, 0xB2, 0xC8, 0xE3, 0xFB, \
863 0xB9, 0x6A, 0xDA, 0xB7, 0x60, 0xD7, 0xF4, 0x68, \
864 0x1D, 0x4F, 0x42, 0xA3, 0xDE, 0x39, 0x4D, 0xF4, \
865 0xAE, 0x56, 0xED, 0xE7, 0x63, 0x72, 0xBB, 0x19, \
866 0x0B, 0x07, 0xA7, 0xC8, 0xEE, 0x0A, 0x6D, 0x70, \
867 0x9E, 0x02, 0xFC, 0xE1, 0xCD, 0xF7, 0xE2, 0xEC, \
868 0xC0, 0x34, 0x04, 0xCD, 0x28, 0x34, 0x2F, 0x61, \
869 0x91, 0x72, 0xFE, 0x9C, 0xE9, 0x85, 0x83, 0xFF, \
870 0x8E, 0x4F, 0x12, 0x32, 0xEE, 0xF2, 0x81, 0x83, \
871 0xC3, 0xFE, 0x3B, 0x1B, 0x4C, 0x6F, 0xAD, 0x73, \
872 0x3B, 0xB5, 0xFC, 0xBC, 0x2E, 0xC2, 0x20, 0x05, \
873 0xC5, 0x8E, 0xF1, 0x83, 0x7D, 0x16, 0x83, 0xB2, \
874 0xC6, 0xF3, 0x4A, 0x26, 0xC1, 0xB2, 0xEF, 0xFA, \
875 0x88, 0x6B, 0x42, 0x38, 0x61, 0x1F, 0xCF, 0xDC, \
876 0xDE, 0x35, 0x5B, 0x3B, 0x65, 0x19, 0x03, 0x5B, \
877 0xBC, 0x34, 0xF4, 0xDE, 0xF9, 0x9C, 0x02, 0x38, \
878 0x61, 0xB4, 0x6F, 0xC9, 0xD6, 0xE6, 0xC9, 0x07, \
879 0x7A, 0xD9, 0x1D, 0x26, 0x91, 0xF7, 0xF7, 0xEE, \
880 0x59, 0x8C, 0xB0, 0xFA, 0xC1, 0x86, 0xD9, 0x1C, \
881 0xAE, 0xFE, 0x13, 0x09, 0x85, 0x13, 0x92, 0x70, \
882 0xB4, 0x13, 0x0C, 0x93, 0xBC, 0x43, 0x79, 0x44, \
883 0xF4, 0xFD, 0x44, 0x52, 0xE2, 0xD7, 0x4D, 0xD3, \
884 0x64, 0xF2, 0xE2, 0x1E, 0x71, 0xF5, 0x4B, 0xFF, \
885 0x5C, 0xAE, 0x82, 0xAB, 0x9C, 0x9D, 0xF6, 0x9E, \
886 0xE8, 0x6D, 0x2B, 0xC5, 0x22, 0x36, 0x3A, 0x0D, \
887 0xAB, 0xC5, 0x21, 0x97, 0x9B, 0x0D, 0xEA, 0xDA, \
888 0x1D, 0xBF, 0x9A, 0x42, 0xD5, 0xC4, 0x48, 0x4E, \
889 0x0A, 0xBC, 0xD0, 0x6B, 0xFA, 0x53, 0xDD, 0xEF, \
890 0x3C, 0x1B, 0x20, 0xEE, 0x3F, 0xD5, 0x9D, 0x7C, \
891 0x25, 0xE4, 0x1D, 0x2B, 0x66, 0x9E, 0x1E, 0xF1, \
892 0x6E, 0x6F, 0x52, 0xC3, 0x16, 0x4D, 0xF4, 0xFB, \
893 0x79, 0x30, 0xE9, 0xE4, 0xE5, 0x88, 0x57, 0xB6, \
894 0xAC, 0x7D, 0x5F, 0x42, 0xD6, 0x9F, 0x6D, 0x18, \
895 0x77, 0x63, 0xCF, 0x1D, 0x55, 0x03, 0x40, 0x04, \
896 0x87, 0xF5, 0x5B, 0xA5, 0x7E, 0x31, 0xCC, 0x7A, \
897 0x71, 0x35, 0xC8, 0x86, 0xEF, 0xB4, 0x31, 0x8A, \
898 0xED, 0x6A, 0x1E, 0x01, 0x2D, 0x9E, 0x68, 0x32, \
899 0xA9, 0x07, 0x60, 0x0A, 0x91, 0x81, 0x30, 0xC4, \
900 0x6D, 0xC7, 0x78, 0xF9, 0x71, 0xAD, 0x00, 0x38, \
901 0x09, 0x29, 0x99, 0xA3, 0x33, 0xCB, 0x8B, 0x7A, \
902 0x1A, 0x1D, 0xB9, 0x3D, 0x71, 0x40, 0x00, 0x3C, \
903 0x2A, 0x4E, 0xCE, 0xA9, 0xF9, 0x8D, 0x0A, 0xCC, \
904 0x0A, 0x82, 0x91, 0xCD, 0xCE, 0xC9, 0x7D, 0xCF, \
905 0x8E, 0xC9, 0xB5, 0x5A, 0x7F, 0x88, 0xA4, 0x6B, \
906 0x4D, 0xB5, 0xA8, 0x51, 0xF4, 0x41, 0x82, 0xE1, \
907 0xC6, 0x8A, 0x00, 0x7E, 0x5E, 0x0D, 0xD9, 0x02, \
908 0x0B, 0xFD, 0x64, 0xB6, 0x45, 0x03, 0x6C, 0x7A, \
909 0x4E, 0x67, 0x7D, 0x2C, 0x38, 0x53, 0x2A, 0x3A, \
910 0x23, 0xBA, 0x44, 0x42, 0xCA, 0xF5, 0x3E, 0xA6, \
911 0x3B, 0xB4, 0x54, 0x32, 0x9B, 0x76, 0x24, 0xC8, \
912 0x91, 0x7B, 0xDD, 0x64, 0xB1, 0xC0, 0xFD, 0x4C, \
913 0xB3, 0x8E, 0x8C, 0x33, 0x4C, 0x70, 0x1C, 0x3A, \
914 0xCD, 0xAD, 0x06, 0x57, 0xFC, 0xCF, 0xEC, 0x71, \
915 0x9B, 0x1F, 0x5C, 0x3E, 0x4E, 0x46, 0x04, 0x1F, \
916 0x38, 0x81, 0x47, 0xFB, 0x4C, 0xFD, 0xB4, 0x77, \
917 0xA5, 0x24, 0x71, 0xF7, 0xA9, 0xA9, 0x69, 0x10, \
918 0xB8, 0x55, 0x32, 0x2E, 0xDB, 0x63, 0x40, 0xD8, \
919 0xA0, 0x0E, 0xF0, 0x92, 0x35, 0x05, 0x11, 0xE3, \
920 0x0A, 0xBE, 0xC1, 0xFF, 0xF9, 0xE3, 0xA2, 0x6E, \
921 0x7F, 0xB2, 0x9F, 0x8C, 0x18, 0x30, 0x23, 0xC3, \
922 0x58, 0x7E, 0x38, 0xDA, 0x00, 0x77, 0xD9, 0xB4, \
923 0x76, 0x3E, 0x4E, 0x4B, 0x94, 0xB2, 0xBB, 0xC1, \
924 0x94, 0xC6, 0x65, 0x1E, 0x77, 0xCA, 0xF9, 0x92, \
925 0xEE, 0xAA, 0xC0, 0x23, 0x2A, 0x28, 0x1B, 0xF6, \
926 0xB3, 0xA7, 0x39, 0xC1, 0x22, 0x61, 0x16, 0x82, \
927 0x0A, 0xE8, 0xDB, 0x58, 0x47, 0xA6, 0x7C, 0xBE, \
928 0xF9, 0xC9, 0x09, 0x1B, 0x46, 0x2D, 0x53, 0x8C, \
929 0xD7, 0x2B, 0x03, 0x74, 0x6A, 0xE7, 0x7F, 0x5E, \
930 0x62, 0x29, 0x2C, 0x31, 0x15, 0x62, 0xA8, 0x46, \
931 0x50, 0x5D, 0xC8, 0x2D, 0xB8, 0x54, 0x33, 0x8A, \
932 0xE4, 0x9F, 0x52, 0x35, 0xC9, 0x5B, 0x91, 0x17, \
933 0x8C, 0xCF, 0x2D, 0xD5, 0xCA, 0xCE, 0xF4, 0x03, \
934 0xEC, 0x9D, 0x18, 0x10, 0xC6, 0x27, 0x2B, 0x04, \
935 0x5B, 0x3B, 0x71, 0xF9, 0xDC, 0x6B, 0x80, 0xD6, \
936 0x3F, 0xDD, 0x4A, 0x8E, 0x9A, 0xDB, 0x1E, 0x69, \
937 0x62, 0xA6, 0x95, 0x26, 0xD4, 0x31, 0x61, 0xC1, \
938 0xA4, 0x1D, 0x57, 0x0D, 0x79, 0x38, 0xDA, 0xD4, \
939 0xA4, 0x0E, 0x32, 0x9C, 0xCF, 0xF4, 0x6A, 0xAA, \
940 0x36, 0xAD, 0x00, 0x4C, 0xF6, 0x00, 0xC8, 0x38, \
941 0x1E, 0x42, 0x5A, 0x31, 0xD9, 0x51, 0xAE, 0x64, \
942 0xFD, 0xB2, 0x3F, 0xCE, 0xC9, 0x50, 0x9D, 0x43, \
943 0x68, 0x7F, 0xEB, 0x69, 0xED, 0xD1, 0xCC, 0x5E, \
944 0x0B, 0x8C, 0xC3, 0xBD, 0xF6, 0x4B, 0x10, 0xEF, \
945 0x86, 0xB6, 0x31, 0x42, 0xA3, 0xAB, 0x88, 0x29, \
946 0x55, 0x5B, 0x2F, 0x74, 0x7C, 0x93, 0x26, 0x65, \
947 0xCB, 0x2C, 0x0F, 0x1C, 0xC0, 0x1B, 0xD7, 0x02, \
948 0x29, 0x38, 0x88, 0x39, 0xD2, 0xAF, 0x05, 0xE4, \
949 0x54, 0x50, 0x4A, 0xC7, 0x8B, 0x75, 0x82, 0x82, \
950 0x28, 0x46, 0xC0, 0xBA, 0x35, 0xC3, 0x5F, 0x5C, \
951 0x59, 0x16, 0x0C, 0xC0, 0x46, 0xFD, 0x82, 0x51, \
952 0x54, 0x1F, 0xC6, 0x8C, 0x9C, 0x86, 0xB0, 0x22, \
953 0xBB, 0x70, 0x99, 0x87, 0x6A, 0x46, 0x0E, 0x74, \
954 0x51, 0xA8, 0xA9, 0x31, 0x09, 0x70, 0x3F, 0xEE, \
955 0x1C, 0x21, 0x7E, 0x6C, 0x38, 0x26, 0xE5, 0x2C, \
956 0x51, 0xAA, 0x69, 0x1E, 0x0E, 0x42, 0x3C, 0xFC, \
957 0x99, 0xE9, 0xE3, 0x16, 0x50, 0xC1, 0x21, 0x7B, \
958 0x62, 0x48, 0x16, 0xCD, 0xAD, 0x9A, 0x95, 0xF9, \
959 0xD5, 0xB8, 0x01, 0x94, 0x88, 0xD9, 0xC0, 0xA0, \
960 0xA1, 0xFE, 0x30, 0x75, 0xA5, 0x77, 0xE2, 0x31, \
961 0x83, 0xF8, 0x1D, 0x4A, 0x3F, 0x2F, 0xA4, 0x57, \
962 0x1E, 0xFC, 0x8C, 0xE0, 0xBA, 0x8A, 0x4F, 0xE8, \
963 0xB6, 0x85, 0x5D, 0xFE, 0x72, 0xB0, 0xA6, 0x6E, \
964 0xDE, 0xD2, 0xFB, 0xAB, 0xFB, 0xE5, 0x8A, 0x30, \
965 0xFA, 0xFA, 0xBE, 0x1C, 0x5D, 0x71, 0xA8, 0x7E, \
966 0x2F, 0x74, 0x1E, 0xF8, 0xC1, 0xFE, 0x86, 0xFE, \
967 0xA6, 0xBB, 0xFD, 0xE5, 0x30, 0x67, 0x7F, 0x0D, \
968 0x97, 0xD1, 0x1D, 0x49, 0xF7, 0xA8, 0x44, 0x3D, \
969 0x08, 0x22, 0xE5, 0x06, 0xA9, 0xF4, 0x61, 0x4E, \
970 0x01, 0x1E, 0x2A, 0x94, 0x83, 0x8F, 0xF8, 0x8C, \
971 0xD6, 0x8C, 0x8B, 0xB7, 0xC5, 0xC6, 0x42, 0x4C, \
972 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }
973
974#define MBEDTLS_DHM_RFC7919_FFDHE8192_G_BIN { 0x02 }
975
Paul Bakker9af723c2014-05-01 13:03:14 +0200976#endif /* dhm.h */