From ebcd91a0ac1b1aa3f4723ae19dab0c74eccad495 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Sat, 7 Oct 2017 10:32:43 -0400 Subject: Make UncheckedSetKey in authenc.h UncheckedSetKey has traditionally been a protected member function. The public API traditionally uses SetKey (and friends) to set the key. Internally, SetKey may call UncheckedSetKey. It looks like UncheckedSetKey was made public when authenticated encryption support was added. Its probably not a good idea to have users calling UncheckedSetKey. Most (all?) of the time it does nothing for authenc modes. The other remaining cases it may not work as expected. --- authenc.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'authenc.h') diff --git a/authenc.h b/authenc.h index a0dd5a1c..d09efcc2 100644 --- a/authenc.h +++ b/authenc.h @@ -48,14 +48,6 @@ public: bool IsRandomAccess() const {return false;} bool IsSelfInverting() const {return true;} - //! \brief Sets the key for this object without performing parameter validation - //! \param key a byte buffer used to key the cipher - //! \param length the length of the byte buffer - //! \param params additional parameters passed as NameValuePairs - //! \details key must be at least DEFAULT_KEYLENGTH in length. - void UncheckedSetKey(const byte * key, unsigned int length,const CryptoPP::NameValuePairs ¶ms) - {CRYPTOPP_UNUSED(key), CRYPTOPP_UNUSED(length), CRYPTOPP_UNUSED(params); CRYPTOPP_ASSERT(false);} - void SetKey(const byte *userKey, size_t keylength, const NameValuePairs ¶ms); void Restart() {if (m_state > State_KeySet) m_state = State_KeySet;} void Resynchronize(const byte *iv, int length=-1); @@ -64,6 +56,9 @@ public: void TruncatedFinal(byte *mac, size_t macSize); protected: + void UncheckedSetKey(const byte * key, unsigned int length,const CryptoPP::NameValuePairs ¶ms) + {CRYPTOPP_UNUSED(key), CRYPTOPP_UNUSED(length), CRYPTOPP_UNUSED(params); CRYPTOPP_ASSERT(false);} + void AuthenticateData(const byte *data, size_t len); const SymmetricCipher & GetSymmetricCipher() const {return const_cast(this)->AccessSymmetricCipher();}; -- cgit v1.2.1