mbed TLS v2.6.0
ecdh.h
Go to the documentation of this file.
1 
25 #ifndef MBEDTLS_ECDH_H
26 #define MBEDTLS_ECDH_H
27 
28 #include "ecp.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
37 typedef enum
38 {
42 
46 typedef struct
47 {
57 }
59 
74  int (*f_rng)(void *, unsigned char *, size_t),
75  void *p_rng );
76 
96  const mbedtls_ecp_point *Q, const mbedtls_mpi *d,
97  int (*f_rng)(void *, unsigned char *, size_t),
98  void *p_rng );
99 
106 
113 
130 int mbedtls_ecdh_make_params( mbedtls_ecdh_context *ctx, size_t *olen,
131  unsigned char *buf, size_t blen,
132  int (*f_rng)(void *, unsigned char *, size_t),
133  void *p_rng );
134 
146  const unsigned char **buf, const unsigned char *end );
147 
161  mbedtls_ecdh_side side );
162 
176 int mbedtls_ecdh_make_public( mbedtls_ecdh_context *ctx, size_t *olen,
177  unsigned char *buf, size_t blen,
178  int (*f_rng)(void *, unsigned char *, size_t),
179  void *p_rng );
180 
192  const unsigned char *buf, size_t blen );
193 
207 int mbedtls_ecdh_calc_secret( mbedtls_ecdh_context *ctx, size_t *olen,
208  unsigned char *buf, size_t blen,
209  int (*f_rng)(void *, unsigned char *, size_t),
210  void *p_rng );
211 
212 #ifdef __cplusplus
213 }
214 #endif
215 
216 #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:52
Elliptic curves over GF(p)
mbedtls_mpi d
Definition: ecdh.h:49
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:167
void mbedtls_ecdh_free(mbedtls_ecdh_context *ctx)
Free context.
mbedtls_mpi _d
Definition: ecdh.h:56
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:140
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:54
mbedtls_ecp_group grp
Definition: ecdh.h:48
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:37
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:46
mbedtls_ecp_point Qp
Definition: ecdh.h:51
mbedtls_ecp_point Q
Definition: ecdh.h:50
mbedtls_ecp_point Vf
Definition: ecdh.h:55
MPI structure.
Definition: bignum.h:181
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:108
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.