mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-06 18:29:50 +09:00
Add return value to dh_generate_e().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@500 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
26
libssh/dh.c
26
libssh/dh.c
@@ -255,22 +255,34 @@ int dh_generate_y(SSH_SESSION *session) {
|
||||
}
|
||||
|
||||
/* used by server */
|
||||
void dh_generate_e(SSH_SESSION *session){
|
||||
int dh_generate_e(SSH_SESSION *session) {
|
||||
#ifdef HAVE_LIBCRYPTO
|
||||
bignum_CTX ctx=bignum_ctx_new();
|
||||
bignum_CTX ctx = bignum_ctx_new();
|
||||
if (ctx == NULL) {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
session->next_crypto->e=bignum_new();
|
||||
|
||||
session->next_crypto->e = bignum_new();
|
||||
if (session->next_crypto->e == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBGCRYPT
|
||||
bignum_mod_exp(session->next_crypto->e,g,session->next_crypto->x,p);
|
||||
bignum_mod_exp(session->next_crypto->e, g, session->next_crypto->x, p);
|
||||
#elif defined HAVE_LIBCRYPTO
|
||||
bignum_mod_exp(session->next_crypto->e,g,session->next_crypto->x,p,ctx);
|
||||
bignum_mod_exp(session->next_crypto->e, g, session->next_crypto->x, p, ctx);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_CRYPTO
|
||||
ssh_print_bignum("e",session->next_crypto->e);
|
||||
ssh_print_bignum("e", session->next_crypto->e);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBCRYPTO
|
||||
bignum_ctx_free(ctx);
|
||||
bignum_ctx_free(ctx);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void dh_generate_f(SSH_SESSION *session){
|
||||
|
||||
Reference in New Issue
Block a user