aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2019-01-25 10:59:50 +0100
committerAndreas Schneider <asn@cryptomilk.org>2019-01-26 16:40:09 +0100
commit42185fbf6e5f91328ff762d71c2fc1a843975e57 (patch)
tree5dc9edb84a6b805261ee267b9b62a353bd69d8d4 /src
parent303bdc5a4f1b21d873c5175262de72d7aa4f0a8d (diff)
downloadlibssh-42185fbf6e5f91328ff762d71c2fc1a843975e57.tar.gz
libssh-42185fbf6e5f91328ff762d71c2fc1a843975e57.tar.xz
libssh-42185fbf6e5f91328ff762d71c2fc1a843975e57.zip
dh: Reformat ssh_dh_debug, ssh_dh_build_k and unbreak build with DEBUG_CRYPTO
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src')
-rw-r--r--src/dh.c50
1 files changed, 29 insertions, 21 deletions
diff --git a/src/dh.c b/src/dh.c
index 5dc29690..9deea8d5 100644
--- a/src/dh.c
+++ b/src/dh.c
@@ -376,7 +376,8 @@ int ssh_dh_import_next_pubkey_blob(ssh_session session, ssh_string pubkey_blob)
}
#ifdef DEBUG_CRYPTO
-static void ssh_dh_debug(ssh_session session){
+static void ssh_dh_debug(ssh_session session)
+{
ssh_print_bignum("p", session->next_crypto->p);
ssh_print_bignum("g", session->next_crypto->g);
ssh_print_bignum("x", session->next_crypto->x);
@@ -441,28 +442,35 @@ error:
return SSH_ERROR;
}
-int ssh_dh_build_k(ssh_session session) {
- int rc;
- bignum_CTX ctx = bignum_ctx_new();
- if (bignum_ctx_invalid(ctx)) {
- return -1;
- }
+int ssh_dh_build_k(ssh_session session)
+{
+ int rc;
+ bignum_CTX ctx = bignum_ctx_new();
+ if (bignum_ctx_invalid(ctx)) {
+ return -1;
+ }
- /* the server and clients don't use the same numbers */
- if (session->client) {
- rc = bignum_mod_exp(session->next_crypto->k, session->next_crypto->f,
- session->next_crypto->x, session->next_crypto->p, ctx);
- } else {
- rc = bignum_mod_exp(session->next_crypto->k, session->next_crypto->e,
- session->next_crypto->y, session->next_crypto->p, ctx);
- }
+ /* the server and clients don't use the same numbers */
+ if (session->client) {
+ rc = bignum_mod_exp(session->next_crypto->k,
+ session->next_crypto->f,
+ session->next_crypto->x,
+ session->next_crypto->p,
+ ctx);
+ } else {
+ rc = bignum_mod_exp(session->next_crypto->k,
+ session->next_crypto->e,
+ session->next_crypto->y,
+ session->next_crypto->p,
+ ctx);
+ }
- bignum_ctx_free(ctx);
- ssh_dh_debug();
- if (rc != 1) {
- return SSH_ERROR;
- }
- return SSH_OK;
+ bignum_ctx_free(ctx);
+ ssh_dh_debug(session);
+ if (rc != 1) {
+ return SSH_ERROR;
+ }
+ return SSH_OK;
}
static SSH_PACKET_CALLBACK(ssh_packet_client_dh_reply);