summaryrefslogtreecommitdiffstats
path: root/include/crypto
diff options
context:
space:
mode:
authorDaniel P. Berrange2017-09-27 14:53:36 +0200
committerMax Reitz2017-10-06 16:30:47 +0200
commit850f49de9b57511dcaf2cd7e45059f8f38fadf3b (patch)
tree497e5c335910bdaa9a01d3fcc74eecdd344d986f /include/crypto
parentblock: use 1 MB bounce buffers for crypto instead of 16KB (diff)
downloadqemu-850f49de9b57511dcaf2cd7e45059f8f38fadf3b.tar.gz
qemu-850f49de9b57511dcaf2cd7e45059f8f38fadf3b.tar.xz
qemu-850f49de9b57511dcaf2cd7e45059f8f38fadf3b.zip
crypto: expose encryption sector size in APIs
While current encryption schemes all have a fixed sector size of 512 bytes, this is not guaranteed to be the case in future. Expose the sector size in the APIs so the block layer can remove assumptions about fixed 512 byte sectors. Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 20170927125340.12360-3-berrange@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'include/crypto')
-rw-r--r--include/crypto/block.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/crypto/block.h b/include/crypto/block.h
index f0e543bee1..13232b2472 100644
--- a/include/crypto/block.h
+++ b/include/crypto/block.h
@@ -241,6 +241,21 @@ QCryptoHashAlgorithm qcrypto_block_get_kdf_hash(QCryptoBlock *block);
uint64_t qcrypto_block_get_payload_offset(QCryptoBlock *block);
/**
+ * qcrypto_block_get_sector_size:
+ * @block: the block encryption object
+ *
+ * Get the size of sectors used for payload encryption. A new
+ * IV is used at the start of each sector. The encryption
+ * sector size is not required to match the sector size of the
+ * underlying storage. For example LUKS will always use a 512
+ * byte sector size, even if the volume is on a disk with 4k
+ * sectors.
+ *
+ * Returns: the sector in bytes
+ */
+uint64_t qcrypto_block_get_sector_size(QCryptoBlock *block);
+
+/**
* qcrypto_block_free:
* @block: the block encryption object
*