From 172598081bb5121ee9085888b91e0e6195b5c5b5 Mon Sep 17 00:00:00 2001 From: Iru Cai Date: Mon, 4 Jun 2018 10:03:30 +0800 Subject: restruct ssh_dh * Use strong PRNG * Add a name field * Move BIGNUM things to priv --- src/protocol/internal/ssh_diffie-hellman.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/protocol/internal/ssh_diffie-hellman.h') diff --git a/src/protocol/internal/ssh_diffie-hellman.h b/src/protocol/internal/ssh_diffie-hellman.h index 58733b0..4284633 100644 --- a/src/protocol/internal/ssh_diffie-hellman.h +++ b/src/protocol/internal/ssh_diffie-hellman.h @@ -29,14 +29,20 @@ extern "C" { typedef struct ssh_diffie_hellman { - BIGNUM *g; // generator - BIGNUM *p; // prime - BIGNUM *bn_x; /* random number */ + const char *name; + union { + struct { + BIGNUM *g; // generator + BIGNUM *p; // prime + BIGNUM *bn_x; /* random number */ + BN_CTX *ctx; + } dh; + unsigned char privkey[32]; + } priv; int e_len; unsigned char *mpint_e; /* g^x mod p */ int secret_len; unsigned char *secret; - BN_CTX *ctx; evp_md_t digest; } SSH_DH; -- cgit v1.2.3