summaryrefslogtreecommitdiffstats
path: root/libssh/dh.c
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-04-16 14:27:50 +0000
committerAndreas Schneider <mail@cynapses.org>2009-04-16 14:27:50 +0000
commitece047171a45dc09d12e08753d3c7a08c5a2a73c (patch)
tree489fef26ac5582f762b12a02eaff05b016a191db /libssh/dh.c
parent5dc03728ed48c0b60715af36c09804a88c0751f2 (diff)
downloadlibssh-ece047171a45dc09d12e08753d3c7a08c5a2a73c.tar.gz
libssh-ece047171a45dc09d12e08753d3c7a08c5a2a73c.tar.xz
libssh-ece047171a45dc09d12e08753d3c7a08c5a2a73c.zip
Add return value to dh_generate_y().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@499 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/dh.c')
-rw-r--r--libssh/dh.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/libssh/dh.c b/libssh/dh.c
index 439d198..f968421 100644
--- a/libssh/dh.c
+++ b/libssh/dh.c
@@ -234,18 +234,26 @@ int dh_generate_x(SSH_SESSION *session) {
}
/* used by server */
-void dh_generate_y(SSH_SESSION *session){
- session->next_crypto->y=bignum_new();
+int dh_generate_y(SSH_SESSION *session) {
+ session->next_crypto->y = bignum_new();
+ if (session->next_crypto->y == NULL) {
+ return -1;
+ }
+
#ifdef HAVE_LIBGCRYPT
- bignum_rand(session->next_crypto->y,128);
+ bignum_rand(session->next_crypto->y, 128);
#elif defined HAVE_LIBCRYPTO
- bignum_rand(session->next_crypto->y,128,0,-1);
+ bignum_rand(session->next_crypto->y, 128, 0, -1);
#endif
- /* not harder than this */
+
+ /* not harder than this */
#ifdef DEBUG_CRYPTO
- ssh_print_bignum("y",session->next_crypto->y);
+ ssh_print_bignum("y", session->next_crypto->y);
#endif
+
+ return 0;
}
+
/* used by server */
void dh_generate_e(SSH_SESSION *session){
#ifdef HAVE_LIBCRYPTO