diff options
author | lloyd <[email protected]> | 2013-12-05 02:12:29 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2013-12-05 02:12:29 +0000 |
commit | 37609eba0f730fdcb0daf84d5f9c239b27fb010c (patch) | |
tree | b0786f016b5b34ca3f3b9a59b6bfc6dd3ad329e6 | |
parent | 8fedb5ba83acc84c62f8f20ac962c0acf643e3a8 (diff) |
Add key length multiple
-rw-r--r-- | src/algo_base/key_spec.h | 7 | ||||
-rw-r--r-- | src/modes/xts/xts.cpp | 6 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/algo_base/key_spec.h b/src/algo_base/key_spec.h index 73cd9126f..15881c1a6 100644 --- a/src/algo_base/key_spec.h +++ b/src/algo_base/key_spec.h @@ -79,6 +79,13 @@ class BOTAN_DLL Key_Length_Specification return keylen_mod; } + Key_Length_Specification multiple(size_t n) const + { + return Key_Length_Specification(n * min_keylen, + n * max_keylen, + n * keylen_mod); + } + private: size_t min_keylen, max_keylen, keylen_mod; }; diff --git a/src/modes/xts/xts.cpp b/src/modes/xts/xts.cpp index dffba824e..80b7ed7f3 100644 --- a/src/modes/xts/xts.cpp +++ b/src/modes/xts/xts.cpp @@ -83,11 +83,7 @@ size_t XTS_Mode::minimum_final_size() const Key_Length_Specification XTS_Mode::key_spec() const { - const Key_Length_Specification spec = cipher().key_spec(); - - return Key_Length_Specification(2*spec.minimum_keylength(), - 2*spec.maximum_keylength(), - 2*spec.keylength_multiple()); + return cipher().key_spec().multiple(2); } size_t XTS_Mode::default_nonce_size() const |