1 /* 2 * The container key bag functions 3 * 4 * Copyright (C) 2018-2021, Joachim Metz <joachim.metz@gmail.com> 5 * 6 * Refer to AUTHORS for acknowledgements. 7 * 8 * This program is free software: you can redistribute it and/or modify 9 * it under the terms of the GNU Lesser General Public License as published by 10 * the Free Software Foundation, either version 3 of the License, or 11 * (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public License 19 * along with this program. If not, see <https://www.gnu.org/licenses/>. 20 */ 21 22 #if !defined( _LIBFSAPFS_CONTAINER_KEY_BAG_H ) 23 #define _LIBFSAPFS_CONTAINER_KEY_BAG_H 24 25 #include <common.h> 26 #include <types.h> 27 28 #include "libfsapfs_io_handle.h" 29 #include "libfsapfs_libbfio.h" 30 #include "libfsapfs_libcdata.h" 31 #include "libfsapfs_libcerror.h" 32 33 #if defined( __cplusplus ) 34 extern "C" { 35 #endif 36 37 typedef struct libfsapfs_container_key_bag libfsapfs_container_key_bag_t; 38 39 struct libfsapfs_container_key_bag 40 { 41 /* The entries array 42 */ 43 libcdata_array_t *entries_array; 44 45 /* Value to indicate if the container key bag is locked 46 */ 47 uint8_t is_locked; 48 }; 49 50 int libfsapfs_container_key_bag_initialize( 51 libfsapfs_container_key_bag_t **container_key_bag, 52 libcerror_error_t **error ); 53 54 int libfsapfs_container_key_bag_free( 55 libfsapfs_container_key_bag_t **container_key_bag, 56 libcerror_error_t **error ); 57 58 int libfsapfs_container_key_bag_read_file_io_handle( 59 libfsapfs_container_key_bag_t *container_key_bag, 60 libfsapfs_io_handle_t *io_handle, 61 libbfio_handle_t *file_io_handle, 62 off64_t file_offset, 63 size64_t data_size, 64 const uint8_t *container_identifier, 65 libcerror_error_t **error ); 66 67 int libfsapfs_container_key_bag_read_data( 68 libfsapfs_container_key_bag_t *container_key_bag, 69 const uint8_t *data, 70 size_t data_size, 71 libcerror_error_t **error ); 72 73 int libfsapfs_container_key_bag_get_volume_key_bag_extent_by_identifier( 74 libfsapfs_container_key_bag_t *container_key_bag, 75 const uint8_t *volume_identifier, 76 uint64_t *volume_key_bag_block_number, 77 uint64_t *volume_key_bag_number_of_blocks, 78 libcerror_error_t **error ); 79 80 int libfsapfs_container_key_bag_get_volume_master_key_by_identifier( 81 libfsapfs_container_key_bag_t *container_key_bag, 82 const uint8_t *volume_identifier, 83 const uint8_t *volume_key, 84 size_t volume_key_size, 85 uint8_t *key, 86 size_t key_size, 87 libcerror_error_t **error ); 88 89 #if defined( __cplusplus ) 90 } 91 #endif 92 93 #endif /* !defined( _LIBFSAPFS_CONTAINER_KEY_BAG_H ) */ 94 95