From 64281d26f73412fb4e7881cce6f7af35a42a2932 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Thu, 8 Sep 2016 12:44:22 -0400 Subject: [PATCH 1/3] Add integer.cpp to third position in GNUmakefile --- GNUmakefile-cross | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GNUmakefile-cross b/GNUmakefile-cross index bad3c5a3..17fecb02 100755 --- a/GNUmakefile-cross +++ b/GNUmakefile-cross @@ -113,7 +113,7 @@ endif # Dead code stripping # List cryptlib.cpp first and cpu.cpp second in an attempt to tame C++ static initialization problems. # The issue spills into POD data types of cpu.cpp due to the storage class of the bools, so cpu.cpp # is the second candidate for explicit initialization order. -SRCS := cryptlib.cpp cpu.cpp $(filter-out cryptlib.cpp cpu.cpp pch.cpp simple.cpp winpipes.cpp cryptlib_bds.cpp,$(wildcard *.cpp)) +SRCS := cryptlib.cpp cpu.cpp integer.cpp $(filter-out cryptlib.cpp cpu.cpp integer.cpp pch.cpp simple.cpp winpipes.cpp cryptlib_bds.cpp,$(wildcard *.cpp)) OBJS := $(SRCS:.cpp=.o) # test.o needs to be after bench.o for cygwin 1.1.4 (possible ld bug?) From 1c2c91945b2cb9bdbb03e689bca3c5cf2293e012 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Thu, 8 Sep 2016 14:30:01 -0400 Subject: [PATCH 2/3] Updated documentation --- cryptlib.h | 4 ++-- fhmqv.h | 2 ++ hmqv.h | 2 ++ mqv.h | 2 ++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cryptlib.h b/cryptlib.h index 98bf5fe5..e934718c 100644 --- a/cryptlib.h +++ b/cryptlib.h @@ -17,7 +17,7 @@ Square, TEA, \ref ThreeWay "3-Way", Twofish, XTEA
Stream Ciphers
ChaCha8, ChaCha12, ChaCha20, \ref Panama "Panama-LE", \ref Panama "Panama-BE", Salsa20, \ref SEAL "SEAL-LE", \ref SEAL "SEAL-BE", WAKE, XSalsa20
Hash Functions
- BLAKE2s, BLAKE2b, SHA1, SHA224, SHA256, SHA384, SHA512, \ref SHA3 "SHA-3", Tiger, Whirlpool, RIPEMD160, RIPEMD320, RIPEMD128, RIPEMD256, Weak::MD2, Weak::MD4, Weak::MD5 + BLAKE2s, BLAKE2b, \ref Keccak "Keccak (F1600)", SHA1, SHA224, SHA256, SHA384, SHA512, \ref SHA3 "SHA-3", Tiger, Whirlpool, RIPEMD160, RIPEMD320, RIPEMD128, RIPEMD256, Weak::MD2, Weak::MD4, Weak::MD5
Non-Cryptographic Checksums
CRC32, Adler32
Message Authentication Codes
@@ -32,7 +32,7 @@ Square, TEA, \ref ThreeWay "3-Way", Twofish, XTEA
Public Key Signature Schemes
DSA2, GDSA, ECDSA, NR, ECNR, LUCSS, RSASS, RSASS_ISO, RabinSS, RWSS, ESIGN
Key Agreement
- DH, DH2, MQV, ECDH, ECMQV, XTR_DH + DH, DH2, \ref MQV_Domain "MQV", \ref HMQV_Domain "HMQV", \ref FHMQV_Domain "FHMQV", ECDH, ECMQV, ECHMQV, ECFHMQV, XTR_DH
Algebraic Structures
Integer, PolynomialMod2, PolynomialOver, RingOfPolynomialsOver, ModularArithmetic, MontgomeryRepresentation, GFP2_ONB, GF2NP, GF256, GF2_32, EC2N, ECP diff --git a/fhmqv.h b/fhmqv.h index 980f6c2f..6a527b70 100644 --- a/fhmqv.h +++ b/fhmqv.h @@ -17,6 +17,7 @@ NAMESPACE_BEGIN(CryptoPP) //! \details This implementation follows Augustin P. Sarr and Philippe Elbaz–Vincent, and Jean–Claude Bajard's //! A Secure and Efficient Authenticated Diffie-Hellman Protocol. //! Note: this is FHMQV, Protocol 5, from page 11; and not FHMQV-C. +//! \sa MQV, HMQV, FHMQV, and AuthenticatedKeyAgreementDomain template class FHMQV_Domain : public AuthenticatedKeyAgreementDomain { @@ -292,6 +293,7 @@ private: //! \details This implementation follows Augustin P. Sarr and Philippe Elbaz–Vincent, and Jean–Claude Bajard's //! A Secure and Efficient Authenticated Diffie-Hellman Protocol. //! Note: this is FHMQV, Protocol 5, from page 11; and not FHMQV-C. +//! \sa FHMQV, MQV_Domain, HMQV_Domain, AuthenticatedKeyAgreementDomain typedef FHMQV_Domain FHMQV; NAMESPACE_END diff --git a/hmqv.h b/hmqv.h index 87866e1b..697ae343 100644 --- a/hmqv.h +++ b/hmqv.h @@ -16,6 +16,7 @@ NAMESPACE_BEGIN(CryptoPP) //! \brief Hashed Menezes-Qu-Vanstone in GF(p) //! \details This implementation follows Hugo Krawczyk's HMQV: A High-Performance //! Secure Diffie-Hellman Protocol. Note: this implements HMQV only. HMQV-C with Key Confirmation is not provided. +//! \sa MQV, HMQV, FHMQV, and AuthenticatedKeyAgreementDomain template class HMQV_Domain: public AuthenticatedKeyAgreementDomain { @@ -300,6 +301,7 @@ private: //! \brief Hashed Menezes-Qu-Vanstone in GF(p) //! \details This implementation follows Hugo Krawczyk's HMQV: A High-Performance //! Secure Diffie-Hellman Protocol. Note: this implements HMQV only. HMQV-C with Key Confirmation is not provided. +//! \sa HMQV, MQV_Domain, FHMQV_Domain, AuthenticatedKeyAgreementDomain typedef HMQV_Domain HMQV; NAMESPACE_END diff --git a/mqv.h b/mqv.h index 673b1e68..cad30117 100644 --- a/mqv.h +++ b/mqv.h @@ -22,6 +22,7 @@ NAMESPACE_BEGIN(CryptoPP) //! \details GROUP_PARAMETERS paramters include the curve coefcients and the base point. //! Binary curves use a polynomial to represent its characteristic, while prime curves //! use a prime number. +//! \sa MQV, HMQV, FHMQV, and AuthenticatedKeyAgreementDomain template class MQV_Domain : public AuthenticatedKeyAgreementDomain { @@ -212,6 +213,7 @@ private: }; //! Menezes-Qu-Vanstone in GF(p) with key validation, AKA MQV +//! \sa MQV, HMQV_Domain, FHMQV_Domain, AuthenticatedKeyAgreementDomain typedef MQV_Domain MQV; NAMESPACE_END From 3697867fb587dc0b76ecefc632beaf9b995bf593 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Thu, 8 Sep 2016 14:41:42 -0400 Subject: [PATCH 3/3] Updated documentation --- hkdf.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/hkdf.h b/hkdf.h index 62df33e4..57c456b1 100644 --- a/hkdf.h +++ b/hkdf.h @@ -1,5 +1,8 @@ // hkdf.h - written and placed in public domain by Jeffrey Walton. Copyright assigned to Crypto++ project. +//! \file hkdf.h +//! \brief Classes for HKDF from RFC 5869 + #ifndef CRYPTOPP_HASH_KEY_DERIVATION_FUNCTION_H #define CRYPTOPP_HASH_KEY_DERIVATION_FUNCTION_H @@ -23,8 +26,10 @@ public: virtual ~KeyDerivationFunction() {} }; -//! General, multipurpose KDF from RFC 5869. T should be a HashTransformation class -//! https://eprint.iacr.org/2010/264 and https://tools.ietf.org/html/rfc5869 +//! \brief Extract-and-Expand Key Derivation Function (HKDF) +//! \tparam T HashTransformation class +//! \sa Cryptographic Extraction and Key Derivation: The HKDF Scheme +//! and HMAC-based Extract-and-Expand Key Derivation Function (HKDF) template class HKDF : public KeyDerivationFunction { @@ -38,7 +43,7 @@ public: size_t MaxDerivedKeyLength() const {return static_cast(T::DIGESTSIZE) * 255;} bool Usesinfo() const {return true;} unsigned int DeriveKey(byte *derived, size_t derivedLen, const byte *secret, size_t secretLen, const byte *salt, size_t saltLen, const byte* info, size_t infoLen) const; - + protected: // If salt is missing (NULL), then use the NULL vector. Missing is different than EMPTY (0 length). The length // of s_NullVector used depends on the Hash function. SHA-256 will use 32 bytes of s_NullVector. @@ -54,7 +59,7 @@ unsigned int HKDF::DeriveKey(byte *derived, size_t derivedLen, const byte *se { static const size_t DIGEST_SIZE = static_cast(T::DIGESTSIZE); const unsigned int req = static_cast(derivedLen); - + assert(secret && secretLen); assert(derived && derivedLen); assert(derivedLen <= MaxDerivedKeyLength());