mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 18:50:28 +09:00
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>
This commit is contained in:
committed by
Andreas Schneider
parent
303bdc5a4f
commit
42185fbf6e
22
src/dh.c
22
src/dh.c
@@ -376,7 +376,8 @@ int ssh_dh_import_next_pubkey_blob(ssh_session session, ssh_string pubkey_blob)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_CRYPTO
|
#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("p", session->next_crypto->p);
|
||||||
ssh_print_bignum("g", session->next_crypto->g);
|
ssh_print_bignum("g", session->next_crypto->g);
|
||||||
ssh_print_bignum("x", session->next_crypto->x);
|
ssh_print_bignum("x", session->next_crypto->x);
|
||||||
@@ -441,7 +442,8 @@ error:
|
|||||||
return SSH_ERROR;
|
return SSH_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ssh_dh_build_k(ssh_session session) {
|
int ssh_dh_build_k(ssh_session session)
|
||||||
|
{
|
||||||
int rc;
|
int rc;
|
||||||
bignum_CTX ctx = bignum_ctx_new();
|
bignum_CTX ctx = bignum_ctx_new();
|
||||||
if (bignum_ctx_invalid(ctx)) {
|
if (bignum_ctx_invalid(ctx)) {
|
||||||
@@ -450,15 +452,21 @@ int ssh_dh_build_k(ssh_session session) {
|
|||||||
|
|
||||||
/* the server and clients don't use the same numbers */
|
/* the server and clients don't use the same numbers */
|
||||||
if (session->client) {
|
if (session->client) {
|
||||||
rc = bignum_mod_exp(session->next_crypto->k, session->next_crypto->f,
|
rc = bignum_mod_exp(session->next_crypto->k,
|
||||||
session->next_crypto->x, session->next_crypto->p, ctx);
|
session->next_crypto->f,
|
||||||
|
session->next_crypto->x,
|
||||||
|
session->next_crypto->p,
|
||||||
|
ctx);
|
||||||
} else {
|
} else {
|
||||||
rc = bignum_mod_exp(session->next_crypto->k, session->next_crypto->e,
|
rc = bignum_mod_exp(session->next_crypto->k,
|
||||||
session->next_crypto->y, session->next_crypto->p, ctx);
|
session->next_crypto->e,
|
||||||
|
session->next_crypto->y,
|
||||||
|
session->next_crypto->p,
|
||||||
|
ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
bignum_ctx_free(ctx);
|
bignum_ctx_free(ctx);
|
||||||
ssh_dh_debug();
|
ssh_dh_debug(session);
|
||||||
if (rc != 1) {
|
if (rc != 1) {
|
||||||
return SSH_ERROR;
|
return SSH_ERROR;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user