"Fossies" - the Fresh Open Source Software Archive

Member "cryptsetup-2.4.3/lib/verity/verity.h" (13 Jan 2022, 2508 Bytes) of package /linux/misc/cryptsetup-2.4.3.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "verity.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * dm-verity volume handling
    3  *
    4  * Copyright (C) 2012-2021 Red Hat, Inc. All rights reserved.
    5  *
    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.
   10  *
   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.
   15  *
   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.
   19  */
   20 
   21 #ifndef _VERITY_H
   22 #define _VERITY_H
   23 
   24 #include <stddef.h>
   25 #include <stdint.h>
   26 
   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))
   30 
   31 struct crypt_device;
   32 struct crypt_params_verity;
   33 struct device;
   34 
   35 int VERITY_read_sb(struct crypt_device *cd,
   36            uint64_t sb_offset,
   37            char **uuid,
   38            struct crypt_params_verity *params);
   39 
   40 int VERITY_write_sb(struct crypt_device *cd,
   41            uint64_t sb_offset,
   42            const char *uuid_string,
   43            struct crypt_params_verity *params);
   44 
   45 int VERITY_activate(struct crypt_device *cd,
   46              const char *name,
   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);
   53 
   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);
   58 
   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);
   63 
   64 int VERITY_FEC_process(struct crypt_device *cd,
   65               struct crypt_params_verity *params,
   66               struct device *fec_device,
   67               int check_fec,
   68               unsigned int *errors);
   69 
   70 uint64_t VERITY_hash_offset_block(struct crypt_params_verity *params);
   71 
   72 uint64_t VERITY_hash_blocks(struct crypt_device *cd, struct crypt_params_verity *params);
   73 
   74 uint64_t VERITY_FEC_blocks(struct crypt_device *cd,
   75                struct device *fec_device,
   76                struct crypt_params_verity *params);
   77 
   78 int VERITY_UUID_generate(struct crypt_device *cd, char **uuid_string);
   79 
   80 #endif