mbed TLS v2.0.0
ecdh.h
Go to the documentation of this file.
1 
24 #ifndef MBEDTLS_ECDH_H
25 #define MBEDTLS_ECDH_H
26 
27 #include "ecp.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
36 typedef enum
37 {
41 
45 typedef struct
46 {
56 }
58 
73  int (*f_rng)(void *, unsigned char *, size_t),
74  void *p_rng );
75 
95  const mbedtls_ecp_point *Q, const mbedtls_mpi *d,
96  int (*f_rng)(void *, unsigned char *, size_t),
97  void *p_rng );
98 
105 
112 
129 int mbedtls_ecdh_make_params( mbedtls_ecdh_context *ctx, size_t *olen,
130  unsigned char *buf, size_t blen,
131  int (*f_rng)(void *, unsigned char *, size_t),
132  void *p_rng );
133 
145  const unsigned char **buf, const unsigned char *end );
146 
160  mbedtls_ecdh_side side );
161 
175 int mbedtls_ecdh_make_public( mbedtls_ecdh_context *ctx, size_t *olen,
176  unsigned char *buf, size_t blen,
177  int (*f_rng)(void *, unsigned char *, size_t),
178  void *p_rng );
179 
191  const unsigned char *buf, size_t blen );
192 
206 int mbedtls_ecdh_calc_secret( mbedtls_ecdh_context *ctx, size_t *olen,
207  unsigned char *buf, size_t blen,
208  int (*f_rng)(void *, unsigned char *, size_t),
209  void *p_rng );
210 
211 #ifdef __cplusplus
212 }
213 #endif
214 
215 #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:51
Elliptic curves over GF(p)
mbedtls_mpi d
Definition: ecdh.h:48
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:157
void mbedtls_ecdh_free(mbedtls_ecdh_context *ctx)
Free context.
mbedtls_mpi _d
Definition: ecdh.h:55
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:130
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:53
mbedtls_ecp_group grp
Definition: ecdh.h:47
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:36
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:45
mbedtls_ecp_point Qp
Definition: ecdh.h:50
mbedtls_ecp_point Q
Definition: ecdh.h:49
mbedtls_ecp_point Vf
Definition: ecdh.h:54
MPI structure.
Definition: bignum.h:144
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:98
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.