diff options
author | lloyd <[email protected]> | 2010-10-28 21:15:21 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-10-28 21:15:21 +0000 |
commit | 22f02b418f7f53431da168abe9fb74f15bf3cb0e (patch) | |
tree | cdc81938c979403d20a438d134bbd6d64479f17d /src/mac/ssl3mac | |
parent | a7a047e6823dcbf23e172dd5c0f9a7b4fd748f10 (diff) |
Eliminate the constant size_t values in SymmetricAlgorithm that give
the parameters of the key length. Instead define a new function which
returns a simple object which contains this information.
This definitely breaks backwards compatability, though only with code
that directly manipulates low level objects like BlockCipher*s
directly, which is probably relatively rare.
Also remove some deprecated accessor functions from lookup.h. It turns
out block_size_of and output_size_of are being used in the TLS code; I
need to remove them from there before I can delete these entirely.
Really that didn't make much sense, because they assumed all
implementations of a particular algorithm will have the same
specifications, which is definitely not necessarily true, especially
WRT key length. It is much safer (and probably simpler) to first
retrieve an instance of the actual object you are going to use and
then ask it directly.
Diffstat (limited to 'src/mac/ssl3mac')
-rw-r--r-- | src/mac/ssl3mac/ssl3_mac.cpp | 6 | ||||
-rw-r--r-- | src/mac/ssl3mac/ssl3_mac.h | 5 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/mac/ssl3mac/ssl3_mac.cpp b/src/mac/ssl3mac/ssl3_mac.cpp index fcbccc06e..daaca1b57 100644 --- a/src/mac/ssl3mac/ssl3_mac.cpp +++ b/src/mac/ssl3mac/ssl3_mac.cpp @@ -73,14 +73,14 @@ MessageAuthenticationCode* SSL3_MAC::clone() const * SSL3-MAC Constructor */ SSL3_MAC::SSL3_MAC(HashFunction* hash_in) : - MessageAuthenticationCode(hash_in->output_length(), - hash_in->output_length()), + MessageAuthenticationCode(hash_in->output_length()), hash(hash_in) { if(hash->hash_block_size() == 0) throw Invalid_Argument("SSL3-MAC cannot be used with " + hash->name()); - size_t INNER_HASH_LENGTH = + // Quirk to deal with specification bug + const size_t INNER_HASH_LENGTH = (hash->name() == "SHA-160") ? 60 : hash->hash_block_size(); i_key.resize(INNER_HASH_LENGTH); diff --git a/src/mac/ssl3mac/ssl3_mac.h b/src/mac/ssl3mac/ssl3_mac.h index 50042f3d0..455cfa266 100644 --- a/src/mac/ssl3mac/ssl3_mac.h +++ b/src/mac/ssl3mac/ssl3_mac.h @@ -23,6 +23,11 @@ class BOTAN_DLL SSL3_MAC : public MessageAuthenticationCode std::string name() const; MessageAuthenticationCode* clone() const; + Key_Length_Specification key_spec() const + { + return Key_Length_Specification(hash->output_length()); + } + /** * @param hash the underlying hash to use */ |