diff options
author | Simo Sorce <simo@redhat.com> | 2019-03-12 18:24:36 -0400 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2019-04-04 08:00:15 +0200 |
commit | 2f38af1559691e6151c60533848479e96e8965bb (patch) | |
tree | 4f2af76f29a1c0ff912458b0348f6bb8781999bb /include/libssh | |
parent | 997fe4d418eafff8ace27e07141bdb5e4dee1753 (diff) | |
download | libssh-2f38af1559691e6151c60533848479e96e8965bb.tar.gz libssh-2f38af1559691e6151c60533848479e96e8965bb.tar.xz libssh-2f38af1559691e6151c60533848479e96e8965bb.zip |
dh: Rename variables for DH key exchange
Rename and refactor how some variables are held in ssh_crypto_struct.
Refactor allocation of dh exchange public keys.
This is in preparation for switching the code to use openssl native DH
handling and allowed to better reason about the code and the overall API.
Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'include/libssh')
-rw-r--r-- | include/libssh/crypto.h | 8 | ||||
-rw-r--r-- | include/libssh/dh.h | 12 |
2 files changed, 17 insertions, 3 deletions
diff --git a/include/libssh/crypto.h b/include/libssh/crypto.h index 4cd0cecd..034b4f2e 100644 --- a/include/libssh/crypto.h +++ b/include/libssh/crypto.h @@ -45,6 +45,7 @@ #ifdef HAVE_OPENSSL_ECDH_H #include <openssl/ecdh.h> #endif +#include "libssh/dh.h" #include "libssh/ecdh.h" #include "libssh/kex.h" #include "libssh/curve25519.h" @@ -98,10 +99,11 @@ enum ssh_cipher_e { SSH_AEAD_CHACHA20_POLY1305 }; +struct dh_ctx; + struct ssh_crypto_struct { - bignum e,f,x,k,y; - bignum g, p; - int dh_group_is_mutable; /* do free group parameters */ + bignum shared_secret; + struct dh_ctx *dh_ctx; #ifdef WITH_GEX size_t dh_pmin; int dh_pn; int dh_pmax; /* preferred group parameters */ #endif /* WITH_GEX */ diff --git a/include/libssh/dh.h b/include/libssh/dh.h index 25aad47e..2a9be714 100644 --- a/include/libssh/dh.h +++ b/include/libssh/dh.h @@ -25,6 +25,18 @@ #include "libssh/crypto.h" +struct dh_keypair { + bignum priv_key; + bignum pub_key; +}; + +struct dh_ctx { + struct dh_keypair client; + struct dh_keypair server; + bignum generator; + bignum modulus; +}; + int ssh_dh_init(void); void ssh_dh_finalize(void); |