ecdh.h
Go to the documentation of this file.
#ifndef MBEDTLS_ECDH_H
#define MBEDTLS_ECDH_H
#include "ecp.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum
{
MBEDTLS_ECDH_OURS,
MBEDTLS_ECDH_THEIRS,
} mbedtls_ecdh_side;
typedef struct
{
mbedtls_ecp_group grp;
mbedtls_mpi d;
mbedtls_ecp_point Q;
mbedtls_ecp_point Qp;
mbedtls_mpi z;
int point_format;
mbedtls_ecp_point Vi;
mbedtls_ecp_point Vf;
mbedtls_mpi _d;
}
mbedtls_ecdh_context;
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 );
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 );
void mbedtls_ecdh_init( mbedtls_ecdh_context *ctx );
void mbedtls_ecdh_free( mbedtls_ecdh_context *ctx );
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 );
int mbedtls_ecdh_read_params( mbedtls_ecdh_context *ctx,
const unsigned char **buf, const unsigned char *end );
int mbedtls_ecdh_get_params( mbedtls_ecdh_context *ctx, const mbedtls_ecp_keypair *key,
mbedtls_ecdh_side side );
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 );
int mbedtls_ecdh_read_public( mbedtls_ecdh_context *ctx,
const unsigned char *buf, size_t blen );
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 );
#ifdef __cplusplus
}
#endif
#endif /* ecdh.h */
mbedtls_ecdh_make_params
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)
Generate a public key and a TLS ServerKeyExchange payload.
mbedtls_ecdh_context::z
mbedtls_mpi z
Definition: ecdh.h:50
ecp.h
Elliptic curves over GF(p)
mbedtls_ecdh_context::d
mbedtls_mpi d
Definition: ecdh.h:47
mbedtls_ecdh_make_public
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)
Generate a public key and a TLS ClientKeyExchange payload.
mbedtls_ecp_keypair
ECP key pair structure.
Definition: ecp.h:156
MBEDTLS_ECDH_OURS
Definition: ecdh.h:37
mbedtls_ecdh_free
void mbedtls_ecdh_free(mbedtls_ecdh_context *ctx)
Free context.
mbedtls_ecdh_context::_d
mbedtls_mpi _d
Definition: ecdh.h:54
mbedtls_ecdh_read_public
int mbedtls_ecdh_read_public(mbedtls_ecdh_context *ctx, const unsigned char *buf, size_t blen)
Parse and process a TLS ClientKeyExchange payload.
mbedtls_ecp_group
ECP group structure.
Definition: ecp.h:129
mbedtls_ecdh_compute_shared
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)
Compute shared secret Raw function that only does the core computation.
mbedtls_ecdh_context::Vi
mbedtls_ecp_point Vi
Definition: ecdh.h:52
mbedtls_ecdh_context::grp
mbedtls_ecp_group grp
Definition: ecdh.h:46
mbedtls_ecdh_init
void mbedtls_ecdh_init(mbedtls_ecdh_context *ctx)
Initialize context.
mbedtls_ecdh_gen_public
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)
Generate a public key.
mbedtls_ecdh_side
mbedtls_ecdh_side
When importing from an EC key, select if it is our key or the peer&#39;s key.
Definition: ecdh.h:35
mbedtls_ecdh_read_params
int mbedtls_ecdh_read_params(mbedtls_ecdh_context *ctx, const unsigned char **buf, const unsigned char *end)
Parse and procress a TLS ServerKeyExhange payload.
mbedtls_ecdh_context::point_format
int point_format
Definition: ecdh.h:51
mbedtls_ecdh_context
ECDH context structure.
Definition: ecdh.h:44
mbedtls_ecdh_context::Qp
mbedtls_ecp_point Qp
Definition: ecdh.h:49
mbedtls_ecdh_context::Q
mbedtls_ecp_point Q
Definition: ecdh.h:48
mbedtls_ecdh_context::Vf
mbedtls_ecp_point Vf
Definition: ecdh.h:53
mbedtls_mpi
MPI structure.
Definition: bignum.h:144
mbedtls_ecdh_calc_secret
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)
Derive and export the shared secret.
mbedtls_ecp_point
ECP point structure (jacobian coordinates)
Definition: ecp.h:97
mbedtls_ecdh_get_params
int mbedtls_ecdh_get_params(mbedtls_ecdh_context *ctx, const mbedtls_ecp_keypair *key, mbedtls_ecdh_side side)
Setup an ECDH context from an EC key.
MBEDTLS_ECDH_THEIRS
Definition: ecdh.h:38