/src/suricata7/src/datasets-md5.c
Line | Count | Source |
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-md5.h" |
28 | | #include "util-hash-lookup3.h" |
29 | | |
30 | | #include "util-thash.h" |
31 | | #include "util-print.h" |
32 | | #include "util-base64.h" // decode base64 |
33 | | |
34 | | int Md5StrSet(void *dst, void *src) |
35 | 0 | { |
36 | 0 | Md5Type *src_s = src; |
37 | 0 | Md5Type *dst_s = dst; |
38 | 0 | memcpy(dst_s->md5, src_s->md5, sizeof(dst_s->md5)); |
39 | 0 | dst_s->rep = src_s->rep; |
40 | 0 | return 0; |
41 | 0 | } |
42 | | |
43 | | bool Md5StrCompare(void *a, void *b) |
44 | 0 | { |
45 | 0 | const Md5Type *as = a; |
46 | 0 | const Md5Type *bs = b; |
47 | |
|
48 | 0 | return (memcmp(as->md5, bs->md5, sizeof(as->md5)) == 0); |
49 | 0 | } |
50 | | |
51 | | uint32_t Md5StrHash(uint32_t hash_seed, void *s) |
52 | 16 | { |
53 | 16 | const Md5Type *str = s; |
54 | 16 | return hashword((uint32_t *)str->md5, sizeof(str->md5) / 4, hash_seed); |
55 | 16 | } |
56 | | |
57 | | // data stays in hash |
58 | | void Md5StrFree(void *s) |
59 | 14.1M | { |
60 | 14.1M | } |