summaryrefslogtreecommitdiff
path: root/dsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'dsa.c')
-rw-r--r--dsa.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/dsa.c b/dsa.c
index 580590809..51d7ff285 100644
--- a/dsa.c
+++ b/dsa.c
@@ -28,7 +28,7 @@
28 */ 28 */
29 29
30#include "includes.h" 30#include "includes.h"
31RCSID("$Id: dsa.c,v 1.6 2000/05/04 22:37:59 markus Exp $"); 31RCSID("$Id: dsa.c,v 1.7 2000/05/08 17:42:24 markus Exp $");
32 32
33#include "ssh.h" 33#include "ssh.h"
34#include "xmalloc.h" 34#include "xmalloc.h"
@@ -162,7 +162,7 @@ dsa_sign(
162 BN_bn2bin(sig->s, sigblob+ SIGBLOB_LEN - slen); 162 BN_bn2bin(sig->s, sigblob+ SIGBLOB_LEN - slen);
163 DSA_SIG_free(sig); 163 DSA_SIG_free(sig);
164 164
165 if (datafellows) { 165 if (datafellows & SSH_BUG_SIGBLOB) {
166 debug("datafellows"); 166 debug("datafellows");
167 ret = xmalloc(SIGBLOB_LEN); 167 ret = xmalloc(SIGBLOB_LEN);
168 memcpy(ret, sigblob, SIGBLOB_LEN); 168 memcpy(ret, sigblob, SIGBLOB_LEN);
@@ -209,15 +209,20 @@ dsa_verify(
209 return -1; 209 return -1;
210 } 210 }
211 211
212 if (datafellows && signaturelen != SIGBLOB_LEN) { 212 if (!(datafellows & SSH_BUG_SIGBLOB) &&
213 log("heh? datafellows ssh2 complies with ietf-drafts????"); 213 signaturelen == SIGBLOB_LEN) {
214 datafellows = 0; 214 datafellows |= ~SSH_BUG_SIGBLOB;
215 log("autodetect SSH_BUG_SIGBLOB");
216 } else if ((datafellows & SSH_BUG_SIGBLOB) &&
217 signaturelen != SIGBLOB_LEN) {
218 log("autoremove SSH_BUG_SIGBLOB");
219 datafellows &= ~SSH_BUG_SIGBLOB;
215 } 220 }
216 221
217 debug("len %d datafellows %d", signaturelen, datafellows); 222 debug("len %d datafellows %d", signaturelen, datafellows);
218 223
219 /* fetch signature */ 224 /* fetch signature */
220 if (datafellows) { 225 if (datafellows & SSH_BUG_SIGBLOB) {
221 sigblob = signature; 226 sigblob = signature;
222 len = signaturelen; 227 len = signaturelen;
223 } else { 228 } else {
@@ -242,7 +247,8 @@ dsa_verify(
242 sig->s = BN_new(); 247 sig->s = BN_new();
243 BN_bin2bn(sigblob, INTBLOB_LEN, sig->r); 248 BN_bin2bn(sigblob, INTBLOB_LEN, sig->r);
244 BN_bin2bn(sigblob+ INTBLOB_LEN, INTBLOB_LEN, sig->s); 249 BN_bin2bn(sigblob+ INTBLOB_LEN, INTBLOB_LEN, sig->s);
245 if (!datafellows) { 250
251 if (!(datafellows & SSH_BUG_SIGBLOB)) {
246 memset(sigblob, 0, len); 252 memset(sigblob, 0, len);
247 xfree(sigblob); 253 xfree(sigblob);
248 } 254 }