community-id: use Rust SHA1 to compute hash

Removes use of our internal ComputeSHA1 for calculating the
community ID.
pull/5722/head
Jason Ish 4 years ago committed by Victor Julien
parent eb5cfd9b82
commit 0321f60ebf

@ -668,7 +668,7 @@ static bool CalculateCommunityFlowIdv4(const Flow *f,
ipv4.pad0 = 0; ipv4.pad0 = 0;
uint8_t hash[20]; 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); strlcpy((char *)base64buf, "1:", COMMUNITY_ID_BUF_SIZE);
unsigned long out_len = COMMUNITY_ID_BUF_SIZE - 2; unsigned long out_len = COMMUNITY_ID_BUF_SIZE - 2;
if (Base64Encode(hash, sizeof(hash), base64buf+2, &out_len) == SC_BASE64_OK) { 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; ipv6.pad0 = 0;
uint8_t hash[20]; 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); strlcpy((char *)base64buf, "1:", COMMUNITY_ID_BUF_SIZE);
unsigned long out_len = COMMUNITY_ID_BUF_SIZE - 2; unsigned long out_len = COMMUNITY_ID_BUF_SIZE - 2;
if (Base64Encode(hash, sizeof(hash), base64buf+2, &out_len) == SC_BASE64_OK) { if (Base64Encode(hash, sizeof(hash), base64buf+2, &out_len) == SC_BASE64_OK) {

Loading…
Cancel
Save