Crypto++ 8.7
Free C++ class library of cryptographic schemes
Public Member Functions | Static Public Attributes | List of all members
ed25519_MessageAccumulator Struct Reference

ed25519 message accumulator More...

#include <xed25519.h>

+ Inheritance diagram for ed25519_MessageAccumulator:

Public Member Functions

 ed25519_MessageAccumulator ()
 Create a message accumulator. More...
 
 ed25519_MessageAccumulator (RandomNumberGenerator &rng)
 Create a message accumulator. More...
 
void Update (const byte *msg, size_t len)
 Add data to the accumulator. More...
 
void Restart ()
 Reset the accumulator. More...
 
bytesignature ()
 Retrieve pointer to signature buffer. More...
 
const bytesignature () const
 Retrieve pointer to signature buffer. More...
 
const bytedata () const
 Retrieve pointer to data buffer. More...
 
size_t size () const
 Retrieve size of data buffer. More...
 
- Public Member Functions inherited from PK_MessageAccumulator
unsigned int DigestSize () const
 
void TruncatedFinal (byte *digest, size_t digestSize)
 
- Public Member Functions inherited from HashTransformation
HashTransformationRef ()
 Provides a reference to this object. More...
 
virtual void Update (const byte *input, size_t length)=0
 Updates a hash with additional input. More...
 
virtual byteCreateUpdateSpace (size_t &size)
 Request space which can be written into by the caller. More...
 
virtual void Final (byte *digest)
 Computes the hash of the current message. More...
 
virtual void Restart ()
 Restart the hash. More...
 
virtual unsigned int DigestSize () const =0
 Provides the digest size of the hash. More...
 
unsigned int TagSize () const
 Provides the tag size of the hash. More...
 
virtual unsigned int BlockSize () const
 Provides the block size of the compression function. More...
 
virtual unsigned int OptimalBlockSize () const
 Provides the input block size most efficient for this hash. More...
 
virtual unsigned int OptimalDataAlignment () const
 Provides input and output data alignment for optimal performance. More...
 
virtual void CalculateDigest (byte *digest, const byte *input, size_t length)
 Updates the hash with additional input and computes the hash of the current message. More...
 
virtual bool Verify (const byte *digest)
 Verifies the hash of the current message. More...
 
virtual bool VerifyDigest (const byte *digest, const byte *input, size_t length)
 Updates the hash with additional input and verifies the hash of the current message. More...
 
virtual void TruncatedFinal (byte *digest, size_t digestSize)=0
 Computes the hash of the current message. More...
 
virtual void CalculateTruncatedDigest (byte *digest, size_t digestSize, const byte *input, size_t length)
 Updates the hash with additional input and computes the hash of the current message. More...
 
virtual bool TruncatedVerify (const byte *digest, size_t digestLength)
 Verifies the hash of the current message. More...
 
virtual bool VerifyTruncatedDigest (const byte *digest, size_t digestLength, const byte *input, size_t length)
 Updates the hash with additional input and verifies the hash of the current message. More...
 
- Public Member Functions inherited from Algorithm
 Algorithm (bool checkSelfTestStatus=true)
 Interface for all crypto algorithms. More...
 
virtual std::string AlgorithmName () const
 Provides the name of this algorithm. More...
 
virtual std::string AlgorithmProvider () const
 Retrieve the provider of this algorithm. More...
 
- Public Member Functions inherited from Clonable
virtual ClonableClone () const
 Copies this object. More...
 

Static Public Attributes

static const int RESERVE_SIZE =2048+64
 
static const int SIGNATURE_LENGTH =64
 

Detailed Description

ed25519 message accumulator

ed25519 buffers the entire message, and does not 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 digested by the application.

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.

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.

Definition at line 278 of file xed25519.h.

Constructor & Destructor Documentation

◆ ed25519_MessageAccumulator() [1/2]

ed25519_MessageAccumulator::ed25519_MessageAccumulator ( )
inline

Create a message accumulator.

Definition at line 284 of file xed25519.h.

◆ ed25519_MessageAccumulator() [2/2]

ed25519_MessageAccumulator::ed25519_MessageAccumulator ( RandomNumberGenerator rng)
inline

Create a message accumulator.

ed25519 does not use a RNG. You can safely use NullRNG() because IsProbablistic returns false.

Definition at line 291 of file xed25519.h.

Member Function Documentation

◆ Update()

void ed25519_MessageAccumulator::Update ( const byte msg,
size_t  len 
)
inlinevirtual

Add data to the accumulator.

Parameters
msgpointer to the data to accumulate
lenthe size of the data, in bytes

Implements HashTransformation.

Definition at line 298 of file xed25519.h.

◆ Restart()

void ed25519_MessageAccumulator::Restart ( )
inlinevirtual

Reset the accumulator.

Reimplemented from HashTransformation.

Definition at line 304 of file xed25519.h.

◆ signature() [1/2]

byte * ed25519_MessageAccumulator::signature ( )
inline

Retrieve pointer to signature buffer.

Returns
pointer to signature buffer

Definition at line 311 of file xed25519.h.

◆ signature() [2/2]

const byte * ed25519_MessageAccumulator::signature ( ) const
inline

Retrieve pointer to signature buffer.

Returns
pointer to signature buffer

Definition at line 317 of file xed25519.h.

◆ data()

const byte * ed25519_MessageAccumulator::data ( ) const
inline

Retrieve pointer to data buffer.

Returns
pointer to data buffer

Definition at line 323 of file xed25519.h.

◆ size()

size_t ed25519_MessageAccumulator::size ( ) const
inline

Retrieve size of data buffer.

Returns
size of the data buffer, in bytes

Definition at line 329 of file xed25519.h.

Member Data Documentation

◆ RESERVE_SIZE

const int ed25519_MessageAccumulator::RESERVE_SIZE =2048+64
static

Definition at line 280 of file xed25519.h.

◆ SIGNATURE_LENGTH

const int ed25519_MessageAccumulator::SIGNATURE_LENGTH =64
static

Definition at line 281 of file xed25519.h.


The documentation for this struct was generated from the following file: