diff options
Diffstat (limited to 'ssh-dss.c')
-rw-r--r-- | ssh-dss.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | RCSID("$OpenBSD: ssh-dss.c,v 1.18 2003/02/12 09:33:04 markus Exp $"); | 26 | RCSID("$OpenBSD: ssh-dss.c,v 1.19 2003/11/10 16:23:41 jakob Exp $"); |
27 | 27 | ||
28 | #include <openssl/bn.h> | 28 | #include <openssl/bn.h> |
29 | #include <openssl/evp.h> | 29 | #include <openssl/evp.h> |
@@ -39,8 +39,8 @@ RCSID("$OpenBSD: ssh-dss.c,v 1.18 2003/02/12 09:33:04 markus Exp $"); | |||
39 | #define SIGBLOB_LEN (2*INTBLOB_LEN) | 39 | #define SIGBLOB_LEN (2*INTBLOB_LEN) |
40 | 40 | ||
41 | int | 41 | int |
42 | ssh_dss_sign(Key *key, u_char **sigp, u_int *lenp, | 42 | ssh_dss_sign(const Key *key, u_char **sigp, u_int *lenp, |
43 | u_char *data, u_int datalen) | 43 | const u_char *data, u_int datalen) |
44 | { | 44 | { |
45 | DSA_SIG *sig; | 45 | DSA_SIG *sig; |
46 | const EVP_MD *evp_md = EVP_sha1(); | 46 | const EVP_MD *evp_md = EVP_sha1(); |
@@ -101,8 +101,8 @@ ssh_dss_sign(Key *key, u_char **sigp, u_int *lenp, | |||
101 | return 0; | 101 | return 0; |
102 | } | 102 | } |
103 | int | 103 | int |
104 | ssh_dss_verify(Key *key, u_char *signature, u_int signaturelen, | 104 | ssh_dss_verify(const Key *key, const u_char *signature, u_int signaturelen, |
105 | u_char *data, u_int datalen) | 105 | const u_char *data, u_int datalen) |
106 | { | 106 | { |
107 | DSA_SIG *sig; | 107 | DSA_SIG *sig; |
108 | const EVP_MD *evp_md = EVP_sha1(); | 108 | const EVP_MD *evp_md = EVP_sha1(); |
@@ -119,7 +119,8 @@ ssh_dss_verify(Key *key, u_char *signature, u_int signaturelen, | |||
119 | 119 | ||
120 | /* fetch signature */ | 120 | /* fetch signature */ |
121 | if (datafellows & SSH_BUG_SIGBLOB) { | 121 | if (datafellows & SSH_BUG_SIGBLOB) { |
122 | sigblob = signature; | 122 | sigblob = xmalloc(signaturelen); |
123 | memcpy(sigblob, signature, signaturelen); | ||
123 | len = signaturelen; | 124 | len = signaturelen; |
124 | } else { | 125 | } else { |
125 | /* ietf-drafts */ | 126 | /* ietf-drafts */ |
@@ -159,10 +160,9 @@ ssh_dss_verify(Key *key, u_char *signature, u_int signaturelen, | |||
159 | BN_bin2bn(sigblob, INTBLOB_LEN, sig->r); | 160 | BN_bin2bn(sigblob, INTBLOB_LEN, sig->r); |
160 | BN_bin2bn(sigblob+ INTBLOB_LEN, INTBLOB_LEN, sig->s); | 161 | BN_bin2bn(sigblob+ INTBLOB_LEN, INTBLOB_LEN, sig->s); |
161 | 162 | ||
162 | if (!(datafellows & SSH_BUG_SIGBLOB)) { | 163 | /* clean up */ |
163 | memset(sigblob, 0, len); | 164 | memset(sigblob, 0, len); |
164 | xfree(sigblob); | 165 | xfree(sigblob); |
165 | } | ||
166 | 166 | ||
167 | /* sha1 the data */ | 167 | /* sha1 the data */ |
168 | EVP_DigestInit(&md, evp_md); | 168 | EVP_DigestInit(&md, evp_md); |