Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: HTTPClient-SSL WS_SERVER
dhm.h File Reference
Diffie-Hellman-Merkle key exchange. More...
Go to the source code of this file.
Data Structures | |
| struct | dhm_context |
| DHM context structure. More... | |
Functions | |
| void | dhm_init (dhm_context *ctx) |
| Initialize DHM context. | |
| int | dhm_read_params (dhm_context *ctx, unsigned char **p, const unsigned char *end) |
| Parse the ServerKeyExchange parameters. | |
| int | dhm_make_params (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 | dhm_read_public (dhm_context *ctx, const unsigned char *input, size_t ilen) |
| Import the peer's public value G^Y. | |
| int | dhm_make_public (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 | dhm_calc_secret (dhm_context *ctx, unsigned char *output, 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 | dhm_free (dhm_context *ctx) |
| Free and clear the components of a DHM key. | |
| int | dhm_parse_dhm (dhm_context *dhm, const unsigned char *dhmin, size_t dhminlen) |
| Parse DHM parameters. | |
| int | dhm_parse_dhmfile (dhm_context *dhm, const char *path) |
| Load and parse DHM parameters. | |
| int | dhm_self_test (int verbose) |
| Checkup routine. | |
Detailed Description
Diffie-Hellman-Merkle key exchange.
Copyright (C) 2006-2013, ARM Limited, All Rights Reserved
This file is part of mbed TLS (https://tls.mbed.org)
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Definition in file dhm.h.
Function Documentation
| int dhm_calc_secret | ( | dhm_context * | ctx, |
| unsigned char * | output, | ||
| 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 olen on entry, must hold the size of the destination buffer 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 POLARSSL_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 dhm_free | ( | dhm_context * | ctx ) |
| void dhm_init | ( | dhm_context * | ctx ) |
| int dhm_make_params | ( | 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 mpi_read_string or mpi_read_binary).
- Returns:
- 0 if successful, or an POLARSSL_ERR_DHM_XXX error code
| int dhm_make_public | ( | dhm_context * | ctx, |
| int | x_size, | ||
| unsigned char * | output, | ||
| size_t | olen, | ||
| int(*)(void *, unsigned char *, size_t) | f_rng, | ||
| void * | p_rng | ||
| ) |
| int dhm_read_params | ( | dhm_context * | ctx, |
| unsigned char ** | p, | ||
| const unsigned char * | end | ||
| ) |
| int dhm_read_public | ( | dhm_context * | ctx, |
| const unsigned char * | input, | ||
| size_t | ilen | ||
| ) |
Generated on Tue Jul 12 2022 13:50:39 by
1.7.2