mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 07:50:53 +07:00
53 lines
1.7 KiB
C
53 lines
1.7 KiB
C
|
/* SPDX-License-Identifier: GPL-2.0 */
|
||
|
/*
|
||
|
* Copyright 2019 Google LLC
|
||
|
*/
|
||
|
|
||
|
#ifndef __LINUX_BLK_CRYPTO_H
|
||
|
#define __LINUX_BLK_CRYPTO_H
|
||
|
|
||
|
enum blk_crypto_mode_num {
|
||
|
BLK_ENCRYPTION_MODE_INVALID,
|
||
|
BLK_ENCRYPTION_MODE_AES_256_XTS,
|
||
|
BLK_ENCRYPTION_MODE_AES_128_CBC_ESSIV,
|
||
|
BLK_ENCRYPTION_MODE_ADIANTUM,
|
||
|
BLK_ENCRYPTION_MODE_MAX,
|
||
|
};
|
||
|
|
||
|
#define BLK_CRYPTO_MAX_KEY_SIZE 64
|
||
|
/**
|
||
|
* struct blk_crypto_config - an inline encryption key's crypto configuration
|
||
|
* @crypto_mode: encryption algorithm this key is for
|
||
|
* @data_unit_size: the data unit size for all encryption/decryptions with this
|
||
|
* key. This is the size in bytes of each individual plaintext and
|
||
|
* ciphertext. This is always a power of 2. It might be e.g. the
|
||
|
* filesystem block size or the disk sector size.
|
||
|
* @dun_bytes: the maximum number of bytes of DUN used when using this key
|
||
|
*/
|
||
|
struct blk_crypto_config {
|
||
|
enum blk_crypto_mode_num crypto_mode;
|
||
|
unsigned int data_unit_size;
|
||
|
unsigned int dun_bytes;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* struct blk_crypto_key - an inline encryption key
|
||
|
* @crypto_cfg: the crypto configuration (like crypto_mode, key size) for this
|
||
|
* key
|
||
|
* @data_unit_size_bits: log2 of data_unit_size
|
||
|
* @size: size of this key in bytes (determined by @crypto_cfg.crypto_mode)
|
||
|
* @raw: the raw bytes of this key. Only the first @size bytes are used.
|
||
|
*
|
||
|
* A blk_crypto_key is immutable once created, and many bios can reference it at
|
||
|
* the same time. It must not be freed until all bios using it have completed
|
||
|
* and it has been evicted from all devices on which it may have been used.
|
||
|
*/
|
||
|
struct blk_crypto_key {
|
||
|
struct blk_crypto_config crypto_cfg;
|
||
|
unsigned int data_unit_size_bits;
|
||
|
unsigned int size;
|
||
|
u8 raw[BLK_CRYPTO_MAX_KEY_SIZE];
|
||
|
};
|
||
|
|
||
|
#endif /* __LINUX_BLK_CRYPTO_H */
|