27
27
gcry_mpi_t priv, pub;
30
/* Which half of the secure session id should be shown in bold? */
32
OTRL_SESSIONID_FIRST_HALF_BOLD,
33
OTRL_SESSIONID_SECOND_HALF_BOLD
37
unsigned char sessionid[20];
38
37
unsigned char sendctr[16];
39
38
unsigned char rcvctr[16];
40
39
gcry_cipher_hd_t sendenc;
54
53
void otrl_dh_init(void);
56
* Initialize the fields of a DH keypair.
58
void otrl_dh_keypair_init(DH_keypair *kp);
63
void otrl_dh_keypair_copy(DH_keypair *dst, const DH_keypair *src);
57
66
* Deallocate the contents of a DH_keypair (but not the DH_keypair
68
77
* Construct session keys from a DH keypair and someone else's public
71
gcry_error_t otrl_dh_session(DH_sesskeys *sess, DH_keypair *kp, gcry_mpi_t y);
80
gcry_error_t otrl_dh_session(DH_sesskeys *sess, const DH_keypair *kp,
84
* Compute the secure session id, two encryption keys, and four MAC keys
85
* given our DH key and their DH public key.
87
gcry_error_t otrl_dh_compute_v2_auth_keys(const DH_keypair *our_dh,
88
gcry_mpi_t their_pub, unsigned char *sessionid, size_t *sessionidlenp,
89
gcry_cipher_hd_t *enc_c, gcry_cipher_hd_t *enc_cp,
90
gcry_md_hd_t *mac_m1, gcry_md_hd_t *mac_m1p,
91
gcry_md_hd_t *mac_m2, gcry_md_hd_t *mac_m2p);
94
* Compute the secure session id, given our DH key and their DH public
97
gcry_error_t otrl_dh_compute_v1_session_id(const DH_keypair *our_dh,
98
gcry_mpi_t their_pub, unsigned char *sessionid, size_t *sessionidlenp,
99
OtrlSessionIdHalf *halfp);
74
102
* Deallocate the contents of a DH_sesskeys (but not the DH_sesskeys
87
115
/* Compare two counter values (8 bytes each). Return 0 if ctr1 == ctr2,
88
116
* < 0 if ctr1 < ctr2 (as unsigned 64-bit values), > 0 if ctr1 > ctr2. */
89
int otrl_dh_cmpctr(unsigned char *ctr1, unsigned char *ctr2);
117
int otrl_dh_cmpctr(const unsigned char *ctr1, const unsigned char *ctr2);