diff options
author | Andreas Schneider <mail@cynapses.org> | 2009-04-16 14:50:53 +0000 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-04-16 14:50:53 +0000 |
commit | c6eb54c39e4663c8f9ea82e8bf29bfdb3c8d945a (patch) | |
tree | 6a5df0628e9356be11cac56f5068f5724f3b7709 /libssh/dh.c | |
parent | e8a9cb25febeccd97aed9eb8e04da0b9f89b5a33 (diff) | |
download | libssh-c6eb54c39e4663c8f9ea82e8bf29bfdb3c8d945a.tar.gz libssh-c6eb54c39e4663c8f9ea82e8bf29bfdb3c8d945a.tar.xz libssh-c6eb54c39e4663c8f9ea82e8bf29bfdb3c8d945a.zip |
Improve dh_import() functions.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@505 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/dh.c')
-rw-r--r-- | libssh/dh.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/libssh/dh.c b/libssh/dh.c index 9eb4810..4f37615 100644 --- a/libssh/dh.c +++ b/libssh/dh.c @@ -380,19 +380,31 @@ void dh_import_pubkey(SSH_SESSION *session, STRING *pubkey_string) { session->next_crypto->server_pubkey = pubkey_string; } -void dh_import_f(SSH_SESSION *session,STRING *f_string){ - session->next_crypto->f=make_string_bn(f_string); +int dh_import_f(SSH_SESSION *session, STRING *f_string) { + session->next_crypto->f = make_string_bn(f_string); + if (session->next_crypto->f == NULL) { + return -1; + } + #ifdef DEBUG_CRYPTO - ssh_print_bignum("f",session->next_crypto->f); + ssh_print_bignum("f",session->next_crypto->f); #endif + + return 0; } /* used by the server implementation */ -void dh_import_e(SSH_SESSION *session, STRING *e_string){ - session->next_crypto->e=make_string_bn(e_string); +int dh_import_e(SSH_SESSION *session, STRING *e_string) { + session->next_crypto->e = make_string_bn(e_string); + if (session->next_crypto->e == NULL) { + return -1; + } + #ifdef DEBUG_CRYPTO ssh_print_bignum("e",session->next_crypto->e); #endif + + return 0; } void dh_build_k(SSH_SESSION *session){ |