aboutsummaryrefslogtreecommitdiff
path: root/src/ecdh_gcrypt.c
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2019-03-12 18:24:36 -0400
committerAndreas Schneider <asn@cryptomilk.org>2019-04-04 08:00:15 +0200
commit2f38af1559691e6151c60533848479e96e8965bb (patch)
tree4f2af76f29a1c0ff912458b0348f6bb8781999bb /src/ecdh_gcrypt.c
parent997fe4d418eafff8ace27e07141bdb5e4dee1753 (diff)
downloadlibssh-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 'src/ecdh_gcrypt.c')
-rw-r--r--src/ecdh_gcrypt.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ecdh_gcrypt.c b/src/ecdh_gcrypt.c
index 913855c0..473846b8 100644
--- a/src/ecdh_gcrypt.c
+++ b/src/ecdh_gcrypt.c
@@ -198,8 +198,9 @@ int ecdh_build_k(ssh_session session)
goto out;
}
- session->next_crypto->k = gcry_mpi_new(0);
- gcry_mpi_point_snatch_get(session->next_crypto->k, NULL, NULL, point);
+ session->next_crypto->shared_secret = gcry_mpi_new(0);
+ gcry_mpi_point_snatch_get(session->next_crypto->shared_secret,
+ NULL, NULL, point);
#else
s = ssh_sexp_extract_mpi(result, "s", GCRYMPI_FMT_USG, GCRYMPI_FMT_USG);
if (s == NULL) {
@@ -224,7 +225,7 @@ int ecdh_build_k(ssh_session session)
goto out;
}
- err = gcry_mpi_scan(&session->next_crypto->k,
+ err = gcry_mpi_scan(&session->next_crypto->shared_secret,
GCRYMPI_FMT_USG,
(const char *)ssh_string_data(s) + 1,
k_len / 2,
@@ -245,7 +246,7 @@ int ecdh_build_k(ssh_session session)
session->next_crypto->server_kex.cookie, 16);
ssh_print_hexa("Session client cookie",
session->next_crypto->client_kex.cookie, 16);
- ssh_print_bignum("Shared secret key", session->next_crypto->k);
+ ssh_print_bignum("Shared secret key", session->next_crypto->shared_secret);
#endif
out: