summaryrefslogtreecommitdiff
path: root/usr.bin/ssh
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2001-01-19 16:50:59 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2001-01-19 16:50:59 +0000
commitf8a78e2664bf6f1f29ac701ec170911df3c4a47e (patch)
tree36a31f93fd565e53444889135f299e2f580b042f /usr.bin/ssh
parent4ba457aea33ef719a33d22132c1ba2a96033cbe1 (diff)
clear and free digest, make consistent with other code (use dlen); from stevesk@
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r--usr.bin/ssh/ssh-dss.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/ssh/ssh-dss.c b/usr.bin/ssh/ssh-dss.c
index 96b1565d232..4e7c94fcd88 100644
--- a/usr.bin/ssh/ssh-dss.c
+++ b/usr.bin/ssh/ssh-dss.c
@@ -23,7 +23,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: ssh-dss.c,v 1.2 2000/12/19 23:17:58 markus Exp $");
+RCSID("$OpenBSD: ssh-dss.c,v 1.3 2001/01/19 16:50:58 markus Exp $");
#include "ssh.h"
#include "xmalloc.h"
@@ -54,7 +54,7 @@ ssh_dss_sign(
EVP_MD_CTX md;
u_int rlen;
u_int slen;
- u_int len;
+ u_int len, dlen;
u_char sigblob[SIGBLOB_LEN];
Buffer b;
@@ -62,15 +62,18 @@ ssh_dss_sign(
error("ssh_dss_sign: no DSA key");
return -1;
}
- digest = xmalloc(evp_md->md_size);
+ dlen = evp_md->md_size;
+ digest = xmalloc(dlen);
EVP_DigestInit(&md, evp_md);
EVP_DigestUpdate(&md, data, datalen);
EVP_DigestFinal(&md, digest, NULL);
- sig = DSA_do_sign(digest, evp_md->md_size, key->dsa);
+ sig = DSA_do_sign(digest, dlen, key->dsa);
if (sig == NULL) {
fatal("ssh_dss_sign: cannot sign");
}
+ memset(digest, 0, dlen);
+ xfree(digest);
rlen = BN_num_bytes(sig->r);
slen = BN_num_bytes(sig->s);