1
+ //Initializers
2
+ //openSSL
3
+ struct sshdh * sshdh_openssl_new (void );
4
+ //ms_cng
5
+ struct sshdh * sshdh_ms_cng_new (void );
6
+
7
+ //need to think about this one
8
+ struct sshdh * sshdh_new_group (struct sshbn * gen , struct sshbn * modulus );
9
+
10
+ struct sshdh {
11
+ //Interface
12
+ void (* sshdh_free )(struct sshdh * dh );
13
+ struct sshbn * (* sshdh_pubkey )(struct sshdh * dh );
14
+ struct sshbn * (* sshdh_p )(struct sshdh * dh );
15
+ struct sshbn * (* sshdh_g )(struct sshdh * dh );
16
+ void (* sshdh_dump )(struct sshdh * dh );
17
+ size_t (* sshdh_shared_key_size )(struct sshdh * dh );
18
+ int (* sshdh_compute_key )(struct sshdh * dh , struct sshbn * pubkey , struct sshbn * * shared_secretp );
19
+ int (* sshdh_generate )(struct sshdh * dh , size_t len );
20
+ int (* sshdh_new_group_hex )(const char * gen , const char * modulus , struct sshdh * * dhp );
21
+ //Initializer of sshbn done in the context of a sshdh.
22
+ struct sshbn * (* sshbn_new )();
23
+ };
24
+
25
+ struct sshbn {
26
+ void (* sshbn_free )(struct sshbn * bn );
27
+ int (* sshbn_from )(const void * d , size_t l , struct sshbn * * retp );
28
+ int (* sshbn_from_hex )(const char * hex , struct sshbn * * retp );
29
+ size_t (* sshbn_bits )(const struct sshbn * bn );
30
+ const struct sshbn * (* sshbn_value_0 )(void );
31
+ const struct sshbn * (* sshbn_value_1 )(void );
32
+ int (* sshbn_is_bit_set )(const struct sshbn * bn , size_t i );
33
+
34
+ //TODO: enforce that multiple sshbn instances involved are from the same implementation.
35
+ int sshbn_cmp (const struct sshbn * b );
36
+ int sshbn_sub (struct sshbn * r , const struct sshbn * b );
37
+ };
0 commit comments