Commit 8bc61c2e authored by Niels Möller's avatar Niels Möller
Browse files

Add object headers to most structures. Added prototypes.

Rev: src/keyexchange.h:1.14
Rev: src/publickey_crypto.h:1.8
parent b72b9e6a
......@@ -57,6 +57,8 @@
/* algorithms is an array indexed by the KEX_* values above */
struct keyexchange_algorithm
struct lsh_object header;
int (*init)(struct keyexchange_algorithm *closure,
struct ssh_connection *connection,
int hostkey_algorithm_atom,
......@@ -69,6 +71,8 @@ struct keyexchange_algorithm
struct kexinit
struct lsh_object header;
UINT8 cookie[16];
/* Zero terminated list of atoms */
int *kex_algorithms;
......@@ -111,6 +115,8 @@ struct handle_kexinit
/* Installs keys for use. */
struct install_keys
struct lsh_object header;
int (*install)(struct install_keys *closure,
struct ssh_connection *connection,
struct hash_instance *secret);
......@@ -120,6 +126,8 @@ struct install_keys
struct newkeys_info
struct lsh_object header;
struct crypto_algorithm *encryption_client_to_server;
struct crypto_algorithm *encryption_server_to_client;
struct mac_algorithm *mac_client_to_server;
......@@ -159,4 +167,16 @@ int initiate_keyexchange(struct ssh_connection *connection,
struct kexinit *kex,
struct lsh_string *first_packet);
struct packet_handler *make_kexinit_handler(int type,
struct make_kexinit *init,
struct alist *algorithms);
struct packet_handler *
make_newkeys_handler(struct crypto_instance *crypto,
struct mac_instance *mac);
#if 0
struct kexinit *parse_kexinit(struct lsh_string *packet);
......@@ -36,6 +36,8 @@ struct signature_algorithm *make_dss_algorithm(struct randomness *random);
* bignums. */
struct group
struct lsh_object header;
/* Returns 1 if x is an element of the group, and is in the
* canonical representation */
int (*member)(struct group *closure, mpz_t x);
......@@ -53,15 +55,45 @@ struct group
#define GROUP_POWER(group, res, g, e) \
((group)->power((group), (res), (g), (e)))
struct group *make_zn(mpz_t p);
/* DSS signatures */
struct dss_public
mpz_t p;
mpz_t q;
mpz_t g;
mpz_t y;
#if 0
struct signer *make_dss_signer(struct signature_algorithm *closure,
UINT32 public_length,
UINT8 *public,
UINT32 private_length,
UINT8 *private);
struct verifier *make_dss_verifier(struct signature_algorithm *closure,
UINT32 public_length,
UINT8 *public);
int parse_dss_public(struct simple_buffer *buffer, struct dss_public *public);
/* DH key exchange, with authentication */
struct diffie_hellman_method
struct lsh_object header;
struct group *G;
mpz_t generator;
struct hash_algorithm *H;
struct randomness *random;
/* NOTE: Instances are never allocated on the heap by themselves. They are always
* embedded in other objects. Therefore there's no object header. */
struct diffie_hellman_instance
struct diffie_hellman_method *method;
......@@ -97,7 +129,12 @@ int dh_process_server_msg(struct diffie_hellman_instance *self,
/* Verifies server's signature */
int dh_verify_server_msg(struct diffie_hellman_instance *self,
struct verifier *v);
void dh_generate_secret(struct diffie_hellman_instance *self,
mpz_t r);
void dh_hash_digest(struct diffie_hellman_instance *self, UINT8 *digest);
#if 0
struct diffie_hellman_method *
make_diffie_hellman_method(struct group *group,
......@@ -111,8 +148,10 @@ void init_diffie_hellman_instance(struct diffie_hellman_method *m,
struct diffie_hellman_instance *self,
struct ssh_connection *c);
#if 0
struct diffie_hellman_instance *
make_diffie_hellman_instance(struct diffie_hellman_method *m,
struct ssh_connection *c);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment