PolarSSL v1.3.2
ecdh.h
Go to the documentation of this file.
1 
27 #ifndef POLARSSL_ECDH_H
28 #define POLARSSL_ECDH_H
29 
30 #include "ecp.h"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
39 typedef struct
40 {
42  mpi d;
45  mpi z;
49  mpi _d;
50 }
52 
65 int ecdh_gen_public( ecp_group *grp, mpi *d, ecp_point *Q,
66  int (*f_rng)(void *, unsigned char *, size_t),
67  void *p_rng );
68 
86 int ecdh_compute_shared( ecp_group *grp, mpi *z,
87  const ecp_point *Q, const mpi *d,
88  int (*f_rng)(void *, unsigned char *, size_t),
89  void *p_rng );
90 
96 void ecdh_init( ecdh_context *ctx );
97 
103 void ecdh_free( ecdh_context *ctx );
104 
120 int ecdh_make_params( ecdh_context *ctx, size_t *olen,
121  unsigned char *buf, size_t blen,
122  int (*f_rng)(void *, unsigned char *, size_t),
123  void *p_rng );
124 
135  const unsigned char **buf, const unsigned char *end );
136 
149 int ecdh_make_public( ecdh_context *ctx, size_t *olen,
150  unsigned char *buf, size_t blen,
151  int (*f_rng)(void *, unsigned char *, size_t),
152  void *p_rng );
153 
164  const unsigned char *buf, size_t blen );
165 
178 int ecdh_calc_secret( ecdh_context *ctx, size_t *olen,
179  unsigned char *buf, size_t blen,
180  int (*f_rng)(void *, unsigned char *, size_t),
181  void *p_rng );
182 
188 int ecdh_self_test( int verbose );
189 
190 #ifdef __cplusplus
191 }
192 #endif
193 
194 #endif
int ecdh_make_params(ecdh_context *ctx, size_t *olen, unsigned char *buf, size_t blen, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
Setup and write the ServerKeyExhange parameters.
int ecdh_make_public(ecdh_context *ctx, size_t *olen, unsigned char *buf, size_t blen, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
Setup and export the client's public value.
int ecdh_calc_secret(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.
Elliptic curves over GF(p)
int ecdh_read_public(ecdh_context *ctx, const unsigned char *buf, size_t blen)
Parse and import the client's public value.
ecp_point Vf
Definition: ecdh.h:48
int ecdh_compute_shared(ecp_group *grp, mpi *z, const ecp_point *Q, const mpi *d, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
Compute shared secret.
int ecdh_gen_public(ecp_group *grp, mpi *d, ecp_point *Q, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
Generate a public key.
mpi _d
Definition: ecdh.h:49
ECP group structure.
Definition: ecp.h:117
MPI structure.
Definition: bignum.h:171
mpi d
Definition: ecdh.h:42
ecp_point Qp
Definition: ecdh.h:44
ECP point structure (jacobian coordinates)
Definition: ecp.h:94
int point_format
Definition: ecdh.h:46
mpi z
Definition: ecdh.h:45
int ecdh_read_params(ecdh_context *ctx, const unsigned char **buf, const unsigned char *end)
Parse the ServerKeyExhange parameters.
ECDH context structure.
Definition: ecdh.h:39
void ecdh_init(ecdh_context *ctx)
Initialize context.
ecp_point Vi
Definition: ecdh.h:47
int ecdh_self_test(int verbose)
Checkup routine.
void ecdh_free(ecdh_context *ctx)
Free context.
ecp_group grp
Definition: ecdh.h:41
ecp_point Q
Definition: ecdh.h:43