diff options
author | lloyd <[email protected]> | 2013-12-10 03:30:24 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2013-12-10 03:30:24 +0000 |
commit | 748d7fd4b622ee3c9d95343e02ed945c217507f7 (patch) | |
tree | d2d1d58147b5b723b37f02133735ebca9bebd6ad | |
parent | 4874b0727843bba925bcd3b5c0659c5f1cb059d9 (diff) |
s/default_nonce_size/default_nonce_length/
-rw-r--r-- | checks/transform.cpp | 2 | ||||
-rw-r--r-- | doc/aead.rst | 6 | ||||
-rw-r--r-- | src/algo_base/info.txt | 2 | ||||
-rw-r--r-- | src/algo_base/transform.h | 6 | ||||
-rw-r--r-- | src/block/threefish/threefish.cpp | 4 | ||||
-rw-r--r-- | src/block/threefish/threefish.h | 2 | ||||
-rw-r--r-- | src/filters/transform_filter.cpp | 2 | ||||
-rw-r--r-- | src/modes/aead/aead.h | 2 | ||||
-rw-r--r-- | src/modes/aead/ccm/ccm.cpp | 2 | ||||
-rw-r--r-- | src/modes/aead/ccm/ccm.h | 2 | ||||
-rw-r--r-- | src/modes/cbc/cbc.cpp | 2 | ||||
-rw-r--r-- | src/modes/cbc/cbc.h | 2 | ||||
-rw-r--r-- | src/modes/cfb/cfb.cpp | 2 | ||||
-rw-r--r-- | src/modes/cfb/cfb.h | 2 | ||||
-rw-r--r-- | src/modes/ecb/ecb.cpp | 2 | ||||
-rw-r--r-- | src/modes/ecb/ecb.h | 2 | ||||
-rw-r--r-- | src/modes/xts/xts.cpp | 2 | ||||
-rw-r--r-- | src/modes/xts/xts.h | 2 |
18 files changed, 29 insertions, 17 deletions
diff --git a/checks/transform.cpp b/checks/transform.cpp index 292bcf467..70d86541e 100644 --- a/checks/transform.cpp +++ b/checks/transform.cpp @@ -62,7 +62,7 @@ void time_transform(const std::string& algo) AutoSeeded_RNG rng; tf->set_key(rng.random_vec(tf->maximum_keylength())); - tf->start_vec(rng.random_vec(tf->default_nonce_size())); + tf->start_vec(rng.random_vec(tf->default_nonce_length())); for(size_t mult : { 1, 2, 4, 8, 16, 128, 1024 }) { diff --git a/doc/aead.rst b/doc/aead.rst index cb49f8a51..dbd06bbe1 100644 --- a/doc/aead.rst +++ b/doc/aead.rst @@ -81,3 +81,9 @@ AEAD modes currently available include GCM, OCB, and EAX. All three use a Returns true if *nonce_len* is a valid nonce length for this scheme. For EAX and GCM, any length nonces are allowed. OCB allows any value between 8 and 15 bytes. + + .. cpp:function:: size_t default_nonce_length() const + + Returns a reasonable length for the nonce, typically either 96 + bits, or the only supported length for modes which don't + support 96 bit nonces. diff --git a/src/algo_base/info.txt b/src/algo_base/info.txt index cfdd9b691..a2c509f2c 100644 --- a/src/algo_base/info.txt +++ b/src/algo_base/info.txt @@ -1,3 +1,5 @@ +define TRANSFORM 20131209 + <requires> alloc filters diff --git a/src/algo_base/transform.h b/src/algo_base/transform.h index 3f4e80b94..2eec9d85b 100644 --- a/src/algo_base/transform.h +++ b/src/algo_base/transform.h @@ -72,7 +72,11 @@ class BOTAN_DLL Transformation : public SymmetricAlgorithm /** * Return the default size for a nonce */ - virtual size_t default_nonce_size() const = 0; + virtual size_t default_nonce_length() const = 0; + + BOTAN_DEPRECATED("Use default_nonce_length") + size_t default_nonce_size() const + { return default_nonce_length(); } /** * Return true iff nonce_len is a valid length for the nonce diff --git a/src/block/threefish/threefish.cpp b/src/block/threefish/threefish.cpp index 5877235ab..310fd0f69 100644 --- a/src/block/threefish/threefish.cpp +++ b/src/block/threefish/threefish.cpp @@ -142,14 +142,14 @@ size_t Threefish_512::minimum_final_size() const return 0; } -size_t Threefish_512::default_nonce_size() const +size_t Threefish_512::default_nonce_length() const { return 16; } bool Threefish_512::valid_nonce_length(size_t nonce_len) const { - return default_nonce_size() == nonce_len; + return default_nonce_length() == nonce_len; } void Threefish_512::clear() diff --git a/src/block/threefish/threefish.h b/src/block/threefish/threefish.h index 8fa758b12..b7806a93d 100644 --- a/src/block/threefish/threefish.h +++ b/src/block/threefish/threefish.h @@ -30,7 +30,7 @@ class BOTAN_DLL Threefish_512 : public Transformation size_t minimum_final_size() const override; - size_t default_nonce_size() const override; + size_t default_nonce_length() const override; bool valid_nonce_length(size_t nonce_len) const override; diff --git a/src/filters/transform_filter.cpp b/src/filters/transform_filter.cpp index e8033b1a8..2f25aa2c5 100644 --- a/src/filters/transform_filter.cpp +++ b/src/filters/transform_filter.cpp @@ -12,7 +12,7 @@ namespace Botan { Transformation_Filter::Transformation_Filter(Transformation* transform) : Buffered_Filter(transform->update_granularity(), transform->minimum_final_size()), - m_nonce(transform->default_nonce_size() == 0), + m_nonce(transform->default_nonce_length() == 0), m_transform(transform), m_buffer(m_transform->update_granularity()) { diff --git a/src/modes/aead/aead.h b/src/modes/aead/aead.h index d03cb295d..8df98fcad 100644 --- a/src/modes/aead/aead.h +++ b/src/modes/aead/aead.h @@ -48,7 +48,7 @@ class BOTAN_DLL AEAD_Mode : public Cipher_Mode * Default AEAD nonce size (a commonly supported value among AEAD * modes, and large enough that random collisions are unlikely). */ - size_t default_nonce_size() const override { return 12; } + size_t default_nonce_length() const override { return 12; } /** * Return the size of the authentication tag used (in bytes) diff --git a/src/modes/aead/ccm/ccm.cpp b/src/modes/aead/ccm/ccm.cpp index fb35172cc..50fc38738 100644 --- a/src/modes/aead/ccm/ccm.cpp +++ b/src/modes/aead/ccm/ccm.cpp @@ -47,7 +47,7 @@ bool CCM_Mode::valid_nonce_length(size_t n) const return (n == (15-L())); } -size_t CCM_Mode::default_nonce_size() const +size_t CCM_Mode::default_nonce_length() const { return (15-L()); } diff --git a/src/modes/aead/ccm/ccm.h b/src/modes/aead/ccm/ccm.h index a62c84f55..b9ce0b30b 100644 --- a/src/modes/aead/ccm/ccm.h +++ b/src/modes/aead/ccm/ccm.h @@ -37,7 +37,7 @@ class BOTAN_DLL CCM_Mode : public AEAD_Mode bool valid_nonce_length(size_t) const override; - size_t default_nonce_size() const override; + size_t default_nonce_length() const override; void clear(); diff --git a/src/modes/cbc/cbc.cpp b/src/modes/cbc/cbc.cpp index 482588cf5..31834bade 100644 --- a/src/modes/cbc/cbc.cpp +++ b/src/modes/cbc/cbc.cpp @@ -47,7 +47,7 @@ Key_Length_Specification CBC_Mode::key_spec() const return cipher().key_spec(); } -size_t CBC_Mode::default_nonce_size() const +size_t CBC_Mode::default_nonce_length() const { return cipher().block_size(); } diff --git a/src/modes/cbc/cbc.h b/src/modes/cbc/cbc.h index 8638c8a05..726d5d080 100644 --- a/src/modes/cbc/cbc.h +++ b/src/modes/cbc/cbc.h @@ -29,7 +29,7 @@ class BOTAN_DLL CBC_Mode : public Cipher_Mode Key_Length_Specification key_spec() const override; - size_t default_nonce_size() const override; + size_t default_nonce_length() const override; bool valid_nonce_length(size_t n) const override; diff --git a/src/modes/cfb/cfb.cpp b/src/modes/cfb/cfb.cpp index 2edb917b4..7721e1487 100644 --- a/src/modes/cfb/cfb.cpp +++ b/src/modes/cfb/cfb.cpp @@ -54,7 +54,7 @@ Key_Length_Specification CFB_Mode::key_spec() const return cipher().key_spec(); } -size_t CFB_Mode::default_nonce_size() const +size_t CFB_Mode::default_nonce_length() const { return cipher().block_size(); } diff --git a/src/modes/cfb/cfb.h b/src/modes/cfb/cfb.h index 46b1997d2..984e5cb96 100644 --- a/src/modes/cfb/cfb.h +++ b/src/modes/cfb/cfb.h @@ -33,7 +33,7 @@ class BOTAN_DLL CFB_Mode : public Cipher_Mode size_t output_length(size_t input_length) const override; - size_t default_nonce_size() const override; + size_t default_nonce_length() const override; bool valid_nonce_length(size_t n) const override; diff --git a/src/modes/ecb/ecb.cpp b/src/modes/ecb/ecb.cpp index 1b73da64f..f026eb035 100644 --- a/src/modes/ecb/ecb.cpp +++ b/src/modes/ecb/ecb.cpp @@ -42,7 +42,7 @@ Key_Length_Specification ECB_Mode::key_spec() const return cipher().key_spec(); } -size_t ECB_Mode::default_nonce_size() const +size_t ECB_Mode::default_nonce_length() const { return 0; } diff --git a/src/modes/ecb/ecb.h b/src/modes/ecb/ecb.h index 8ab62fa45..9545a33ea 100644 --- a/src/modes/ecb/ecb.h +++ b/src/modes/ecb/ecb.h @@ -29,7 +29,7 @@ class BOTAN_DLL ECB_Mode : public Cipher_Mode Key_Length_Specification key_spec() const override; - size_t default_nonce_size() const override; + size_t default_nonce_length() const override; bool valid_nonce_length(size_t n) const override; diff --git a/src/modes/xts/xts.cpp b/src/modes/xts/xts.cpp index 80b7ed7f3..02da5fa5d 100644 --- a/src/modes/xts/xts.cpp +++ b/src/modes/xts/xts.cpp @@ -86,7 +86,7 @@ Key_Length_Specification XTS_Mode::key_spec() const return cipher().key_spec().multiple(2); } -size_t XTS_Mode::default_nonce_size() const +size_t XTS_Mode::default_nonce_length() const { return cipher().block_size(); } diff --git a/src/modes/xts/xts.h b/src/modes/xts/xts.h index a1f0f1626..49f2a3458 100644 --- a/src/modes/xts/xts.h +++ b/src/modes/xts/xts.h @@ -30,7 +30,7 @@ class BOTAN_DLL XTS_Mode : public Cipher_Mode Key_Length_Specification key_spec() const override; - size_t default_nonce_size() const override; + size_t default_nonce_length() const override; bool valid_nonce_length(size_t n) const override; |