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