Merge 'master' into 'hmqv'
commit
83ac84976e
6
chacha.h
6
chacha.h
|
|
@ -49,7 +49,7 @@ protected:
|
||||||
struct ChaCha8 : public ChaCha_Info<8>, public SymmetricCipherDocumentation
|
struct ChaCha8 : public ChaCha_Info<8>, public SymmetricCipherDocumentation
|
||||||
{
|
{
|
||||||
typedef SymmetricCipherFinal<ConcretePolicyHolder<ChaCha_Policy<8>, AdditiveCipherTemplate<> >, ChaCha_Info<8> > Encryption;
|
typedef SymmetricCipherFinal<ConcretePolicyHolder<ChaCha_Policy<8>, AdditiveCipherTemplate<> >, ChaCha_Info<8> > Encryption;
|
||||||
typedef SymmetricCipherFinal<ConcretePolicyHolder<ChaCha_Policy<8>, AdditiveCipherTemplate<> >, ChaCha_Info<8> > Decryption;
|
typedef Encryption Decryption;
|
||||||
};
|
};
|
||||||
|
|
||||||
//! \class ChaCha12
|
//! \class ChaCha12
|
||||||
|
|
@ -58,7 +58,7 @@ struct ChaCha8 : public ChaCha_Info<8>, public SymmetricCipherDocumentation
|
||||||
struct ChaCha12 : public ChaCha_Info<12>, public SymmetricCipherDocumentation
|
struct ChaCha12 : public ChaCha_Info<12>, public SymmetricCipherDocumentation
|
||||||
{
|
{
|
||||||
typedef SymmetricCipherFinal<ConcretePolicyHolder<ChaCha_Policy<12>, AdditiveCipherTemplate<> >, ChaCha_Info<12> > Encryption;
|
typedef SymmetricCipherFinal<ConcretePolicyHolder<ChaCha_Policy<12>, AdditiveCipherTemplate<> >, ChaCha_Info<12> > Encryption;
|
||||||
typedef SymmetricCipherFinal<ConcretePolicyHolder<ChaCha_Policy<12>, AdditiveCipherTemplate<> >, ChaCha_Info<12> > Decryption;
|
typedef Encryption Decryption;
|
||||||
};
|
};
|
||||||
|
|
||||||
//! \class ChaCha20
|
//! \class ChaCha20
|
||||||
|
|
@ -67,7 +67,7 @@ struct ChaCha12 : public ChaCha_Info<12>, public SymmetricCipherDocumentation
|
||||||
struct ChaCha20 : public ChaCha_Info<20>, public SymmetricCipherDocumentation
|
struct ChaCha20 : public ChaCha_Info<20>, public SymmetricCipherDocumentation
|
||||||
{
|
{
|
||||||
typedef SymmetricCipherFinal<ConcretePolicyHolder<ChaCha_Policy<20>, AdditiveCipherTemplate<> >, ChaCha_Info<20> > Encryption;
|
typedef SymmetricCipherFinal<ConcretePolicyHolder<ChaCha_Policy<20>, AdditiveCipherTemplate<> >, ChaCha_Info<20> > Encryption;
|
||||||
typedef SymmetricCipherFinal<ConcretePolicyHolder<ChaCha_Policy<20>, AdditiveCipherTemplate<> >, ChaCha_Info<20> > Decryption;
|
typedef Encryption Decryption;
|
||||||
};
|
};
|
||||||
|
|
||||||
NAMESPACE_END
|
NAMESPACE_END
|
||||||
|
|
|
||||||
14
integer.cpp
14
integer.cpp
|
|
@ -67,16 +67,6 @@
|
||||||
# define CRYPTOPP_INTEGER_SSE2 (CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE && CRYPTOPP_BOOL_X86)
|
# define CRYPTOPP_INTEGER_SSE2 (CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE && CRYPTOPP_BOOL_X86)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Debian QEMU/ARMEL issue in MultiplyTop; see http://github.com/weidai11/cryptopp/issues/31.
|
|
||||||
#if __ARMEL__ && (CRYPTOPP_GCC_VERSION >= 40900) && (CRYPTOPP_GCC_VERSION < 70000) && __OPTIMIZE__
|
|
||||||
# define WORKAROUND_ARMEL_BUG 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if WORKAROUND_ARMEL_BUG
|
|
||||||
# pragma GCC push_options
|
|
||||||
# pragma GCC optimize("O1")
|
|
||||||
#endif
|
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
bool AssignIntToInteger(const std::type_info &valueType, void *pInteger, const void *pInt)
|
bool AssignIntToInteger(const std::type_info &valueType, void *pInteger, const void *pInt)
|
||||||
|
|
@ -4559,8 +4549,4 @@ std::string IntToString<word64>(word64 value, unsigned int base)
|
||||||
|
|
||||||
NAMESPACE_END
|
NAMESPACE_END
|
||||||
|
|
||||||
#if WORKAROUND_ARMEL_BUG
|
|
||||||
# pragma GCC pop_options
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
22
integer.h
22
integer.h
|
|
@ -107,7 +107,7 @@ public:
|
||||||
//! \details Byte order was added at Crypto++ 5.7 to allow use of little-endian
|
//! \details Byte order was added at Crypto++ 5.7 to allow use of little-endian
|
||||||
//! integers with curve25519, Poly1305 and Microsoft CAPI.
|
//! integers with curve25519, Poly1305 and Microsoft CAPI.
|
||||||
explicit Integer(const char *str, ByteOrder order = BIG_ENDIAN_ORDER);
|
explicit Integer(const char *str, ByteOrder order = BIG_ENDIAN_ORDER);
|
||||||
|
|
||||||
//! \brief Convert from a wide C-string
|
//! \brief Convert from a wide C-string
|
||||||
//! \param str wide C-string value
|
//! \param str wide C-string value
|
||||||
//! \param order byte order
|
//! \param order byte order
|
||||||
|
|
@ -225,8 +225,8 @@ public:
|
||||||
//! \details OpenPGPEncode places result into a BufferedTransformation object and returns the
|
//! \details OpenPGPEncode places result into a BufferedTransformation object and returns the
|
||||||
//! number of bytes used for the encoding
|
//! number of bytes used for the encoding
|
||||||
size_t OpenPGPEncode(byte *output, size_t bufferSize) const;
|
size_t OpenPGPEncode(byte *output, size_t bufferSize) const;
|
||||||
|
|
||||||
//! \brief Encode absolute value in OpenPGP format
|
//! \brief Encode absolute value in OpenPGP format
|
||||||
//! \param bt BufferedTransformation object
|
//! \param bt BufferedTransformation object
|
||||||
//! \returns length of the output
|
//! \returns length of the output
|
||||||
//! \details OpenPGPEncode places result into a BufferedTransformation object and returns the
|
//! \details OpenPGPEncode places result into a BufferedTransformation object and returns the
|
||||||
|
|
@ -238,7 +238,7 @@ public:
|
||||||
//! \param inputLen length of the byte array
|
//! \param inputLen length of the byte array
|
||||||
//! \param sign enumeration indicating Signedness
|
//! \param sign enumeration indicating Signedness
|
||||||
void Decode(const byte *input, size_t inputLen, Signedness sign=UNSIGNED);
|
void Decode(const byte *input, size_t inputLen, Signedness sign=UNSIGNED);
|
||||||
|
|
||||||
//! \brief Decode nonnegative value from big-endian byte array
|
//! \brief Decode nonnegative value from big-endian byte array
|
||||||
//! \param bt BufferedTransformation object
|
//! \param bt BufferedTransformation object
|
||||||
//! \param inputLen length of the byte array
|
//! \param inputLen length of the byte array
|
||||||
|
|
@ -263,7 +263,7 @@ public:
|
||||||
//! \brief Exception thrown when an error is encountered decoding an OpenPGP integer
|
//! \brief Exception thrown when an error is encountered decoding an OpenPGP integer
|
||||||
class OpenPGPDecodeErr : public Exception
|
class OpenPGPDecodeErr : public Exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
OpenPGPDecodeErr() : Exception(INVALID_DATA_FORMAT, "OpenPGP decode error") {}
|
OpenPGPDecodeErr() : Exception(INVALID_DATA_FORMAT, "OpenPGP decode error") {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -409,10 +409,10 @@ public:
|
||||||
|
|
||||||
//! \brief Reverse the Sign of the Integer
|
//! \brief Reverse the Sign of the Integer
|
||||||
void Negate();
|
void Negate();
|
||||||
|
|
||||||
//! \brief Sets the Integer to positive
|
//! \brief Sets the Integer to positive
|
||||||
void SetPositive() {sign = POSITIVE;}
|
void SetPositive() {sign = POSITIVE;}
|
||||||
|
|
||||||
//! \brief Sets the Integer to negative
|
//! \brief Sets the Integer to negative
|
||||||
void SetNegative() {if (!!(*this)) sign = NEGATIVE;}
|
void SetNegative() {if (!!(*this)) sign = NEGATIVE;}
|
||||||
|
|
||||||
|
|
@ -528,7 +528,7 @@ public:
|
||||||
//! \sa IntToString<Integer>
|
//! \sa IntToString<Integer>
|
||||||
friend CRYPTOPP_DLL std::ostream& CRYPTOPP_API operator<<(std::ostream& out, const Integer &a);
|
friend CRYPTOPP_DLL std::ostream& CRYPTOPP_API operator<<(std::ostream& out, const Integer &a);
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
#ifndef CRYPTOPP_DOXYGEN_PROCESSING
|
#ifndef CRYPTOPP_DOXYGEN_PROCESSING
|
||||||
//! modular multiplication
|
//! modular multiplication
|
||||||
CRYPTOPP_DLL friend Integer CRYPTOPP_API a_times_b_mod_c(const Integer &x, const Integer& y, const Integer& m);
|
CRYPTOPP_DLL friend Integer CRYPTOPP_API a_times_b_mod_c(const Integer &x, const Integer& y, const Integer& m);
|
||||||
|
|
@ -537,13 +537,13 @@ public:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Integer(word value, size_t length);
|
Integer(word value, size_t length);
|
||||||
int PositiveCompare(const Integer &t) const;
|
int PositiveCompare(const Integer &t) const;
|
||||||
|
|
||||||
IntegerSecBlock reg;
|
IntegerSecBlock reg;
|
||||||
Sign sign;
|
Sign sign;
|
||||||
|
|
||||||
#ifndef CRYPTOPP_DOXYGEN_PROCESSING
|
#ifndef CRYPTOPP_DOXYGEN_PROCESSING
|
||||||
friend class ModularArithmetic;
|
friend class ModularArithmetic;
|
||||||
friend class MontgomeryRepresentation;
|
friend class MontgomeryRepresentation;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue