62#if !defined(MBEDTLS_CONFIG_FILE)
65#include MBEDTLS_CONFIG_FILE
80#define MBEDTLS_ECDH_LEGACY_CONTEXT
95#if !defined(MBEDTLS_ECDH_LEGACY_CONTEXT)
104 MBEDTLS_ECDH_VARIANT_NONE = 0,
105 MBEDTLS_ECDH_VARIANT_MBEDTLS_2_0,
106} mbedtls_ecdh_variant;
115typedef struct mbedtls_ecdh_context_mbed
122#if defined(MBEDTLS_ECP_RESTARTABLE)
125} mbedtls_ecdh_context_mbed;
137#if defined(MBEDTLS_ECDH_LEGACY_CONTEXT)
147#if defined(MBEDTLS_ECP_RESTARTABLE)
155 mbedtls_ecdh_variant
var;
158 mbedtls_ecdh_context_mbed mbed_ecdh;
162#if defined(MBEDTLS_ECP_RESTARTABLE)
199 int (*f_rng)(
void *,
unsigned char *,
size_t),
238 int (*f_rng)(
void *,
unsigned char *,
size_t),
302 unsigned char *
buf,
size_t blen,
303 int (*f_rng)(
void *,
unsigned char *,
size_t),
331 const unsigned char **
buf,
332 const unsigned char *
end );
384 unsigned char *
buf,
size_t blen,
385 int (*f_rng)(
void *,
unsigned char *,
size_t),
408 const unsigned char *
buf,
size_t blen );
441 unsigned char *
buf,
size_t blen,
442 int (*f_rng)(
void *,
unsigned char *,
size_t),
445#if defined(MBEDTLS_ECP_RESTARTABLE)
int mbedtls_ecdh_setup(mbedtls_ecdh_context *ctx, mbedtls_ecp_group_id grp_id)
This function sets up the ECDH context with the information given.
int mbedtls_ecdh_get_params(mbedtls_ecdh_context *ctx, const mbedtls_ecp_keypair *key, mbedtls_ecdh_side side)
This function sets up an ECDH context from an EC key.
int mbedtls_ecdh_gen_public(mbedtls_ecp_group *grp, mbedtls_mpi *d, mbedtls_ecp_point *Q, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
This function generates an ECDH keypair on an elliptic curve.
int mbedtls_ecdh_make_public(mbedtls_ecdh_context *ctx, size_t *olen, unsigned char *buf, size_t blen, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
This function generates a public key and exports it as a TLS ClientKeyExchange payload.
int mbedtls_ecdh_calc_secret(mbedtls_ecdh_context *ctx, size_t *olen, unsigned char *buf, size_t blen, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
This function derives and exports the shared secret.
int mbedtls_ecdh_make_params(mbedtls_ecdh_context *ctx, size_t *olen, unsigned char *buf, size_t blen, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
This function generates an EC key pair and exports its in the format used in a TLS ServerKeyExchange ...
void mbedtls_ecdh_free(mbedtls_ecdh_context *ctx)
This function frees a context.
void mbedtls_ecdh_init(mbedtls_ecdh_context *ctx)
This function initializes an ECDH context.
int mbedtls_ecdh_read_public(mbedtls_ecdh_context *ctx, const unsigned char *buf, size_t blen)
This function parses and processes the ECDHE payload of a TLS ClientKeyExchange message.
int mbedtls_ecdh_compute_shared(mbedtls_ecp_group *grp, mbedtls_mpi *z, const mbedtls_ecp_point *Q, const mbedtls_mpi *d, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
This function computes the shared secret.
int mbedtls_ecdh_read_params(mbedtls_ecdh_context *ctx, const unsigned char **buf, const unsigned char *end)
This function parses the ECDHE parameters in a TLS ServerKeyExchange handshake message.
GLenum GLuint GLenum GLsizei const GLchar * buf
This file provides an API for Elliptic Curves over GF(P) (ECP).
The ECDH context structure.
The ECP key-pair structure.
The ECP point structure, in Jacobian coordinates.