RetroArch
|
#include "mbedtls/config.h"
#include "mbedtls/dhm.h"
#include <string.h>
#include "mbedtls/pem.h"
#include "mbedtls/asn1.h"
#include "mbedtls/platform.h"
#include "arc4_alt.h"
Macros | |
#define | DHM_MPI_EXPORT(X, n) |
Functions | |
static int | dhm_read_bignum (mbedtls_mpi *X, unsigned char **p, const unsigned char *end) |
static int | dhm_check_range (const mbedtls_mpi *param, const mbedtls_mpi *P) |
void | mbedtls_dhm_init (mbedtls_dhm_context *ctx) |
Initialize DHM context. More... | |
int | mbedtls_dhm_read_params (mbedtls_dhm_context *ctx, unsigned char **p, const unsigned char *end) |
Parse the ServerKeyExchange parameters. More... | |
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. More... | |
int | mbedtls_dhm_read_public (mbedtls_dhm_context *ctx, const unsigned char *input, size_t ilen) |
Import the peer's public value G^Y. More... | |
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. More... | |
static int | dhm_update_blinding (mbedtls_dhm_context *ctx, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng) |
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. More... | |
void | mbedtls_dhm_free (mbedtls_dhm_context *ctx) |
Free and clear the components of a DHM key. More... | |
int | mbedtls_dhm_parse_dhm (mbedtls_dhm_context *dhm, const unsigned char *dhmin, size_t dhminlen) |
Parse DHM parameters in PEM or DER format. More... | |
static int | load_file (const char *path, unsigned char **buf, size_t *n) |
int | mbedtls_dhm_parse_dhmfile (mbedtls_dhm_context *dhm, const char *path) |
Load and parse DHM parameters. More... | |
int | mbedtls_dhm_self_test (int verbose) |
Checkup routine. More... | |
Variables | |
static const char | mbedtls_test_dhm_params [] |
static const size_t | mbedtls_test_dhm_params_len = sizeof( mbedtls_test_dhm_params ) |
|
static |
|
static |
|
static |
|
static |
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.
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 |
void mbedtls_dhm_free | ( | mbedtls_dhm_context * | ctx | ) |
Free and clear the components of a DHM key.
ctx | DHM context to free and clear |
void mbedtls_dhm_init | ( | mbedtls_dhm_context * | ctx | ) |
Initialize DHM context.
ctx | DHM context to be initialized |
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.
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 |
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 | ||
) |
Create own private value X and export G^X.
ctx | DHM context |
x_size | private value size in bytes |
output | destination buffer |
olen | must be at least equal to the size of P, ctx->len |
f_rng | RNG function |
p_rng | RNG parameter |
int mbedtls_dhm_read_params | ( | mbedtls_dhm_context * | ctx, |
unsigned char ** | p, | ||
const unsigned char * | end | ||
) |
Parse the ServerKeyExchange parameters.
ctx | DHM context |
p | &(start of input buffer) |
end | end of buffer |
int mbedtls_dhm_read_public | ( | mbedtls_dhm_context * | ctx, |
const unsigned char * | input, | ||
size_t | ilen | ||
) |
Import the peer's public value G^Y.
ctx | DHM context |
input | input buffer |
ilen | size of buffer |
int mbedtls_dhm_self_test | ( | int | verbose | ) |
Checkup routine.
|
static |
|
static |