Support empty salt for verity, support no superblock.
[platform/upstream/cryptsetup.git] / lib / libcryptsetup.h
index 4bf63b3..f281a9b 100644 (file)
@@ -33,6 +33,7 @@
 extern "C" {
 #endif
 
+#include <stddef.h>
 #include <stdint.h>
 
 struct crypt_device; /* crypt device handle */
@@ -300,6 +301,8 @@ int crypt_memory_lock(struct crypt_device *cd, int lock);
 #define CRYPT_LUKS1 "LUKS1"
 /** loop-AES compatibility mode */
 #define CRYPT_LOOPAES "LOOPAES"
+/** dm-verity mode */
+#define CRYPT_VERITY "VERITY"
 
 /**
  * Get device type
@@ -350,6 +353,33 @@ struct crypt_params_loopaes {
        uint64_t skip;    /**< IV offset / initialization sector */
 };
 
+/**
+ *
+ * Structure used as parameter for dm-verity device type
+ *
+ * @see crypt_format, crypt_load
+ *
+ */
+/** No on-disk header (only hashes) */
+#define CRYPT_VERITY_NO_HEADER   (1 << 0)
+/** Verity hash in userspace before activation */
+#define CRYPT_VERITY_CHECK_HASH  (1 << 1)
+/** Create hash - format hash device */
+#define CRYPT_VERITY_CREATE_HASH (1 << 2)
+
+struct crypt_params_verity {
+       const char *hash_name;     /**< hash function */
+       const char *data_device;   /**< data_device (CRYPT_VERITY_CREATE_HASH) */
+       const char *salt;          /**< salt */
+       uint64_t salt_size;        /**< salt size (in bytes) */
+       uint32_t data_block_size;  /**< data block size (in bytes) */
+       uint32_t hash_block_size;  /**< hash block size (in bytes) */
+       uint64_t data_size;        /**< data area size (in data blocks) */
+       uint64_t hash_area_offset; /**< hash/header offset (in bytes) */
+       uint32_t version;          /**< in-kernel hash version */
+       uint32_t flags;            /**< CRYPT_VERITY* flags */
+};
+
 /** @} */
 
 /**
@@ -636,10 +666,12 @@ int crypt_keyslot_destroy(struct crypt_device *cd, int keyslot);
 #define CRYPT_ACTIVATE_READONLY (1 << 0)
 /** only reported for device without uuid */
 #define CRYPT_ACTIVATE_NO_UUID  (1 << 1)
-/** activate more non-overlapping mapping to the same device */
+/** activate even if cannot grant exclusive access (DANGEROUS) */
 #define CRYPT_ACTIVATE_SHARED   (1 << 2)
 /** enable discards aka TRIM */
 #define CRYPT_ACTIVATE_ALLOW_DISCARDS (1 << 3)
+/** skip global udev rules in activation ("private device"), input only */
+#define CRYPT_ACTIVATE_PRIVATE (1 << 4)
 
 /**
  * Active device runtime attributes