diff options
Diffstat (limited to 'ssh-dss.c')
-rw-r--r-- | ssh-dss.c | 26 |
1 files changed, 11 insertions, 15 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.16 2002/07/04 04:15:33 deraadt Exp $"); | 26 | RCSID("$OpenBSD: ssh-dss.c,v 1.17 2002/07/04 10:41:47 markus Exp $"); |
27 | 27 | ||
28 | #include <openssl/bn.h> | 28 | #include <openssl/bn.h> |
29 | #include <openssl/evp.h> | 29 | #include <openssl/evp.h> |
@@ -46,7 +46,7 @@ ssh_dss_sign(Key *key, u_char **sigp, u_int *lenp, | |||
46 | DSA_SIG *sig; | 46 | DSA_SIG *sig; |
47 | const EVP_MD *evp_md = EVP_sha1(); | 47 | const EVP_MD *evp_md = EVP_sha1(); |
48 | EVP_MD_CTX md; | 48 | EVP_MD_CTX md; |
49 | u_char *ret, digest[EVP_MAX_MD_SIZE], sigblob[SIGBLOB_LEN]; | 49 | u_char digest[EVP_MAX_MD_SIZE], sigblob[SIGBLOB_LEN]; |
50 | u_int rlen, slen, len, dlen; | 50 | u_int rlen, slen, len, dlen; |
51 | Buffer b; | 51 | Buffer b; |
52 | 52 | ||
@@ -79,29 +79,25 @@ ssh_dss_sign(Key *key, u_char **sigp, u_int *lenp, | |||
79 | DSA_SIG_free(sig); | 79 | DSA_SIG_free(sig); |
80 | 80 | ||
81 | if (datafellows & SSH_BUG_SIGBLOB) { | 81 | if (datafellows & SSH_BUG_SIGBLOB) { |
82 | ret = xmalloc(SIGBLOB_LEN); | ||
83 | memcpy(ret, sigblob, SIGBLOB_LEN); | ||
84 | if (lenp != NULL) | 82 | if (lenp != NULL) |
85 | *lenp = SIGBLOB_LEN; | 83 | *lenp = SIGBLOB_LEN; |
86 | if (sigp != NULL) | 84 | if (sigp != NULL) { |
87 | *sigp = ret; | 85 | *sigp = xmalloc(SIGBLOB_LEN); |
88 | else | 86 | memcpy(*sigp, sigblob, SIGBLOB_LEN); |
89 | xfree(ret); | 87 | } |
90 | } else { | 88 | } else { |
91 | /* ietf-drafts */ | 89 | /* ietf-drafts */ |
92 | buffer_init(&b); | 90 | buffer_init(&b); |
93 | buffer_put_cstring(&b, "ssh-dss"); | 91 | buffer_put_cstring(&b, "ssh-dss"); |
94 | buffer_put_string(&b, sigblob, SIGBLOB_LEN); | 92 | buffer_put_string(&b, sigblob, SIGBLOB_LEN); |
95 | len = buffer_len(&b); | 93 | len = buffer_len(&b); |
96 | ret = xmalloc(len); | ||
97 | memcpy(ret, buffer_ptr(&b), len); | ||
98 | buffer_free(&b); | ||
99 | if (lenp != NULL) | 94 | if (lenp != NULL) |
100 | *lenp = len; | 95 | *lenp = len; |
101 | if (sigp != NULL) | 96 | if (sigp != NULL) { |
102 | *sigp = ret; | 97 | *sigp = xmalloc(len); |
103 | else | 98 | memcpy(*sigp, buffer_ptr(&b), len); |
104 | xfree(ret); | 99 | } |
100 | buffer_free(&b); | ||
105 | } | 101 | } |
106 | return 0; | 102 | return 0; |
107 | } | 103 | } |