Coverage Report

Created: 2025-07-23 07:29

/src/suricata7/src/datasets-sha256.c
Line
Count
Source (jump to first uncovered line)
1
/* Copyright (C) 2017-2019 Open Information Security Foundation
2
 *
3
 * You can copy, redistribute or modify this Program under the terms of
4
 * the GNU General Public License version 2 as published by the Free
5
 * Software Foundation.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 * GNU General Public License for more details.
11
 *
12
 * You should have received a copy of the GNU General Public License
13
 * version 2 along with this program; if not, write to the Free Software
14
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15
 * 02110-1301, USA.
16
 */
17
18
/**
19
 * \file
20
 *
21
 * \author Victor Julien <victor@inliniac.net>
22
 */
23
24
#include "suricata-common.h"
25
#include "conf.h"
26
#include "datasets.h"
27
#include "datasets-sha256.h"
28
#include "util-hash-lookup3.h"
29
#include "util-thash.h"
30
31
int Sha256StrSet(void *dst, void *src)
32
0
{
33
0
    Sha256Type *src_s = src;
34
0
    Sha256Type *dst_s = dst;
35
0
    memcpy(dst_s->sha256, src_s->sha256, sizeof(dst_s->sha256));
36
0
    dst_s->rep = src_s->rep;
37
0
    return 0;
38
0
}
39
40
bool Sha256StrCompare(void *a, void *b)
41
0
{
42
0
    Sha256Type *as = a;
43
0
    Sha256Type *bs = b;
44
45
0
    return (memcmp(as->sha256, bs->sha256, sizeof(as->sha256)) == 0);
46
0
}
47
48
uint32_t Sha256StrHash(uint32_t hash_seed, void *s)
49
0
{
50
0
    Sha256Type *str = s;
51
0
    return hashword((uint32_t *)str->sha256, sizeof(str->sha256) / 4, hash_seed);
52
0
}
53
54
// data stays in hash
55
void Sha256StrFree(void *s)
56
2.10M
{
57
    // no dynamic data
58
2.10M
}