Update documentation

pull/681/head^2
Jeffrey Walton 2018-07-03 23:35:36 -04:00
parent 65806e5ee9
commit 94e0b3c954
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
1 changed files with 18 additions and 6 deletions

View File

@ -146,7 +146,8 @@ struct CRYPTOPP_DLL CRYPTOPP_NO_VTABLE AdditiveCipherAbstractPolicy
/// which will be derived from GetBytesPerIteration(). /// which will be derived from GetBytesPerIteration().
/// \sa CanOperateKeystream(), OperateKeystream(), WriteKeystream(), KeystreamOperation() /// \sa CanOperateKeystream(), OperateKeystream(), WriteKeystream(), KeystreamOperation()
virtual void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount) virtual void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount)
{CRYPTOPP_UNUSED(operation); CRYPTOPP_UNUSED(output); CRYPTOPP_UNUSED(input); CRYPTOPP_UNUSED(iterationCount); CRYPTOPP_ASSERT(false);} {CRYPTOPP_UNUSED(operation); CRYPTOPP_UNUSED(output); CRYPTOPP_UNUSED(input);
CRYPTOPP_UNUSED(iterationCount); CRYPTOPP_ASSERT(false);}
/// \brief Key the cipher /// \brief Key the cipher
/// \param params set of NameValuePairs use to initialize this object /// \param params set of NameValuePairs use to initialize this object
@ -159,7 +160,8 @@ struct CRYPTOPP_DLL CRYPTOPP_NO_VTABLE AdditiveCipherAbstractPolicy
/// \param iv a byte array used to resynchronize the cipher /// \param iv a byte array used to resynchronize the cipher
/// \param length the size of the IV array /// \param length the size of the IV array
virtual void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length) virtual void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length)
{CRYPTOPP_UNUSED(keystreamBuffer); CRYPTOPP_UNUSED(iv); CRYPTOPP_UNUSED(length); throw NotImplemented("SimpleKeyingInterface: this object doesn't support resynchronization");} {CRYPTOPP_UNUSED(keystreamBuffer); CRYPTOPP_UNUSED(iv); CRYPTOPP_UNUSED(length);
throw NotImplemented("SimpleKeyingInterface: this object doesn't support resynchronization");}
/// \brief Flag indicating random access /// \brief Flag indicating random access
/// \returns true if the cipher is seekable, false otherwise /// \returns true if the cipher is seekable, false otherwise
@ -169,7 +171,8 @@ struct CRYPTOPP_DLL CRYPTOPP_NO_VTABLE AdditiveCipherAbstractPolicy
/// \brief Seeks to a random position in the stream /// \brief Seeks to a random position in the stream
/// \sa CipherIsRandomAccess() /// \sa CipherIsRandomAccess()
virtual void SeekToIteration(lword iterationCount) virtual void SeekToIteration(lword iterationCount)
{CRYPTOPP_UNUSED(iterationCount); CRYPTOPP_ASSERT(!CipherIsRandomAccess()); throw NotImplemented("StreamTransformation: this object doesn't support random access");} {CRYPTOPP_UNUSED(iterationCount); CRYPTOPP_ASSERT(!CipherIsRandomAccess());
throw NotImplemented("StreamTransformation: this object doesn't support random access");}
}; };
/// \brief Base class for additive stream ciphers /// \brief Base class for additive stream ciphers
@ -217,10 +220,17 @@ struct CRYPTOPP_NO_VTABLE AdditiveCipherConcretePolicy : public BASE
}; };
/// \brief Helper macro to implement OperateKeystream /// \brief Helper macro to implement OperateKeystream
/// \param x KeystreamOperation mask
/// \param b Endian order
/// \param i index in output buffer
/// \param a value to output
#define CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, b, i, a) \ #define CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, b, i, a) \
PutWord(bool(x & OUTPUT_ALIGNED), b, output+i*sizeof(WordType), (x & INPUT_NULL) ? (a) : (a) ^ GetWord<WordType>(bool(x & INPUT_ALIGNED), b, input+i*sizeof(WordType))); PutWord(bool(x & OUTPUT_ALIGNED), b, output+i*sizeof(WordType), (x & INPUT_NULL) ? (a) : (a) ^ GetWord<WordType>(bool(x & INPUT_ALIGNED), b, input+i*sizeof(WordType)));
/// \brief Helper macro to implement OperateKeystream /// \brief Helper macro to implement OperateKeystream
/// \param x KeystreamOperation mask
/// \param i index in output buffer
/// \param a value to output
#define CRYPTOPP_KEYSTREAM_OUTPUT_XMM(x, i, a) {\ #define CRYPTOPP_KEYSTREAM_OUTPUT_XMM(x, i, a) {\
__m128i t = (x & INPUT_NULL) ? a : _mm_xor_si128(a, (x & INPUT_ALIGNED) ? _mm_load_si128((__m128i *)input+i) : _mm_loadu_si128((__m128i *)input+i));\ __m128i t = (x & INPUT_NULL) ? a : _mm_xor_si128(a, (x & INPUT_ALIGNED) ? _mm_load_si128((__m128i *)input+i) : _mm_loadu_si128((__m128i *)input+i));\
if (x & OUTPUT_ALIGNED) _mm_store_si128((__m128i *)output+i, t);\ if (x & OUTPUT_ALIGNED) _mm_store_si128((__m128i *)output+i, t);\
@ -374,8 +384,9 @@ public:
/// \param iterationCount the number of iterations to perform on the input /// \param iterationCount the number of iterations to perform on the input
/// \sa IsSelfInverting() and IsForwardTransformation() /// \sa IsSelfInverting() and IsForwardTransformation()
virtual void Iterate(byte *output, const byte *input, CipherDir dir, size_t iterationCount) virtual void Iterate(byte *output, const byte *input, CipherDir dir, size_t iterationCount)
{CRYPTOPP_UNUSED(output); CRYPTOPP_UNUSED(input); CRYPTOPP_UNUSED(dir); CRYPTOPP_UNUSED(iterationCount); {CRYPTOPP_UNUSED(output); CRYPTOPP_UNUSED(input); CRYPTOPP_UNUSED(dir);
CRYPTOPP_ASSERT(false); /*throw 0;*/ throw Exception(Exception::OTHER_ERROR, "SimpleKeyingInterface: unexpected error");} CRYPTOPP_UNUSED(iterationCount); CRYPTOPP_ASSERT(false);
throw Exception(Exception::OTHER_ERROR, "SimpleKeyingInterface: unexpected error");}
/// \brief Key the cipher /// \brief Key the cipher
/// \param params set of NameValuePairs use to initialize this object /// \param params set of NameValuePairs use to initialize this object
@ -387,7 +398,8 @@ public:
/// \param iv a byte array used to resynchronize the cipher /// \param iv a byte array used to resynchronize the cipher
/// \param length the size of the IV array /// \param length the size of the IV array
virtual void CipherResynchronize(const byte *iv, size_t length) virtual void CipherResynchronize(const byte *iv, size_t length)
{CRYPTOPP_UNUSED(iv); CRYPTOPP_UNUSED(length); throw NotImplemented("SimpleKeyingInterface: this object doesn't support resynchronization");} {CRYPTOPP_UNUSED(iv); CRYPTOPP_UNUSED(length);
throw NotImplemented("SimpleKeyingInterface: this object doesn't support resynchronization");}
}; };
/// \brief Base class for feedback based stream ciphers /// \brief Base class for feedback based stream ciphers