2 * dm-verity volume handling
4 * Copyright (C) 2012, Red Hat, Inc. All rights reserved.
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #define VERITY_MAX_HASH_TYPE 1
27 #define VERITY_BLOCK_SIZE_OK(x) ((x) % 512 || (x) < 512 || \
28 (x) > (512 * 1024) || (x) & ((x)-1))
31 struct crypt_params_verity;
33 int VERITY_read_sb(struct crypt_device *cd,
37 struct crypt_params_verity *params);
39 int VERITY_write_sb(struct crypt_device *cd,
42 const char *uuid_string,
43 struct crypt_params_verity *params);
45 int VERITY_activate(struct crypt_device *cd,
47 const char *hash_device,
48 const char *root_hash,
49 size_t root_hash_size,
50 struct crypt_params_verity *verity_hdr,
51 uint32_t activation_flags);
53 int VERITY_verify(struct crypt_device *cd,
54 struct crypt_params_verity *verity_hdr,
55 const char *data_device,
56 const char *hash_device,
57 const char *root_hash,
58 size_t root_hash_size);
60 int VERITY_create(struct crypt_device *cd,
61 struct crypt_params_verity *verity_hdr,
62 const char *data_device,
63 const char *hash_device,
65 size_t root_hash_size);
67 uint64_t VERITY_hash_offset_block(struct crypt_params_verity *params);
69 int VERITY_UUID_generate(struct crypt_device *cd, char **uuid_string);