/* * Header for the encrypted file when truncating the size, this * will be sent to MDS, and the MDS will update the encrypted * last block and then truncate the size.
*/ struct ceph_fscrypt_truncate_size_header {
__u8 ver;
__u8 compat;
/* * It will be sizeof(assert_ver + file_offset + block_size) * if the last block is empty when it's located in a file * hole. Or the data_len will plus CEPH_FSCRYPT_BLOCK_SIZE.
*/
__le32 data_len;
#ifdef CONFIG_FS_ENCRYPTION /* * We want to encrypt filenames when creating them, but the encrypted * versions of those names may have illegal characters in them. To mitigate * that, we base64 encode them, but that gives us a result that can exceed * NAME_MAX. * * Follow a similar scheme to fscrypt itself, and cap the filename to a * smaller size. If the ciphertext name is longer than the value below, then * sha256 hash the remaining bytes. * * For the fscrypt_nokey_name struct the dirhash[2] member is useless in ceph * so the corresponding struct will be: * * struct fscrypt_ceph_nokey_name { * u8 bytes[157]; * u8 sha256[SHA256_DIGEST_SIZE]; * }; // 180 bytes => 240 bytes base64-encoded, which is <= NAME_MAX (255) * * (240 bytes is the maximum size allowed for snapshot names to take into * account the format: '_<SNAPSHOT-NAME>_<INODE-NUMBER>'.) * * Note that for long names that end up having their tail portion hashed, we * must also store the full encrypted name (in the dentry's alternate_name * field).
*/ #define CEPH_NOHASH_NAME_MAX (180 - SHA256_DIGEST_SIZE)
/* * If we have an encrypted inode then we must adjust the offset and * range of the on-the-wire read to cover an entire encryption block. * The copy will be done using the original offset and length, after * we've decrypted the result.
*/ staticinlinevoid ceph_fscrypt_adjust_off_and_len(struct inode *inode,
u64 *off, u64 *len)
{ if (IS_ENCRYPTED(inode)) {
*len = ceph_fscrypt_blocks(*off, *len) * CEPH_FSCRYPT_BLOCK_SIZE;
*off &= CEPH_FSCRYPT_BLOCK_MASK;
}
}
int ceph_fscrypt_decrypt_block_inplace(conststruct inode *inode, struct page *page, unsignedint len, unsignedint offs, u64 lblk_num); int ceph_fscrypt_encrypt_block_inplace(conststruct inode *inode, struct page *page, unsignedint len, unsignedint offs, u64 lblk_num); int ceph_fscrypt_decrypt_pages(struct inode *inode, struct page **page,
u64 off, int len); int ceph_fscrypt_decrypt_extents(struct inode *inode, struct page **page,
u64 off, struct ceph_sparse_extent *map,
u32 ext_cnt); int ceph_fscrypt_encrypt_pages(struct inode *inode, struct page **page, u64 off, int len);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.