]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
community-id: use Rust SHA1 to compute hash
authorJason Ish <jason.ish@oisf.net>
Wed, 23 Dec 2020 15:48:14 +0000 (09:48 -0600)
committerVictor Julien <victor@inliniac.net>
Tue, 12 Jan 2021 20:17:29 +0000 (21:17 +0100)
Removes use of our internal ComputeSHA1 for calculating the
community ID.

src/output-json.c

index c13eef6fc03279a8c7a470c0024a7bbb54ce62c4..11c3d59f1e1870c7d8336989ec384c61e74f4cc8 100644 (file)
@@ -668,7 +668,7 @@ static bool CalculateCommunityFlowIdv4(const Flow *f,
     ipv4.pad0 = 0;
 
     uint8_t hash[20];
-    if (ComputeSHA1((const uint8_t *)&ipv4, sizeof(ipv4), hash, sizeof(hash)) == 1) {
+    if (SCSha1HashBuffer((const uint8_t *)&ipv4, sizeof(ipv4), hash, sizeof(hash)) == 1) {
         strlcpy((char *)base64buf, "1:", COMMUNITY_ID_BUF_SIZE);
         unsigned long out_len = COMMUNITY_ID_BUF_SIZE - 2;
         if (Base64Encode(hash, sizeof(hash), base64buf+2, &out_len) == SC_BASE64_OK) {
@@ -730,7 +730,7 @@ static bool CalculateCommunityFlowIdv6(const Flow *f,
     ipv6.pad0 = 0;
 
     uint8_t hash[20];
-    if (ComputeSHA1((const uint8_t *)&ipv6, sizeof(ipv6), hash, sizeof(hash)) == 1) {
+    if (SCSha1HashBuffer((const uint8_t *)&ipv6, sizeof(ipv6), hash, sizeof(hash)) == 1) {
         strlcpy((char *)base64buf, "1:", COMMUNITY_ID_BUF_SIZE);
         unsigned long out_len = COMMUNITY_ID_BUF_SIZE - 2;
         if (Base64Encode(hash, sizeof(hash), base64buf+2, &out_len) == SC_BASE64_OK) {