From da2444d243ddcc211a0107740faae7401c3de773 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Wed, 2 Jan 2019 12:02:32 -0500 Subject: [PATCH] Update documentation --- validate.h | 2 +- xed25519.h | 25 ++++++++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/validate.h b/validate.h index d49a8dea..3fa49d12 100644 --- a/validate.h +++ b/validate.h @@ -305,7 +305,7 @@ inline std::string DataDir(const std::string& filename) if (file.is_open()) return name; #else - // Avoid static initialzation problems + // Avoid static initialization problems name = AddSeparator(GetDataDir()) + filename; file.open(name.c_str()); if (file.is_open()) diff --git a/xed25519.h b/xed25519.h index 354d49ae..1f270174 100644 --- a/xed25519.h +++ b/xed25519.h @@ -249,7 +249,22 @@ protected: /// digest the message incrementally. You should be careful with /// large messages like files on-disk. The behavior is by design /// because Bernstein feels small messages should be authenticated; -/// and larger messages will be hashed by the application. +/// and larger messages will be digested by the application. +/// \details The accumulator is used for signing and verification. +/// The first 64-bytes of storage is reserved for the signature. +/// During signing the signature storage is unused. During +/// verification the first 64 bytes holds the signature. The +/// signature is provided by the PK_Verifier framework and the +/// call to PK_Signer::InputSignature. Member functions data() +/// and size() refer to the accumulated message. Member function +/// signature() refers to the signature with an implicit size of +/// SIGNATURE_LENGTH bytes. +/// \details Applications which digest large messages, like an ISO +/// disk file, should take care because the design effectively +/// disgorges the format operation from the signing operation. +/// Put another way, be careful to ensure what you are signing is +/// is in fact a digest of the intended message, and not a different +/// message digest supplied by an attacker. struct ed25519_MessageAccumulator : public PK_MessageAccumulator { CRYPTOPP_CONSTANT(RESERVE_SIZE=2048+64) @@ -267,14 +282,6 @@ struct ed25519_MessageAccumulator : public PK_MessageAccumulator CRYPTOPP_UNUSED(rng); Restart(); } - /// \brief Add data to the accumulator - /// \param msg pointer to the data to accumulate - /// \param len the size of the data, in bytes - void Update(const byte* msg, size_t len) { - if (msg && len) - m_msg.insert(m_msg.end(), msg, msg+len); - } - /// \brief Reset the accumulator void Restart() { m_msg.reserve(RESERVE_SIZE);