diff options
Diffstat (limited to 'src/lib/protocols/tls.c')
-rw-r--r-- | src/lib/protocols/tls.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/lib/protocols/tls.c b/src/lib/protocols/tls.c index 9bc948f23..fb3bd7d2e 100644 --- a/src/lib/protocols/tls.c +++ b/src/lib/protocols/tls.c @@ -1605,8 +1605,7 @@ static void ndpi_compute_ja4(struct ndpi_detection_module_struct *ndpi_struct, union ja_info *ja) { u_int8_t tmp_str[JA_STR_LEN]; u_int tmp_str_len, num_extn; - SHA256_CTX sha_ctx; - u_int8_t sha_hash[SHA256_BLOCK_SIZE]; + u_int8_t sha_hash[NDPI_SHA256_BLOCK_SIZE]; char ja_str[JA_STR_LEN]; u_int16_t ja_str_len, i; int rc; @@ -1690,9 +1689,7 @@ static void ndpi_compute_ja4(struct ndpi_detection_module_struct *ndpi_struct, if((rc > 0) && (tmp_str_len + rc < JA_STR_LEN)) tmp_str_len += rc; else break; } - ndpi_sha256_init(&sha_ctx); - ndpi_sha256_update(&sha_ctx, tmp_str, tmp_str_len); - ndpi_sha256_final(&sha_ctx, sha_hash); + ndpi_sha256(tmp_str, tmp_str_len, sha_hash); rc = ndpi_snprintf(&ja_str[ja_str_len], JA_STR_LEN-ja_str_len, "%02x%02x%02x%02x%02x%02x_", @@ -1724,9 +1721,7 @@ static void ndpi_compute_ja4(struct ndpi_detection_module_struct *ndpi_struct, printf("[EXTN] %s [len: %u]\n", tmp_str, tmp_str_len); #endif - ndpi_sha256_init(&sha_ctx); - ndpi_sha256_update(&sha_ctx, tmp_str, tmp_str_len); - ndpi_sha256_final(&sha_ctx, sha_hash); + ndpi_sha256(tmp_str, tmp_str_len, sha_hash); rc = ndpi_snprintf(&ja_str[ja_str_len], JA_STR_LEN-ja_str_len, "%02x%02x%02x%02x%02x%02x", |