summaryrefslogtreecommitdiffstats
path: root/xlators/encryption/crypt/src/metadata.h
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/encryption/crypt/src/metadata.h')
-rw-r--r--xlators/encryption/crypt/src/metadata.h53
1 files changed, 29 insertions, 24 deletions
diff --git a/xlators/encryption/crypt/src/metadata.h b/xlators/encryption/crypt/src/metadata.h
index b67ae25b58c..0bcee1b18c8 100644
--- a/xlators/encryption/crypt/src/metadata.h
+++ b/xlators/encryption/crypt/src/metadata.h
@@ -11,11 +11,11 @@
#ifndef __METADATA_H__
#define __METADATA_H__
-#define NMTD_8_MAC_SIZE (8)
-#define EMTD_8_MAC_SIZE (8)
+#define NMTD_8_MAC_SIZE (8)
+#define EMTD_8_MAC_SIZE (8)
typedef uint8_t nmtd_8_mac_t[NMTD_8_MAC_SIZE];
-typedef uint8_t emtd_8_mac_t[EMTD_8_MAC_SIZE] ;
+typedef uint8_t emtd_8_mac_t[EMTD_8_MAC_SIZE];
/*
* Version "v1" of file's metadata.
@@ -28,17 +28,17 @@ typedef uint8_t emtd_8_mac_t[EMTD_8_MAC_SIZE] ;
* exactly one MAC)
*/
struct mtd_format_v1 {
- /* EMTD, encrypted part of meta-data */
- uint8_t alg_id; /* cipher algorithm id (only AES for now) */
- uint8_t mode_id; /* cipher mode id; (only XTS for now) */
- uint8_t block_bits; /* encoded block size */
- uint8_t minor_id; /* client translator id */
- uint8_t dkey_factor; /* encoded size of the data key */
- /* MACs */
- emtd_8_mac_t gmac; /* MAC of the encrypted meta-data, 8 bytes */
- nmtd_8_mac_t omac; /* per-link MACs of the non-encrypted
- * meta-data: at least one such MAC is always
- * present */
+ /* EMTD, encrypted part of meta-data */
+ uint8_t alg_id; /* cipher algorithm id (only AES for now) */
+ uint8_t mode_id; /* cipher mode id; (only XTS for now) */
+ uint8_t block_bits; /* encoded block size */
+ uint8_t minor_id; /* client translator id */
+ uint8_t dkey_factor; /* encoded size of the data key */
+ /* MACs */
+ emtd_8_mac_t gmac; /* MAC of the encrypted meta-data, 8 bytes */
+ nmtd_8_mac_t omac; /* per-link MACs of the non-encrypted
+ * meta-data: at least one such MAC is always
+ * present */
} __attribute__((packed));
/*
@@ -46,29 +46,34 @@ struct mtd_format_v1 {
* is file's gfid, which is generated on trusted machines.
*/
#define SIZE_OF_NMTD_V1 (sizeof(uuid_t))
-#define SIZE_OF_EMTD_V1 (offsetof(struct mtd_format_v1, gmac) - \
- offsetof(struct mtd_format_v1, alg_id))
+#define SIZE_OF_EMTD_V1 \
+ (offsetof(struct mtd_format_v1, gmac) - \
+ offsetof(struct mtd_format_v1, alg_id))
#define SIZE_OF_NMTD_V1_MAC (NMTD_8_MAC_SIZE)
#define SIZE_OF_EMTD_V1_MAC (EMTD_8_MAC_SIZE)
-static inline unsigned char *get_EMTD_V1(struct mtd_format_v1 *format)
+static inline unsigned char *
+get_EMTD_V1(struct mtd_format_v1 *format)
{
- return &format->alg_id;
+ return &format->alg_id;
}
-static inline unsigned char *get_NMTD_V1(struct crypt_inode_info *info)
+static inline unsigned char *
+get_NMTD_V1(struct crypt_inode_info *info)
{
- return info->oid;
+ return info->oid;
}
-static inline unsigned char *get_EMTD_V1_MAC(struct mtd_format_v1 *format)
+static inline unsigned char *
+get_EMTD_V1_MAC(struct mtd_format_v1 *format)
{
- return format->gmac;
+ return format->gmac;
}
-static inline unsigned char *get_NMTD_V1_MAC(struct mtd_format_v1 *format)
+static inline unsigned char *
+get_NMTD_V1_MAC(struct mtd_format_v1 *format)
{
- return format->omac;
+ return format->omac;
}
#endif /* __METADATA_H__ */