Lines Matching refs:dctx
98 deattack_init(struct deattack_ctx *dctx) in deattack_init() argument
100 bzero(dctx, sizeof(*dctx)); in deattack_init()
101 dctx->n = HASH_MINSIZE / HASH_ENTRYSIZE; in deattack_init()
106 detect_attack(struct deattack_ctx *dctx, const u_char *buf, u_int32_t len) in detect_attack() argument
115 for (l = dctx->n; l < HASH_FACTOR(len / SSH_BLOCKSIZE); l = l << 2) in detect_attack()
118 if (dctx->h == NULL) { in detect_attack()
119 if ((dctx->h = calloc(l, HASH_ENTRYSIZE)) == NULL) in detect_attack()
121 dctx->n = l; in detect_attack()
123 if (l > dctx->n) { in detect_attack()
124 if ((tmp = reallocarray(dctx->h, l, HASH_ENTRYSIZE)) in detect_attack()
126 free(dctx->h); in detect_attack()
127 dctx->h = NULL; in detect_attack()
130 dctx->h = tmp; in detect_attack()
131 dctx->n = l; in detect_attack()
148 memset(dctx->h, HASH_UNUSEDCHAR, dctx->n * HASH_ENTRYSIZE); in detect_attack()
151 for (i = HASH(c) & (dctx->n - 1); dctx->h[i] != HASH_UNUSED; in detect_attack()
152 i = (i + 1) & (dctx->n - 1)) { in detect_attack()
153 if (!CMP(c, buf + dctx->h[i] * SSH_BLOCKSIZE)) { in detect_attack()
162 dctx->h[i] = j; in detect_attack()