]> andersk Git - openssh.git/blobdiff - deattack.c
fix spacing of include
[openssh.git] / deattack.c
index 44220491d8c33e2ddb2f29638748dc43cccb64f0..0cf1e1c54f1c624fed18e3ee372c7f149670ea77 100644 (file)
@@ -1,5 +1,3 @@
-/*     $OpenBSD: deattack.c,v 1.15 2001/11/19 19:02:16 mpech Exp $     */
-
 /*
  * Cryptographic attack detector for ssh - source code
  *
@@ -20,6 +18,8 @@
  */
 
 #include "includes.h"
+RCSID("$OpenBSD: deattack.c,v 1.20 2006/02/07 03:59:20 stevesk Exp $");
+
 #include "deattack.h"
 #include "log.h"
 #include "crc32.h"
@@ -36,7 +36,7 @@
 #define HASH_FACTOR(x) ((x)*3/2)
 #define HASH_UNUSEDCHAR        (0xff)
 #define HASH_UNUSED    (0xffff)
-#define HASH_IV        (0xfffe)
+#define HASH_IV                (0xfffe)
 
 #define HASH_MINBLOCKS (7*SSH_BLOCKSIZE)
 
@@ -99,12 +99,12 @@ detect_attack(u_char *buf, u_int32_t len, u_char *IV)
 
        if (h == NULL) {
                debug("Installing crc compensation attack detector.");
+               h = (u_int16_t *) xmalloc(l * HASH_ENTRYSIZE);
                n = l;
-               h = (u_int16_t *) xmalloc(n * HASH_ENTRYSIZE);
        } else {
                if (l > n) {
+                       h = (u_int16_t *) xrealloc(h, l * HASH_ENTRYSIZE);
                        n = l;
-                       h = (u_int16_t *) xrealloc(h, n * HASH_ENTRYSIZE);
                }
        }
 
@@ -134,7 +134,7 @@ detect_attack(u_char *buf, u_int32_t len, u_char *IV)
 
        for (c = buf, j = 0; c < (buf + len); c += SSH_BLOCKSIZE, j++) {
                for (i = HASH(c) & (n - 1); h[i] != HASH_UNUSED;
-                    i = (i + 1) & (n - 1)) {
+                   i = (i + 1) & (n - 1)) {
                        if (h[i] == HASH_IV) {
                                if (!CMP(c, IV)) {
                                        if (check_crc(c, buf, len, IV))
This page took 0.032605 seconds and 4 git commands to generate.