aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/modes/xts/xts.h
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-09-01 13:40:26 -0400
committerJack Lloyd <[email protected]>2016-09-01 14:16:38 -0400
commit507d926da825fbc1d9d74b4517dbab47702c66b9 (patch)
tree22ac0e4a9c85fb3583d478a41ba1c46aeced5ec3 /src/lib/modes/xts/xts.h
parente4656be6a8e601b64c759906bacf543388b3cf22 (diff)
Cipher_Mode API improvements
The Cipher_Mode::update API is more general than needed to just support ciphers (this is due to it previously being an API of Transform which before 8b85b780515 was Cipher_Mode's base class) Define a less general interface `process` which either processes the blocks in-place, producing exactly as much output as there was input, or (SIV/CCM case) saves the entire message for processing in `finish`. These two uses cover all current or anticipated cipher modes. Leaves `update` for compatability with existing callers; all that is needed is an inline function forwarding to `process`. Removes the return type from `start` - in all cipher implementations, this always returned an empty vector. Adds BOTAN_ARG_CHECK macro; right now BOTAN_ASSERT is being used for argument checking in some places, which is not right at all.
Diffstat (limited to 'src/lib/modes/xts/xts.h')
-rw-r--r--src/lib/modes/xts/xts.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/modes/xts/xts.h b/src/lib/modes/xts/xts.h
index e751b1644..6c4ba8d99 100644
--- a/src/lib/modes/xts/xts.h
+++ b/src/lib/modes/xts/xts.h
@@ -42,7 +42,7 @@ class BOTAN_DLL XTS_Mode : public Cipher_Mode
void update_tweak(size_t last_used);
private:
- secure_vector<byte> start_raw(const byte nonce[], size_t nonce_len) override;
+ void start_msg(const byte nonce[], size_t nonce_len) override;
void key_schedule(const byte key[], size_t length) override;
std::unique_ptr<BlockCipher> m_cipher, m_tweak_cipher;
@@ -57,7 +57,7 @@ class BOTAN_DLL XTS_Encryption final : public XTS_Mode
public:
explicit XTS_Encryption(BlockCipher* cipher) : XTS_Mode(cipher) {}
- void update(secure_vector<byte>& blocks, size_t offset = 0) override;
+ size_t process(uint8_t buf[], size_t size) override;
void finish(secure_vector<byte>& final_block, size_t offset = 0) override;
@@ -72,7 +72,7 @@ class BOTAN_DLL XTS_Decryption final : public XTS_Mode
public:
explicit XTS_Decryption(BlockCipher* cipher) : XTS_Mode(cipher) {}
- void update(secure_vector<byte>& blocks, size_t offset = 0) override;
+ size_t process(uint8_t buf[], size_t size) override;
void finish(secure_vector<byte>& final_block, size_t offset = 0) override;