summaryrefslogtreecommitdiffstats
path: root/src/librbd/crypto/BlockCrypto.cc
diff options
context:
space:
mode:
authorOr Ozeri <oro@il.ibm.com>2020-10-18 18:10:13 +0200
committerOr Ozeri <oro@il.ibm.com>2020-10-25 09:13:09 +0100
commit11fb90757d5fbd29bc5bd48c1e6f3fa129a59e35 (patch)
tree5a6833b5e21914d21d89c2221b4a44ba899e1eb2 /src/librbd/crypto/BlockCrypto.cc
parentMerge pull request #37699 from dillaman/wip-47880 (diff)
downloadceph-11fb90757d5fbd29bc5bd48c1e6f3fa129a59e35.tar.xz
ceph-11fb90757d5fbd29bc5bd48c1e6f3fa129a59e35.zip
librbd: crypto alignment support
This commit extents the recently added CryptoObjectDispatch layer to support block ciphers (as opposed to stream ciphers). In other words, the crypto layer now handles the necessary data alignments before data is passed on to the crypto engine. Signed-off-by: Or Ozeri <oro@il.ibm.com>
Diffstat (limited to 'src/librbd/crypto/BlockCrypto.cc')
-rw-r--r--src/librbd/crypto/BlockCrypto.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/librbd/crypto/BlockCrypto.cc b/src/librbd/crypto/BlockCrypto.cc
index 5bb4cfee498..a8203e13647 100644
--- a/src/librbd/crypto/BlockCrypto.cc
+++ b/src/librbd/crypto/BlockCrypto.cc
@@ -12,9 +12,10 @@ namespace crypto {
template <typename T>
BlockCrypto<T>::BlockCrypto(CephContext* cct, DataCryptor<T>* data_cryptor,
- uint32_t block_size)
+ uint64_t block_size)
: m_cct(cct), m_data_cryptor(data_cryptor), m_block_size(block_size),
m_iv_size(data_cryptor->get_iv_size()) {
+ ceph_assert(isp2(block_size));
ceph_assert((block_size % data_cryptor->get_block_size()) == 0);
}