| 1 | /* |
| 2 | * AIDE (Advanced Intrusion Detection Environment) |
| 3 | * |
| 4 | * Copyright (C) 2020,2022,2024,2025 Hannes von Haugwitz |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License as |
| 8 | * published by the Free Software Foundation; either version 2 of the |
| 9 | * License, or (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, but |
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License along |
| 17 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 19 | */ |
| 20 | |
| 21 | #ifndef _HASHSUM_H_INCLUDED |
| 22 | #define _HASHSUM_H_INCLUDED |
| 23 | |
| 24 | #include "attributes.h" |
| 25 | #include <stdbool.h> |
| 26 | |
| 27 | typedef struct { |
| 28 | ATTRIBUTE attribute; |
| 29 | int length; |
| 30 | } hashsum_t; |
| 31 | |
| 32 | typedef enum { |
| 33 | hash_md5=0, |
| 34 | hash_sha1, |
| 35 | hash_sha256, |
| 36 | hash_sha512, |
| 37 | hash_rmd160, |
| 38 | hash_tiger, |
| 39 | hash_crc32, |
| 40 | hash_crc32b, |
| 41 | hash_haval, |
| 42 | hash_whirlpool, |
| 43 | hash_gostr3411_94, |
| 44 | hash_stribog256, |
| 45 | hash_stribog512, |
| 46 | hash_sha512_256, |
| 47 | hash_sha3_256, |
| 48 | hash_sha3_512, |
| 49 | num_hashes, |
| 50 | } HASHSUM; |
| 51 | |
| 52 | /* max length of hashsum in hashsums[] defined in hashsum.c */ |
| 53 | #define HASHSUM_MAX_LENGTH 64 |
| 54 | |
| 55 | extern hashsum_t hashsums[]; |
| 56 | |
| 57 | extern int algorithms[]; |
| 58 | |
| 59 | extern DB_ATTR_TYPE DEPRECATED_HASHES; |
| 60 | extern DB_ATTR_TYPE REMOVED_HASHES; |
| 61 | |
| 62 | void init_hashsum_lib(void); |
| 63 | |
| 64 | DB_ATTR_TYPE get_hashes(bool); |
| 65 | |
| 66 | DB_ATTR_TYPE validate_hashes(DB_ATTR_TYPE, int, char*, char*); |
| 67 | |
| 68 | DB_ATTR_TYPE get_transition_hashsums(char *, DB_ATTR_TYPE, char *, DB_ATTR_TYPE); |
| 69 | DB_ATTR_TYPE get_hashsums_to_ignore(char *, DB_ATTR_TYPE, char *, DB_ATTR_TYPE); |
| 70 | |
| 71 | #endif /* _HASHSUM_H_INCLUDED */ |