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
33extern "C" {
34#endif
35
44
61
76 int (*f_rng)(void *, unsigned char *, size_t),
77 void *p_rng );
78
98 const ecp_point *Q, const mpi *d,
99 int (*f_rng)(void *, unsigned char *, size_t),
100 void *p_rng );
101
108
115
132int 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
163 ecdh_side side );
164
178int 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
209int 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
219int ecdh_self_test( int verbose );
220
221#ifdef __cplusplus
222}
223#endif
224
225#endif /* ecdh.h */
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)
Generate a public key and a TLS ServerKeyExchange payload.
ecdh_side
When importing from an EC key, select if it is our key or the peer's key.
Definition ecdh.h:40
@ POLARSSL_ECDH_OURS
Definition ecdh.h:41
@ POLARSSL_ECDH_THEIRS
Definition ecdh.h:42
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.
void ecdh_init(ecdh_context *ctx)
Initialize context.
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.
int ecdh_read_params(ecdh_context *ctx, const unsigned char **buf, const unsigned char *end)
Parse and procress a TLS ServerKeyExhange payload.
int ecdh_get_params(ecdh_context *ctx, const ecp_keypair *key, ecdh_side side)
Setup an ECDH context from an EC key.
void ecdh_free(ecdh_context *ctx)
Free context.
int ecdh_read_public(ecdh_context *ctx, const unsigned char *buf, size_t blen)
Parse and process a TLS ClientKeyExchange payload.
int ecdh_self_test(int verbose)
Checkup routine.
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)
Generate a public key and a TLS ClientKeyExchange payload.
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 Raw function that only does the core computation.
Elliptic curves over GF(p)
ECDH context structure.
Definition ecdh.h:49
mpi d
Definition ecdh.h:51
int point_format
Definition ecdh.h:55
ecp_point Q
Definition ecdh.h:52
ecp_group grp
Definition ecdh.h:50
ecp_point Vf
Definition ecdh.h:57
ecp_point Vi
Definition ecdh.h:56
mpi z
Definition ecdh.h:54
mpi _d
Definition ecdh.h:58
ecp_point Qp
Definition ecdh.h:53
ECP group structure.
Definition ecp.h:137
ECP key pair structure.
Definition ecp.h:164
ECP point structure (jacobian coordinates)
Definition ecp.h:105
MPI structure.
Definition bignum.h:183