123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 |
- #ifndef MBEDTLS_ECDH_H
- #define MBEDTLS_ECDH_H
- #include "ecp.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- typedef enum
- {
- MBEDTLS_ECDH_OURS,
- MBEDTLS_ECDH_THEIRS,
- } mbedtls_ecdh_side;
- typedef struct
- {
- mbedtls_ecp_group grp;
- mbedtls_mpi d;
- mbedtls_ecp_point Q;
- mbedtls_ecp_point Qp;
- mbedtls_mpi z;
- int point_format;
- mbedtls_ecp_point Vi;
- mbedtls_ecp_point Vf;
- mbedtls_mpi _d;
- }
- mbedtls_ecdh_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 );
- 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 );
- void mbedtls_ecdh_init( mbedtls_ecdh_context *ctx );
- void mbedtls_ecdh_free( mbedtls_ecdh_context *ctx );
- 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 );
- int mbedtls_ecdh_read_params( mbedtls_ecdh_context *ctx,
- const unsigned char **buf, const unsigned char *end );
- int mbedtls_ecdh_get_params( mbedtls_ecdh_context *ctx, const mbedtls_ecp_keypair *key,
- mbedtls_ecdh_side side );
- 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 );
- int mbedtls_ecdh_read_public( mbedtls_ecdh_context *ctx,
- const unsigned char *buf, size_t blen );
- 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 );
- #ifdef __cplusplus
- }
- #endif
- #endif
|