libewf_hash_sections.h 2.84 KB
Newer Older
1
/*
2
 * Hash sections functions
3
 *
4
 * Copyright (C) 2006-2017, Joachim Metz <joachim.metz@gmail.com>
5 6 7
 *
 * Refer to AUTHORS for acknowledgements.
 *
8 9 10 11
 * This software is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
12
 *
13 14 15 16
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
17
 *
18 19
 * You should have received a copy of the GNU Lesser General Public License
 * along with this software.  If not, see <http://www.gnu.org/licenses/>.
20 21 22 23 24 25
 */

#if !defined( _LIBEWF_HASH_SECTIONS_H )
#define _LIBEWF_HASH_SECTIONS_H

#include <common.h>
26
#include <types.h>
27

28
#include "libewf_libcerror.h"
29
#include "libewf_libfvalue.h"
30 31 32 33 34 35 36 37 38 39 40 41 42

#if defined( __cplusplus )
extern "C" {
#endif

typedef struct libewf_hash_sections libewf_hash_sections_t;

/* Additional subhandle for media specific parameters
 */
struct libewf_hash_sections
{
	/* The stored xhash
	 */
43
	uint8_t *xhash;
44 45 46 47 48

	/* The size of the stored xhash
	 */
	size_t xhash_size;

49
	/* The MD5 hash of the data as found in the MD5 hash section
50
	 */
51
	uint8_t md5_hash[ 16 ];
52 53 54 55

	/* Value to indicate if the MD5 hash was set
	 */
	uint8_t md5_hash_set;
56

57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
	/* The SHA1 hash of the data as found in the SHA1 hash section
	 */
	uint8_t sha1_hash[ 20 ];

	/* Value to indicate if the SHA1 hash was set
	 */
	uint8_t sha1_hash_set;

#ifdef TODO
	/* The SHA256 hash of the data as found in the SHA256 hash section
	 */
	uint8_t sha256_hash[ 32 ];

	/* Value to indicate if the SHA256 hash was set
	 */
	uint8_t sha256_hash_set;
#endif

75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
	/* The MD5 hash of the data as found in the digest section
	 */
	uint8_t md5_digest[ 16 ];

	/* Value to indicate if the MD5 digest was set
	 */
	uint8_t md5_digest_set;

	/* The SHA1 hash of the data as found in the digest section
	 */
	uint8_t sha1_digest[ 20 ];

	/* Value to indicate if the SHA1 digest was set
	 */
	uint8_t sha1_digest_set;
90 91
};

92 93
int libewf_hash_sections_initialize(
     libewf_hash_sections_t **hash_sections,
94
     libcerror_error_t **error );
95

96 97
int libewf_hash_sections_free(
     libewf_hash_sections_t **hash_sections,
98
     libcerror_error_t **error );
99

100 101 102
int libewf_hash_sections_clone(
     libewf_hash_sections_t **destination_hash_sections,
     libewf_hash_sections_t *source_hash_sections,
103
     libcerror_error_t **error );
104

105 106 107 108 109 110 111
int libewf_hash_sections_set_digest_from_hash_values(
     libewf_hash_sections_t *hash_sections,
     const uint8_t *identifier,
     size_t identifier_length,
     libfvalue_table_t *hash_values,
     libcerror_error_t **error );

112 113 114 115
#if defined( __cplusplus )
}
#endif

116
#endif /* !defined( _LIBEWF_HASH_SECTIONS_H ) */
117