Skip to content

Commit 4380ee0

Browse files
committed
nginx-ssl-ja3: check if ja3 fp is calculated
1 parent c7b43a9 commit 4380ee0

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/ngx_http_ssl_ja3_module.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,17 @@ ngx_http_ssl_ja3_hash(ngx_http_request_t *r,
8383
return NGX_ERROR;
8484
}
8585

86-
ngx_ssl_ja3(r->connection, r->pool, &ja3);
86+
if (ngx_ssl_ja3(r->connection, r->pool, &ja3) == NGX_DECLINED) {
87+
return NGX_ERROR;
88+
}
89+
8790
ngx_ssl_ja3_fp(r->pool, &ja3, &fp);
8891

8992
ngx_md5_init(&ctx);
9093
ngx_md5_update(&ctx, fp.data, fp.len);
9194
ngx_md5_final(hash, &ctx);
92-
9395
ngx_hex_dump(v->data, hash, 16);
96+
9497
v->len = 32;
9598
v->valid = 1;
9699
v->no_cacheable = 1;

src/ngx_stream_ssl_ja3_preread_module.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,17 @@ ngx_stream_ssl_ja3_hash(ngx_stream_session_t *s,
7979
return NGX_ERROR;
8080
}
8181

82-
ngx_ssl_ja3(s->connection, s->connection->pool, &ja3);
82+
if (ngx_ssl_ja3(s->connection, s->connection->pool, &ja3) == NGX_DECLINED) {
83+
return NGX_ERROR;
84+
}
8385
ngx_ssl_ja3_fp(s->connection->pool, &ja3, &fp);
8486

8587

8688
ngx_md5_init(&ctx);
8789
ngx_md5_update(&ctx, fp.data, fp.len);
8890
ngx_md5_final(hash, &ctx);
89-
9091
ngx_hex_dump(v->data, hash, 16);
92+
9193
v->len = 32;
9294
v->valid = 1;
9395
v->no_cacheable = 1;

0 commit comments

Comments
 (0)