2009-01-03 21:22:43 +00:00
|
|
|
/**
|
|
|
|
* \file dhm.h
|
2009-01-04 16:27:10 +00:00
|
|
|
*
|
2011-01-06 12:28:03 +00:00
|
|
|
* \brief Diffie-Hellman-Merkle key exchange
|
|
|
|
*
|
2015-07-27 09:11:48 +00:00
|
|
|
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
|
2015-09-04 12:21:07 +00:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2010-07-18 20:36:00 +00:00
|
|
|
*
|
2015-09-04 12:21:07 +00:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
|
|
* not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2010-07-18 20:36:00 +00:00
|
|
|
*
|
2015-09-04 12:21:07 +00:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2009-01-04 16:27:10 +00:00
|
|
|
*
|
2015-09-04 12:21:07 +00:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
2009-01-04 16:27:10 +00:00
|
|
|
*
|
2015-09-04 12:21:07 +00:00
|
|
|
* This file is part of mbed TLS (https://tls.mbed.org)
|
2017-09-28 09:33:29 +00:00
|
|
|
*
|
|
|
|
* \warning The security of the DHM key exchange relies on the proper choice
|
|
|
|
* of prime modulus - optimally, it should be a safe prime. The usage
|
|
|
|
* of non-safe primes both decreases the difficulty of the underlying
|
|
|
|
* discrete logarithm problem and can lead to small subgroup attacks
|
|
|
|
* leaking private exponent bits when invalid public keys are used
|
|
|
|
* and not detected. This is especially relevant if the same DHM parameters
|
|
|
|
* are reused for multiple key exchanges as in static DHM, while the
|
|
|
|
* criticality of small-subgroup attacks is lower for ephemeral DHM.
|
|
|
|
*
|
|
|
|
* For performance reasons, the code does neither perform primality
|
|
|
|
* nor safe primality tests, nor the expensive checks for invalid
|
|
|
|
* subgroups.
|
|
|
|
*
|
|
|
|
* The possibility for the use of custom, non-safe primes in DHM
|
|
|
|
* is a deficiency in the TLS protocol that has been adressed only
|
|
|
|
* recently through the addition of the named group extension from
|
|
|
|
* RFC 7919, which however is not yet implemented in Mbed TLS.
|
|
|
|
*
|
|
|
|
* If possible, we recommend to use elliptic curve based key
|
|
|
|
* exchanges instead of DHM-based ones, because the former only
|
|
|
|
* accepts standardized groups.
|
|
|
|
*
|
2009-01-03 21:22:43 +00:00
|
|
|
*/
|
2015-04-08 10:49:31 +00:00
|
|
|
#ifndef MBEDTLS_DHM_H
|
|
|
|
#define MBEDTLS_DHM_H
|
2009-01-03 21:22:43 +00:00
|
|
|
|
2011-08-15 09:07:52 +00:00
|
|
|
#include "bignum.h"
|
2009-01-03 21:22:43 +00:00
|
|
|
|
2011-01-27 15:24:17 +00:00
|
|
|
/*
|
|
|
|
* DHM Error codes
|
|
|
|
*/
|
2015-04-08 10:49:31 +00:00
|
|
|
#define MBEDTLS_ERR_DHM_BAD_INPUT_DATA -0x3080 /**< Bad input parameters to function. */
|
|
|
|
#define MBEDTLS_ERR_DHM_READ_PARAMS_FAILED -0x3100 /**< Reading of the DHM parameters failed. */
|
|
|
|
#define MBEDTLS_ERR_DHM_MAKE_PARAMS_FAILED -0x3180 /**< Making of the DHM parameters failed. */
|
|
|
|
#define MBEDTLS_ERR_DHM_READ_PUBLIC_FAILED -0x3200 /**< Reading of the public values failed. */
|
|
|
|
#define MBEDTLS_ERR_DHM_MAKE_PUBLIC_FAILED -0x3280 /**< Making of the public value failed. */
|
|
|
|
#define MBEDTLS_ERR_DHM_CALC_SECRET_FAILED -0x3300 /**< Calculation of the DHM secret failed. */
|
|
|
|
#define MBEDTLS_ERR_DHM_INVALID_FORMAT -0x3380 /**< The ASN.1 data is not formatted correctly. */
|
2015-05-28 07:33:39 +00:00
|
|
|
#define MBEDTLS_ERR_DHM_ALLOC_FAILED -0x3400 /**< Allocation of memory failed. */
|
2015-04-08 10:49:31 +00:00
|
|
|
#define MBEDTLS_ERR_DHM_FILE_IO_ERROR -0x3480 /**< Read/write of file failed. */
|
2009-01-03 21:22:43 +00:00
|
|
|
|
2017-09-27 10:48:02 +00:00
|
|
|
#if ! defined(MBEDTLS_DEPRECATED_REMOVED)
|
|
|
|
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
|
|
|
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
|
|
|
#else
|
|
|
|
#define MBEDTLS_DEPRECATED
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2012-09-25 09:36:44 +00:00
|
|
|
/**
|
2017-09-27 10:49:31 +00:00
|
|
|
* RFC 3526, RFC 5114 and RFC 7919 standardize a number of
|
|
|
|
* Diffie-Hellman groups, some of which are included here
|
|
|
|
* for use within the SSL/TLS module and the user's convenience
|
|
|
|
* when configuring the Diffie-Hellman parameters by hand
|
|
|
|
* through \c mbedtls_ssl_conf_dh_param.
|
2012-09-25 09:36:44 +00:00
|
|
|
*
|
|
|
|
* Included are:
|
2017-09-27 10:49:31 +00:00
|
|
|
* RFC 5114 2.2. 2048-bit MODP Group with 224-bit Prime Order Subgroup
|
2012-09-28 07:18:17 +00:00
|
|
|
* RFC 3526 3. 2048-bit MODP Group
|
|
|
|
* RFC 3526 4. 3072-bit MODP Group
|
2015-07-03 15:06:39 +00:00
|
|
|
* RFC 3526 5. 4096-bit MODP Group
|
2017-09-27 10:49:31 +00:00
|
|
|
* RFC 7919 A.1 ffdhe2048
|
|
|
|
* RFC 7919 A.2 ffdhe3072
|
|
|
|
* RFC 7919 A.3 ffdhe4096
|
|
|
|
* RFC 7919 A.4 ffdhe6144
|
|
|
|
* RFC 7919 A.5 ffdhe8192
|
|
|
|
*
|
2017-09-27 10:48:02 +00:00
|
|
|
* The constants with suffix "_p" denote the chosen prime moduli, while
|
|
|
|
* the constants with suffix "_g" denote the chosen generator
|
|
|
|
* of the associated prime field.
|
|
|
|
*
|
|
|
|
* All constants are represented as null-terminated strings containing the
|
|
|
|
* hexadecimal presentation of the respective numbers.
|
|
|
|
*
|
|
|
|
* \warning The origin of the primes in RFC 5114 is not documented and
|
|
|
|
* their use therefore constitutes a security risk!
|
|
|
|
*
|
|
|
|
* \deprecated The primes from RFC 5114 are superseded by the primes
|
|
|
|
* from RFC 3526 and RFC 7919 and should no longer be used.
|
|
|
|
* They will be removed in the next major revision.
|
2017-09-27 11:42:59 +00:00
|
|
|
*
|
|
|
|
* The primes from RFC 3526 and RFC 7919 have been generating by the following
|
|
|
|
* trust-worthy procedure:
|
|
|
|
* - Fix N in { 2048, 3072, 4096, 6144, 8192 } and consider the N-bit number
|
|
|
|
* the first and last 64 bits are all 1, and the remaining N - 128 bits of
|
|
|
|
* which are 0x7ff...ff.
|
|
|
|
* - Add the smallest multiple of the first N - 129 bits of the binary expansion
|
|
|
|
* of pi (for RFC 5236) or e (for RFC 7919) to this intermediate bit-string
|
|
|
|
* such that the resulting integer is a safe-prime.
|
|
|
|
* - The result is the respective RFC 3526 / 7919 prime, and the corresponding
|
|
|
|
* generator is always chosen to be 2 (which is a square for these prime,
|
|
|
|
* hence the corresponding subgroup has order (p-1)/2 and avoids leaking a
|
|
|
|
* bit in the private exponent).
|
|
|
|
*
|
|
|
|
* The above description can be validated using the
|
|
|
|
* the program programs/util/rfc_3526_7919_verify.
|
2012-09-25 09:36:44 +00:00
|
|
|
*/
|
2012-09-28 07:18:17 +00:00
|
|
|
|
2017-09-27 15:06:22 +00:00
|
|
|
const char * const mbedtls_dhm_rfc3526_modp_2048_p;
|
|
|
|
const char * const mbedtls_dhm_rfc3526_modp_2048_g;
|
|
|
|
const char * const mbedtls_dhm_rfc3526_modp_3072_p;
|
|
|
|
const char * const mbedtls_dhm_rfc3526_modp_3072_g;
|
|
|
|
const char * const mbedtls_dhm_rfc3526_modp_4096_p;
|
|
|
|
const char * const mbedtls_dhm_rfc3526_modp_4096_g;
|
2012-09-28 07:18:17 +00:00
|
|
|
|
2017-09-27 15:06:22 +00:00
|
|
|
const char * const mbedtls_dhm_rfc7919_ffdhe2048_p;
|
|
|
|
const char * const mbedtls_dhm_rfc7919_ffdhe2048_g;
|
|
|
|
const char * const mbedtls_dhm_rfc7919_ffdhe3072_p;
|
|
|
|
const char * const mbedtls_dhm_rfc7919_ffdhe3072_g;
|
|
|
|
const char * const mbedtls_dhm_rfc7919_ffdhe4096_p;
|
|
|
|
const char * const mbedtls_dhm_rfc7919_ffdhe4096_g;
|
|
|
|
const char * const mbedtls_dhm_rfc7919_ffdhe6144_p;
|
|
|
|
const char * const mbedtls_dhm_rfc7919_ffdhe6144_g;
|
|
|
|
const char * const mbedtls_dhm_rfc7919_ffdhe8192_p;
|
|
|
|
const char * const mbedtls_dhm_rfc7919_ffdhe8192_g;
|
2012-09-28 07:18:17 +00:00
|
|
|
|
2017-09-27 10:48:02 +00:00
|
|
|
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
2017-09-27 15:06:22 +00:00
|
|
|
MBEDTLS_DEPRECATED const char * const mbedtls_dhm_rfc5114_modp_2048_p;
|
|
|
|
MBEDTLS_DEPRECATED const char * const mbedtls_dhm_rfc5114_modp_2048_g;
|
2017-09-27 10:48:02 +00:00
|
|
|
#endif
|
2012-09-25 09:36:44 +00:00
|
|
|
|
2017-09-27 10:48:02 +00:00
|
|
|
/**
|
|
|
|
* \deprecated These macros are superseded by direct access to the corresponding
|
|
|
|
* global variables and will be removed in the next major revision.
|
|
|
|
*/
|
|
|
|
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
|
|
|
#define MBEDTLS_DHM_RFC5114_MODP_2048_P mbedtls_dhm_rfc5114_modp_2048_p
|
|
|
|
#define MBEDTLS_DHM_RFC5114_MODP_2048_G mbedtls_dhm_rfc5114_modp_2048_g
|
|
|
|
#define MBEDTLS_DHM_RFC3526_MODP_2048_P mbedtls_dhm_rfc3526_modp_2048_p
|
|
|
|
#define MBEDTLS_DHM_RFC3526_MODP_2048_G mbedtls_dhm_rfc3526_modp_2048_g
|
|
|
|
#define MBEDTLS_DHM_RFC3526_MODP_3072_P mbedtls_dhm_rfc3526_modp_3072_p
|
|
|
|
#define MBEDTLS_DHM_RFC3526_MODP_3072_G mbedtls_dhm_rfc3526_modp_3072_g
|
|
|
|
#define MBEDTLS_DHM_RFC3526_MODP_4096_P mbedtls_dhm_rfc3526_modp_4096_p
|
|
|
|
#define MBEDTLS_DHM_RFC3526_MODP_4096_G mbedtls_dhm_rfc3526_modp_4096_g
|
|
|
|
#endif
|
2012-09-25 09:36:44 +00:00
|
|
|
|
2013-06-27 12:29:21 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2011-01-27 15:24:17 +00:00
|
|
|
/**
|
|
|
|
* \brief DHM context structure
|
|
|
|
*/
|
2009-01-03 21:22:43 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2011-04-24 08:57:21 +00:00
|
|
|
size_t len; /*!< size(P) in chars */
|
2015-04-08 10:49:31 +00:00
|
|
|
mbedtls_mpi P; /*!< prime modulus */
|
|
|
|
mbedtls_mpi G; /*!< generator */
|
|
|
|
mbedtls_mpi X; /*!< secret value */
|
|
|
|
mbedtls_mpi GX; /*!< self = G^X mod P */
|
|
|
|
mbedtls_mpi GY; /*!< peer = G^Y mod P */
|
|
|
|
mbedtls_mpi K; /*!< key = GY^X mod P */
|
|
|
|
mbedtls_mpi RP; /*!< cached R^2 mod P */
|
|
|
|
mbedtls_mpi Vi; /*!< blinding value */
|
|
|
|
mbedtls_mpi Vf; /*!< un-blinding value */
|
|
|
|
mbedtls_mpi pX; /*!< previous X */
|
2009-01-03 21:22:43 +00:00
|
|
|
}
|
2015-04-08 10:49:31 +00:00
|
|
|
mbedtls_dhm_context;
|
2009-01-03 21:22:43 +00:00
|
|
|
|
2014-06-20 11:32:38 +00:00
|
|
|
/**
|
|
|
|
* \brief Initialize DHM context
|
|
|
|
*
|
|
|
|
* \param ctx DHM context to be initialized
|
|
|
|
*/
|
2015-04-08 10:49:31 +00:00
|
|
|
void mbedtls_dhm_init( mbedtls_dhm_context *ctx );
|
2014-06-20 11:32:38 +00:00
|
|
|
|
2009-01-03 21:22:43 +00:00
|
|
|
/**
|
|
|
|
* \brief Parse the ServerKeyExchange parameters
|
|
|
|
*
|
|
|
|
* \param ctx DHM context
|
2017-10-02 14:09:14 +00:00
|
|
|
* \param p On input, *p must be the start of the input buffer.
|
|
|
|
* On output, *p is updated to point to the end of the data
|
|
|
|
* that has been read. On success, this is the first byte
|
|
|
|
* past the end of the ServerKeyExchange parameters.
|
|
|
|
* On error, this is the point at which an error has been
|
|
|
|
* detected, which is usually not useful except to debug
|
|
|
|
* failures.
|
2009-01-03 21:22:43 +00:00
|
|
|
* \param end end of buffer
|
|
|
|
*
|
2015-04-08 10:49:31 +00:00
|
|
|
* \return 0 if successful, or an MBEDTLS_ERR_DHM_XXX error code
|
2009-01-03 21:22:43 +00:00
|
|
|
*/
|
2015-04-08 10:49:31 +00:00
|
|
|
int mbedtls_dhm_read_params( mbedtls_dhm_context *ctx,
|
2009-01-03 21:22:43 +00:00
|
|
|
unsigned char **p,
|
2010-03-16 21:09:09 +00:00
|
|
|
const unsigned char *end );
|
2009-01-03 21:22:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Setup and write the ServerKeyExchange parameters
|
|
|
|
*
|
|
|
|
* \param ctx DHM context
|
2010-07-18 09:45:05 +00:00
|
|
|
* \param x_size private value size in bytes
|
2009-01-03 21:22:43 +00:00
|
|
|
* \param output destination buffer
|
|
|
|
* \param olen number of chars written
|
|
|
|
* \param f_rng RNG function
|
|
|
|
* \param p_rng RNG parameter
|
|
|
|
*
|
2017-09-28 09:33:11 +00:00
|
|
|
* \note The destination buffer must be large enough to hold
|
2017-10-02 14:02:59 +00:00
|
|
|
* the reduced binary presentation of the modulus, the generator
|
|
|
|
* and the public key, each wrapped with a 2-byte length field.
|
|
|
|
* It is the responsibility of the caller to ensure that enough
|
|
|
|
* space is available. Refer to \c mbedtls_mpi_size to computing
|
|
|
|
* the byte-size of an MPI.
|
2017-09-28 09:33:11 +00:00
|
|
|
*
|
2009-01-03 21:22:43 +00:00
|
|
|
* \note This function assumes that ctx->P and ctx->G
|
|
|
|
* have already been properly set (for example
|
2015-04-08 10:49:31 +00:00
|
|
|
* using mbedtls_mpi_read_string or mbedtls_mpi_read_binary).
|
2009-01-03 21:22:43 +00:00
|
|
|
*
|
2015-04-08 10:49:31 +00:00
|
|
|
* \return 0 if successful, or an MBEDTLS_ERR_DHM_XXX error code
|
2009-01-03 21:22:43 +00:00
|
|
|
*/
|
2015-04-08 10:49:31 +00:00
|
|
|
int mbedtls_dhm_make_params( mbedtls_dhm_context *ctx, int x_size,
|
2011-04-24 08:57:21 +00:00
|
|
|
unsigned char *output, size_t *olen,
|
2011-11-27 21:07:34 +00:00
|
|
|
int (*f_rng)(void *, unsigned char *, size_t),
|
|
|
|
void *p_rng );
|
2009-01-03 21:22:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Import the peer's public value G^Y
|
|
|
|
*
|
|
|
|
* \param ctx DHM context
|
|
|
|
* \param input input buffer
|
|
|
|
* \param ilen size of buffer
|
|
|
|
*
|
2015-04-08 10:49:31 +00:00
|
|
|
* \return 0 if successful, or an MBEDTLS_ERR_DHM_XXX error code
|
2009-01-03 21:22:43 +00:00
|
|
|
*/
|
2015-04-08 10:49:31 +00:00
|
|
|
int mbedtls_dhm_read_public( mbedtls_dhm_context *ctx,
|
2011-04-24 08:57:21 +00:00
|
|
|
const unsigned char *input, size_t ilen );
|
2009-01-03 21:22:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Create own private value X and export G^X
|
|
|
|
*
|
|
|
|
* \param ctx DHM context
|
2012-04-20 13:42:02 +00:00
|
|
|
* \param x_size private value size in bytes
|
2009-01-03 21:22:43 +00:00
|
|
|
* \param output destination buffer
|
2017-09-28 09:33:11 +00:00
|
|
|
* \param olen size of the destination buffer;
|
|
|
|
* must be at least equal to the size of P, ctx->len
|
2009-01-03 21:22:43 +00:00
|
|
|
* \param f_rng RNG function
|
|
|
|
* \param p_rng RNG parameter
|
|
|
|
*
|
2017-09-28 09:33:11 +00:00
|
|
|
* \note The destination buffer will always be fully written
|
|
|
|
* so as to contain a big-endian presentation of G^X mod P.
|
|
|
|
* If it is larger than ctx->len, it will accordingly be
|
|
|
|
* padded with zero-bytes in the beginning.
|
|
|
|
*
|
2015-04-08 10:49:31 +00:00
|
|
|
* \return 0 if successful, or an MBEDTLS_ERR_DHM_XXX error code
|
2009-01-03 21:22:43 +00:00
|
|
|
*/
|
2015-04-08 10:49:31 +00:00
|
|
|
int mbedtls_dhm_make_public( mbedtls_dhm_context *ctx, int x_size,
|
2011-04-24 08:57:21 +00:00
|
|
|
unsigned char *output, size_t olen,
|
2011-11-27 21:07:34 +00:00
|
|
|
int (*f_rng)(void *, unsigned char *, size_t),
|
|
|
|
void *p_rng );
|
2009-01-03 21:22:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Derive and export the shared secret (G^Y)^X mod P
|
|
|
|
*
|
|
|
|
* \param ctx DHM context
|
|
|
|
* \param output destination buffer
|
2017-09-28 09:33:11 +00:00
|
|
|
* \param output_size size of the destination buffer, must be at
|
|
|
|
* at least the size of ctx->len
|
2015-06-02 15:17:08 +00:00
|
|
|
* \param olen on exit, holds the actual number of bytes written
|
2013-09-04 12:22:07 +00:00
|
|
|
* \param f_rng RNG function, for blinding purposes
|
|
|
|
* \param p_rng RNG parameter
|
2009-01-03 21:22:43 +00:00
|
|
|
*
|
2015-04-08 10:49:31 +00:00
|
|
|
* \return 0 if successful, or an MBEDTLS_ERR_DHM_XXX error code
|
2013-09-04 14:29:59 +00:00
|
|
|
*
|
2013-09-17 09:34:11 +00:00
|
|
|
* \note If non-NULL, f_rng is used to blind the input as
|
|
|
|
* countermeasure against timing attacks. Blinding is
|
|
|
|
* automatically used if and only if our secret value X is
|
|
|
|
* re-used and costs nothing otherwise, so it is recommended
|
|
|
|
* to always pass a non-NULL f_rng argument.
|
2009-01-03 21:22:43 +00:00
|
|
|
*/
|
2015-04-08 10:49:31 +00:00
|
|
|
int mbedtls_dhm_calc_secret( mbedtls_dhm_context *ctx,
|
2015-06-02 15:17:08 +00:00
|
|
|
unsigned char *output, size_t output_size, size_t *olen,
|
2013-09-04 12:22:07 +00:00
|
|
|
int (*f_rng)(void *, unsigned char *, size_t),
|
|
|
|
void *p_rng );
|
2009-01-03 21:22:43 +00:00
|
|
|
|
2012-11-14 12:39:52 +00:00
|
|
|
/**
|
2014-06-20 11:32:38 +00:00
|
|
|
* \brief Free and clear the components of a DHM key
|
|
|
|
*
|
|
|
|
* \param ctx DHM context to free and clear
|
2009-01-03 21:22:43 +00:00
|
|
|
*/
|
2015-04-08 10:49:31 +00:00
|
|
|
void mbedtls_dhm_free( mbedtls_dhm_context *ctx );
|
2009-01-03 21:22:43 +00:00
|
|
|
|
2015-04-08 10:49:31 +00:00
|
|
|
#if defined(MBEDTLS_ASN1_PARSE_C)
|
2013-09-15 15:43:54 +00:00
|
|
|
/** \ingroup x509_module */
|
|
|
|
/**
|
2015-05-12 09:20:10 +00:00
|
|
|
* \brief Parse DHM parameters in PEM or DER format
|
2013-09-15 15:43:54 +00:00
|
|
|
*
|
|
|
|
* \param dhm DHM context to be initialized
|
|
|
|
* \param dhmin input buffer
|
|
|
|
* \param dhminlen size of the buffer
|
2015-05-12 09:20:10 +00:00
|
|
|
* (including the terminating null byte for PEM data)
|
2013-09-15 15:43:54 +00:00
|
|
|
*
|
|
|
|
* \return 0 if successful, or a specific DHM or PEM error code
|
|
|
|
*/
|
2015-04-08 10:49:31 +00:00
|
|
|
int mbedtls_dhm_parse_dhm( mbedtls_dhm_context *dhm, const unsigned char *dhmin,
|
2013-09-15 15:43:54 +00:00
|
|
|
size_t dhminlen );
|
|
|
|
|
2015-04-08 10:49:31 +00:00
|
|
|
#if defined(MBEDTLS_FS_IO)
|
2013-09-15 15:43:54 +00:00
|
|
|
/** \ingroup x509_module */
|
|
|
|
/**
|
|
|
|
* \brief Load and parse DHM parameters
|
|
|
|
*
|
|
|
|
* \param dhm DHM context to be initialized
|
|
|
|
* \param path filename to read the DHM Parameters from
|
|
|
|
*
|
|
|
|
* \return 0 if successful, or a specific DHM or PEM error code
|
|
|
|
*/
|
2015-04-08 10:49:31 +00:00
|
|
|
int mbedtls_dhm_parse_dhmfile( mbedtls_dhm_context *dhm, const char *path );
|
|
|
|
#endif /* MBEDTLS_FS_IO */
|
|
|
|
#endif /* MBEDTLS_ASN1_PARSE_C */
|
2013-09-15 15:43:54 +00:00
|
|
|
|
2009-01-03 21:22:43 +00:00
|
|
|
/**
|
|
|
|
* \brief Checkup routine
|
|
|
|
*
|
|
|
|
* \return 0 if successful, or 1 if the test failed
|
|
|
|
*/
|
2015-04-08 10:49:31 +00:00
|
|
|
int mbedtls_dhm_self_test( int verbose );
|
2009-01-03 21:22:43 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-05-01 11:03:14 +00:00
|
|
|
#endif /* dhm.h */
|