aboutsummaryrefslogtreecommitdiff
path: root/libssh/dh.c
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-04-16 14:31:06 +0000
committerAndreas Schneider <mail@cynapses.org>2009-04-16 14:31:06 +0000
commitbaf2eaf16503ae6c2ed36614fa1b5f2c31bdca1e (patch)
tree32f8943ef5ba831205dc651ab71c4b0de0d88957 /libssh/dh.c
parentece047171a45dc09d12e08753d3c7a08c5a2a73c (diff)
downloadlibssh-baf2eaf16503ae6c2ed36614fa1b5f2c31bdca1e.tar.gz
libssh-baf2eaf16503ae6c2ed36614fa1b5f2c31bdca1e.tar.xz
libssh-baf2eaf16503ae6c2ed36614fa1b5f2c31bdca1e.zip
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
Diffstat (limited to 'libssh/dh.c')
-rw-r--r--libssh/dh.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/libssh/dh.c b/libssh/dh.c
index f968421..db916b8 100644
--- a/libssh/dh.c
+++ b/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){