2 * dm-verity volume handling
4 * Copyright (C) 2012-2021 Red Hat, Inc. All rights reserved.
6 * This file is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This file is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this file; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 #define VERITY_MAX_HASH_TYPE 1
28 #define VERITY_BLOCK_SIZE_OK(x) ((x) % 512 || (x) < 512 || \
29 (x) > (512 * 1024) || (x) & ((x)-1))
32 struct crypt_params_verity;
35 int VERITY_read_sb(struct crypt_device *cd,
38 struct crypt_params_verity *params);
40 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 *root_hash,
48 size_t root_hash_size,
49 const char *signature_description,
50 struct device *fec_device,
51 struct crypt_params_verity *verity_hdr,
52 uint32_t activation_flags);
54 int VERITY_verify(struct crypt_device *cd,
55 struct crypt_params_verity *verity_hdr,
56 const char *root_hash,
57 size_t root_hash_size);
59 int VERITY_create(struct crypt_device *cd,
60 struct crypt_params_verity *verity_hdr,
61 const char *root_hash,
62 size_t root_hash_size);
64 int VERITY_FEC_process(struct crypt_device *cd,
65 struct crypt_params_verity *params,
66 struct device *fec_device,
68 unsigned int *errors);
70 uint64_t VERITY_hash_offset_block(struct crypt_params_verity *params);
72 uint64_t VERITY_hash_blocks(struct crypt_device *cd, struct crypt_params_verity *params);
74 uint64_t VERITY_FEC_blocks(struct crypt_device *cd,
75 struct device *fec_device,
76 struct crypt_params_verity *params);
78 int VERITY_UUID_generate(struct crypt_device *cd, char **uuid_string);