aboutsummaryrefslogtreecommitdiff
path: root/libssh/keys.c
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-04-18 10:53:28 +0000
committerAndreas Schneider <mail@cynapses.org>2009-04-18 10:53:28 +0000
commitd20ae18b00e8926df925167a2a63234f654e3817 (patch)
tree8dc8f259e1c540a6b64daea24a26509ac5d6ded3 /libssh/keys.c
parentfa01372c88b36378afb25c36bb080282989dd2d4 (diff)
downloadlibssh-d20ae18b00e8926df925167a2a63234f654e3817.tar.gz
libssh-d20ae18b00e8926df925167a2a63234f654e3817.tar.xz
libssh-d20ae18b00e8926df925167a2a63234f654e3817.zip
Fix segfault with gcrypt.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@542 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/keys.c')
-rw-r--r--libssh/keys.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/libssh/keys.c b/libssh/keys.c
index 4a5a25e..039f8f1 100644
--- a/libssh/keys.c
+++ b/libssh/keys.c
@@ -626,7 +626,6 @@ static int rsa_public_to_string(RSA *key, BUFFER *buffer) {
goto error;
}
string_fill(e, (char *) tmp, size);
- gcry_sexp_release(sexp);
#elif defined HAVE_LIBCRYPTO
e = make_bignum_string(key->e);
@@ -676,16 +675,20 @@ STRING *publickey_to_string(PUBLIC_KEY *key) {
if (type == NULL) {
goto error;
}
- buffer_add_ssh_string(buf, type);
+
+ if (buffer_add_ssh_string(buf, type) < 0) {
+ goto error;
+ }
+
switch(key->type){
case TYPE_DSS:
- if (dsa_public_to_string(key->dsa_pub,buf) < 0) {
+ if (dsa_public_to_string(key->dsa_pub, buf) < 0) {
goto error;
}
break;
case TYPE_RSA:
case TYPE_RSA1:
- if (rsa_public_to_string(key->rsa_pub,buf) < 0) {
+ if (rsa_public_to_string(key->rsa_pub, buf) < 0) {
goto error;
}
break;
@@ -1257,7 +1260,7 @@ STRING *ssh_do_sign(SSH_SESSION *session, BUFFER *sigbuf,
STRING *ssh_encrypt_rsa1(SSH_SESSION *session, STRING *data, PUBLIC_KEY *key) {
STRING *str = NULL;
size_t len = string_len(data);
- int size = 0;
+ size_t size = 0;
#ifdef HAVE_LIBGCRYPT
const char *tmp = NULL;
gcry_sexp_t ret_sexp;