mbedtls ported to mbed-classic
Fork of mbedtls by
dhm.h File Reference
Diffie-Hellman-Merkle key exchange. More...
Go to the source code of this file.
Data Structures | |
struct | mbedtls_dhm_context |
DHM context structure. More... | |
Functions | |
void | mbedtls_dhm_init (mbedtls_dhm_context *ctx) |
Initialize DHM context. | |
int | mbedtls_dhm_read_params (mbedtls_dhm_context *ctx, unsigned char **p, const unsigned char *end) |
Parse the ServerKeyExchange parameters. | |
int | mbedtls_dhm_make_params (mbedtls_dhm_context *ctx, int x_size, unsigned char *output, size_t *olen, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng) |
Setup and write the ServerKeyExchange parameters. | |
int | mbedtls_dhm_read_public (mbedtls_dhm_context *ctx, const unsigned char *input, size_t ilen) |
Import the peer's public value G^Y. | |
int | mbedtls_dhm_make_public (mbedtls_dhm_context *ctx, int x_size, unsigned char *output, size_t olen, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng) |
Create own private value X and export G^X. | |
int | mbedtls_dhm_calc_secret (mbedtls_dhm_context *ctx, unsigned char *output, size_t output_size, size_t *olen, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng) |
Derive and export the shared secret (G^Y)^X mod P. | |
void | mbedtls_dhm_free (mbedtls_dhm_context *ctx) |
Free and clear the components of a DHM key. | |
int | mbedtls_dhm_parse_dhm (mbedtls_dhm_context *dhm, const unsigned char *dhmin, size_t dhminlen) |
Parse DHM parameters in PEM or DER format. | |
int | mbedtls_dhm_parse_dhmfile (mbedtls_dhm_context *dhm, const char *path) |
Load and parse DHM parameters. | |
int | mbedtls_dhm_self_test (int verbose) |
Checkup routine. |
Detailed Description
Diffie-Hellman-Merkle key exchange.
Copyright (C) 2006-2015, ARM Limited, All Rights Reserved SPDX-License-Identifier: Apache-2.0
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
http://www.apache.org/licenses/LICENSE-2.0
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.
This file is part of mbed TLS (https://tls.mbed.org)
Definition in file dhm.h.
Function Documentation
int mbedtls_dhm_calc_secret | ( | mbedtls_dhm_context * | ctx, |
unsigned char * | output, | ||
size_t | output_size, | ||
size_t * | olen, | ||
int(*)(void *, unsigned char *, size_t) | f_rng, | ||
void * | p_rng | ||
) |
Derive and export the shared secret (G^Y)^X mod P.
- Parameters:
-
ctx DHM context output destination buffer output_size size of the destination buffer olen on exit, holds the actual number of bytes written f_rng RNG function, for blinding purposes p_rng RNG parameter
- Returns:
- 0 if successful, or an MBEDTLS_ERR_DHM_XXX error code
- 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.
void mbedtls_dhm_free | ( | mbedtls_dhm_context * | ctx ) |
void mbedtls_dhm_init | ( | mbedtls_dhm_context * | ctx ) |
int mbedtls_dhm_make_params | ( | mbedtls_dhm_context * | ctx, |
int | x_size, | ||
unsigned char * | output, | ||
size_t * | olen, | ||
int(*)(void *, unsigned char *, size_t) | f_rng, | ||
void * | p_rng | ||
) |
Setup and write the ServerKeyExchange parameters.
- Parameters:
-
ctx DHM context x_size private value size in bytes output destination buffer olen number of chars written f_rng RNG function p_rng RNG parameter
- Note:
- This function assumes that ctx->P and ctx->G have already been properly set (for example using mbedtls_mpi_read_string or mbedtls_mpi_read_binary).
- Returns:
- 0 if successful, or an MBEDTLS_ERR_DHM_XXX error code
int mbedtls_dhm_make_public | ( | mbedtls_dhm_context * | ctx, |
int | x_size, | ||
unsigned char * | output, | ||
size_t | olen, | ||
int(*)(void *, unsigned char *, size_t) | f_rng, | ||
void * | p_rng | ||
) |
int mbedtls_dhm_read_params | ( | mbedtls_dhm_context * | ctx, |
unsigned char ** | p, | ||
const unsigned char * | end | ||
) |
int mbedtls_dhm_read_public | ( | mbedtls_dhm_context * | ctx, |
const unsigned char * | input, | ||
size_t | ilen | ||
) |
Generated on Tue Jul 12 2022 12:52:51 by
![doxygen](doxygen.png)