diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
commit | 19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch) | |
tree | 42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/test/librbd/mock/crypto/MockDataCryptor.h | |
parent | Initial commit. (diff) | |
download | ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip |
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/librbd/mock/crypto/MockDataCryptor.h')
-rw-r--r-- | src/test/librbd/mock/crypto/MockDataCryptor.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/test/librbd/mock/crypto/MockDataCryptor.h b/src/test/librbd/mock/crypto/MockDataCryptor.h new file mode 100644 index 000000000..51a738862 --- /dev/null +++ b/src/test/librbd/mock/crypto/MockDataCryptor.h @@ -0,0 +1,43 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#ifndef CEPH_TEST_LIBRBD_MOCK_CRYPTO_MOCK_DATA_CRYPTOR_H +#define CEPH_TEST_LIBRBD_MOCK_CRYPTO_MOCK_DATA_CRYPTOR_H + +#include "gmock/gmock.h" +#include "librbd/crypto/DataCryptor.h" + +namespace librbd { +namespace crypto { + +struct MockCryptoContext {}; + +class MockDataCryptor : public DataCryptor<MockCryptoContext> { + +public: + uint32_t block_size = 16; + uint32_t iv_size = 16; + + uint32_t get_block_size() const override { + return block_size; + } + + uint32_t get_iv_size() const override { + return iv_size; + } + + MOCK_METHOD1(get_context, MockCryptoContext*(CipherMode)); + MOCK_METHOD2(return_context, void(MockCryptoContext*, CipherMode)); + MOCK_CONST_METHOD3(init_context, int(MockCryptoContext*, + const unsigned char*, uint32_t)); + MOCK_CONST_METHOD4(update_context, int(MockCryptoContext*, + const unsigned char*, unsigned char*, + uint32_t)); + MOCK_CONST_METHOD0(get_key, const unsigned char*()); + MOCK_CONST_METHOD0(get_key_length, int()); +}; + +} // namespace crypto +} // namespace librbd + +#endif // CEPH_TEST_LIBRBD_MOCK_CRYPTO_MOCK_DATA_CRYPTOR_H |