mbed TLS v2.2.0
ecdh.h
Go to the documentation of this file.
1 
23 #ifndef MBEDTLS_ECDH_H
24 #define MBEDTLS_ECDH_H
25 
26 #include "ecp.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
35 typedef enum
36 {
40 
44 typedef struct
45 {
55 }
57 
72  int (*f_rng)(void *, unsigned char *, size_t),
73  void *p_rng );
74 
94  const mbedtls_ecp_point *Q, const mbedtls_mpi *d,
95  int (*f_rng)(void *, unsigned char *, size_t),
96  void *p_rng );
97 
104 
111 
128 int mbedtls_ecdh_make_params( mbedtls_ecdh_context *ctx, size_t *olen,
129  unsigned char *buf, size_t blen,
130  int (*f_rng)(void *, unsigned char *, size_t),
131  void *p_rng );
132 
144  const unsigned char **buf, const unsigned char *end );
145 
159  mbedtls_ecdh_side side );
160 
174 int mbedtls_ecdh_make_public( mbedtls_ecdh_context *ctx, size_t *olen,
175  unsigned char *buf, size_t blen,
176  int (*f_rng)(void *, unsigned char *, size_t),
177  void *p_rng );
178 
190  const unsigned char *buf, size_t blen );
191 
205 int mbedtls_ecdh_calc_secret( mbedtls_ecdh_context *ctx, size_t *olen,
206  unsigned char *buf, size_t blen,
207  int (*f_rng)(void *, unsigned char *, size_t),
208  void *p_rng );
209 
210 #ifdef __cplusplus
211 }
212 #endif
213 
214 #endif /* ecdh.h */
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_mpi z
Definition: ecdh.h:50
Elliptic curves over GF(p)
mbedtls_mpi d
Definition: ecdh.h:47
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.
ECP key pair structure.
Definition: ecp.h:163
void mbedtls_ecdh_free(mbedtls_ecdh_context *ctx)
Free context.
mbedtls_mpi _d
Definition: ecdh.h:54
int mbedtls_ecdh_read_public(mbedtls_ecdh_context *ctx, const unsigned char *buf, size_t blen)
Parse and process a TLS ClientKeyExchange payload.
ECP group structure.
Definition: ecp.h:136
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_ecp_point Vi
Definition: ecdh.h:52
mbedtls_ecp_group grp
Definition: ecdh.h:46
void mbedtls_ecdh_init(mbedtls_ecdh_context *ctx)
Initialize 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)
Generate a public key.
mbedtls_ecdh_side
When importing from an EC key, select if it is our key or the peer's key.
Definition: ecdh.h:35
int mbedtls_ecdh_read_params(mbedtls_ecdh_context *ctx, const unsigned char **buf, const unsigned char *end)
Parse and procress a TLS ServerKeyExhange payload.
ECDH context structure.
Definition: ecdh.h:44
mbedtls_ecp_point Qp
Definition: ecdh.h:49
mbedtls_ecp_point Q
Definition: ecdh.h:48
mbedtls_ecp_point Vf
Definition: ecdh.h:53
MPI structure.
Definition: bignum.h:143
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.
ECP point structure (jacobian coordinates)
Definition: ecp.h:104
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.