summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/ssh-rsa.c
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2013-05-17 00:13:15 +0000
committerDamien Miller <djm@cvs.openbsd.org>2013-05-17 00:13:15 +0000
commit409be4d4675d916b5b1c9fa8479f8bfb976bf6f8 (patch)
tree0f56c7b11057de46f80c5ef8b2e149fa995cf67a /usr.bin/ssh/ssh-rsa.c
parentaf69bdb6a9d8cb8abd4fa0691ae6551f912e4776 (diff)
bye, bye xfree(); ok markus@
Diffstat (limited to 'usr.bin/ssh/ssh-rsa.c')
-rw-r--r--usr.bin/ssh/ssh-rsa.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/usr.bin/ssh/ssh-rsa.c b/usr.bin/ssh/ssh-rsa.c
index 5766582976f..90e0cba263b 100644
--- a/usr.bin/ssh/ssh-rsa.c
+++ b/usr.bin/ssh/ssh-rsa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-rsa.c,v 1.45 2010/08/31 09:58:37 djm Exp $ */
+/* $OpenBSD: ssh-rsa.c,v 1.46 2013/05/17 00:13:14 djm Exp $ */
/*
* Copyright (c) 2000, 2003 Markus Friedl <markus@openbsd.org>
*
@@ -69,7 +69,7 @@ ssh_rsa_sign(const Key *key, u_char **sigp, u_int *lenp,
error("ssh_rsa_sign: RSA_sign failed: %s",
ERR_error_string(ecode, NULL));
- xfree(sig);
+ free(sig);
return -1;
}
if (len < slen) {
@@ -79,7 +79,7 @@ ssh_rsa_sign(const Key *key, u_char **sigp, u_int *lenp,
memset(sig, 0, diff);
} else if (len > slen) {
error("ssh_rsa_sign: slen %u slen2 %u", slen, len);
- xfree(sig);
+ free(sig);
return -1;
}
/* encode signature */
@@ -95,7 +95,7 @@ ssh_rsa_sign(const Key *key, u_char **sigp, u_int *lenp,
}
buffer_free(&b);
memset(sig, 's', slen);
- xfree(sig);
+ free(sig);
return 0;
}
@@ -128,23 +128,23 @@ ssh_rsa_verify(const Key *key, const u_char *signature, u_int signaturelen,
if (strcmp("ssh-rsa", ktype) != 0) {
error("ssh_rsa_verify: cannot handle type %s", ktype);
buffer_free(&b);
- xfree(ktype);
+ free(ktype);
return -1;
}
- xfree(ktype);
+ free(ktype);
sigblob = buffer_get_string(&b, &len);
rlen = buffer_len(&b);
buffer_free(&b);
if (rlen != 0) {
error("ssh_rsa_verify: remaining bytes in signature %d", rlen);
- xfree(sigblob);
+ free(sigblob);
return -1;
}
/* RSA_verify expects a signature of RSA_size */
modlen = RSA_size(key->rsa);
if (len > modlen) {
error("ssh_rsa_verify: len %u > modlen %u", len, modlen);
- xfree(sigblob);
+ free(sigblob);
return -1;
} else if (len < modlen) {
u_int diff = modlen - len;
@@ -158,7 +158,7 @@ ssh_rsa_verify(const Key *key, const u_char *signature, u_int signaturelen,
nid = (datafellows & SSH_BUG_RSASIGMD5) ? NID_md5 : NID_sha1;
if ((evp_md = EVP_get_digestbynid(nid)) == NULL) {
error("ssh_rsa_verify: EVP_get_digestbynid %d failed", nid);
- xfree(sigblob);
+ free(sigblob);
return -1;
}
EVP_DigestInit(&md, evp_md);
@@ -168,7 +168,7 @@ ssh_rsa_verify(const Key *key, const u_char *signature, u_int signaturelen,
ret = openssh_RSA_verify(nid, digest, dlen, sigblob, len, key->rsa);
memset(digest, 'd', sizeof(digest));
memset(sigblob, 's', len);
- xfree(sigblob);
+ free(sigblob);
debug("ssh_rsa_verify: signature %scorrect", (ret==0) ? "in" : "");
return ret;
}
@@ -259,7 +259,6 @@ openssh_RSA_verify(int type, u_char *hash, u_int hashlen,
}
ret = 1;
done:
- if (decrypted)
- xfree(decrypted);
+ free(decrypted);
return ret;
}