| 1 | /* |
| 2 | * AIDE (Advanced Intrusion Detection Environment) |
| 3 | * |
| 4 | * Copyright (C) 2000-2002, 2005-2006, 2020, 2022, 2024, 2025 Rami Lehti, |
| 5 | * Pablo Virolainen, Richard van den Berg, Hannes von Haugwitz |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU General Public License as |
| 9 | * published by the Free Software Foundation; either version 2 of the |
| 10 | * License, or (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License along |
| 18 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | */ |
| 21 | |
| 22 | #ifndef _MD_H_INCLUDED |
| 23 | #define _MD_H_INCLUDEDcxx . . $ `include/md.h:23:9`! |
| 24 | |
| 25 | #include "config.h"cxx . . $ `<file>/include/config.h`/ |
| 26 | #ifdef WITH_NETTLEcxx . . $ `./include/config.h:254:9`! |
| 27 | #include <nettle/md5.h> |
| 28 | #include <nettle/sha1.h> |
| 29 | #include <nettle/sha2.h> |
| 30 | #include <nettle/sha3.h> |
| 31 | #include <nettle/ripemd160.h> |
| 32 | #include <nettle/gosthash94.h> |
| 33 | #include <nettle/streebog.h> |
| 34 | #endif |
| 35 | #ifdef WITH_GCRYPT |
| 36 | #include <gcrypt.h> |
| 37 | #endif |
| 38 | #include <sys/types.h> |
| 39 | #include "attributes.h"cxx . . $ `<file>/include/attributes.h`/ |
| 40 | #include "hashsum.h"cxx . . $ `<file>/include/hashsum.h`/ |
| 41 | #include "util.h"cxx . . $ `<file>/include/util.h`/ |
| 42 | struct db_linecxx . . $ db_line#; |
| 43 | |
| 44 | /* |
| 45 | This struct hold's internal data needed for md-calls. |
| 46 | |
| 47 | */ |
| 48 | |
| 49 | typedef struct md_containercxx . . $ md_container# { |
| 50 | /* |
| 51 | Attr which are to be calculated. |
| 52 | */ |
| 53 | DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! calc_attrcxx . . $ md_container#calc_attr.; |
| 54 | /* |
| 55 | Attr which are not (yet) to be calculated. |
| 56 | After init hold's hashes which are not calculated :) |
| 57 | */ |
| 58 | DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! todo_attrcxx . . $ md_container#todo_attr.; |
| 59 | |
| 60 | /* |
| 61 | Variables needed to cope with the library. |
| 62 | */ |
| 63 | #ifdef WITH_NETTLEcxx . . $ `./include/config.h:254:9`! |
| 64 | unioncxx . . $ md_container#$anonymous_type_0# { |
| 65 | struct md5_ctxcxx . . $ md5_ctx# md5cxx . . $ md_container#$anonymous_type_0#md5.; |
| 66 | struct sha1_ctxcxx . . $ sha1_ctx# sha1cxx . . $ md_container#$anonymous_type_0#sha1.; |
| 67 | struct sha256_ctxcxx . . $ sha256_ctx# sha256cxx . . $ md_container#$anonymous_type_0#sha256.; |
| 68 | struct sha512_ctxcxx . . $ sha512_ctx# sha512cxx . . $ md_container#$anonymous_type_0#sha512.; |
| 69 | struct ripemd160_ctxcxx . . $ ripemd160_ctx# ripemd160cxx . . $ md_container#$anonymous_type_0#ripemd160.; |
| 70 | struct gosthash94_ctxcxx . . $ gosthash94_ctx# gosthash94cxx . . $ md_container#$anonymous_type_0#gosthash94.; |
| 71 | struct streebog256_ctxcxx . . $ streebog512_ctx# streebog256cxx . . $ md_container#$anonymous_type_0#streebog256.; |
| 72 | struct streebog512_ctxcxx . . $ streebog512_ctx# streebog512cxx . . $ md_container#$anonymous_type_0#streebog512.; |
| 73 | struct sha512_256_ctxcxx . . $ sha512_ctx# sha512_256cxx . . $ md_container#$anonymous_type_0#sha512_256.; |
| 74 | struct sha3_512_ctxcxx . . $ sha3_512_ctx# sha3_256cxx . . $ md_container#$anonymous_type_0#sha3_256.; |
| 75 | struct sha3_256_ctxcxx . . $ sha3_256_ctx# sha3_512cxx . . $ md_container#$anonymous_type_0#sha3_512.; |
| 76 | } ctxcxx . . $ md_container#ctx.[num_hashescxx . . $ num_hashes.]; |
| 77 | #endif |
| 78 | |
| 79 | #ifdef WITH_GCRYPT |
| 80 | gcry_md_hd_t mdh; |
| 81 | #endif |
| 82 | |
| 83 | } md_containercxx . . $ md_container#; |
| 84 | |
| 85 | typedef struct md_hashsumscxx . . $ md_hashsums# { |
| 86 | unsigned char hashsumscxx . . $ md_hashsums#hashsums.[num_hashescxx . . $ num_hashes.][HASHSUM_MAX_LENGTHcxx . . $ `include/hashsum.h:53:9`!]; |
| 87 | DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! attrscxx . . $ md_hashsums#attrs.; |
| 88 | } md_hashsumscxx . . $ md_hashsums#; |
| 89 | |
| 90 | int init_mdcxx . . $ init_md(74d27db1f5e1726).(struct md_containercxx . . $ md_container#*, const char*, const char *); |
| 91 | int update_mdcxx . . $ update_md(29e99b095fc90fd4).(struct md_containercxx . . $ md_container#*,void*,ssize_tcxx . . $ ssize_t#); |
| 92 | int close_mdcxx . . $ close_md(e2d4d3ac7f8219a9).(struct md_containercxx . . $ md_container#*, md_hashsumscxx . . $ md_hashsums# *, const char*, const char *); |
| 93 | void hashsums2linecxx . . $ hashsums2line(f5f0f94a1303d470).(md_hashsumscxx . . $ md_hashsums#*, struct db_linecxx . . $ db_line#*, const char *); |
| 94 | |
| 95 | DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! copy_hashsumscxx . . $ copy_hashsums(f1f39ddc5401fb9).(char *, md_hashsumscxx . . $ md_hashsums# *, bytecxx . . $ byte#* (*)[num_hashescxx . . $ num_hashes.], const char *); |
| 96 | |
| 97 | #endif /*_MD_H_INCLUDED*/ |