PolarSSL v1.3.9
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 enum
40 {
43 } ecdh_side;
44 
48 typedef struct
49 {
51  mpi d;
54  mpi z;
58  mpi _d;
59 }
61 
75 int ecdh_gen_public( ecp_group *grp, mpi *d, ecp_point *Q,
76  int (*f_rng)(void *, unsigned char *, size_t),
77  void *p_rng );
78 
97 int ecdh_compute_shared( ecp_group *grp, mpi *z,
98  const ecp_point *Q, const mpi *d,
99  int (*f_rng)(void *, unsigned char *, size_t),
100  void *p_rng );
101 
107 void ecdh_init( ecdh_context *ctx );
108 
114 void ecdh_free( ecdh_context *ctx );
115 
132 int ecdh_make_params( ecdh_context *ctx, size_t *olen,
133  unsigned char *buf, size_t blen,
134  int (*f_rng)(void *, unsigned char *, size_t),
135  void *p_rng );
136 
148  const unsigned char **buf, const unsigned char *end );
149 
162 int ecdh_get_params( ecdh_context *ctx, const ecp_keypair *key,
163  ecdh_side side );
164 
178 int ecdh_make_public( 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 
194  const unsigned char *buf, size_t blen );
195 
209 int ecdh_calc_secret( ecdh_context *ctx, size_t *olen,
210  unsigned char *buf, size_t blen,
211  int (*f_rng)(void *, unsigned char *, size_t),
212  void *p_rng );
213 
219 int ecdh_self_test( int verbose );
220 
221 #ifdef __cplusplus
222 }
223 #endif
224 
225 #endif /* ecdh.h */