summaryrefslogtreecommitdiff
path: root/ssh-dss.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-dss.c')
-rw-r--r--ssh-dss.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/ssh-dss.c b/ssh-dss.c
index dbf8465ba..9ba2584dd 100644
--- a/ssh-dss.c
+++ b/ssh-dss.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: ssh-dss.c,v 1.15 2002/06/23 03:30:17 deraadt Exp $"); 26RCSID("$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,25 +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);
86 memcpy(*sigp, sigblob, SIGBLOB_LEN);
87 }
88 } else { 88 } else {
89 /* ietf-drafts */ 89 /* ietf-drafts */
90 buffer_init(&b); 90 buffer_init(&b);
91 buffer_put_cstring(&b, "ssh-dss"); 91 buffer_put_cstring(&b, "ssh-dss");
92 buffer_put_string(&b, sigblob, SIGBLOB_LEN); 92 buffer_put_string(&b, sigblob, SIGBLOB_LEN);
93 len = buffer_len(&b); 93 len = buffer_len(&b);
94 ret = xmalloc(len);
95 memcpy(ret, buffer_ptr(&b), len);
96 buffer_free(&b);
97 if (lenp != NULL) 94 if (lenp != NULL)
98 *lenp = len; 95 *lenp = len;
99 if (sigp != NULL) 96 if (sigp != NULL) {
100 *sigp = ret; 97 *sigp = xmalloc(len);
98 memcpy(*sigp, buffer_ptr(&b), len);
99 }
100 buffer_free(&b);
101 } 101 }
102 return 0; 102 return 0;
103} 103}