Crypto++  5.6.3
Free C++ class library of cryptographic schemes
Public Types | Public Member Functions | Public Attributes | List of all members
SecBlockWithHint< T, S, A > Class Template Reference

Stack-based SecBlock that grows into the heap. More...

+ Inheritance diagram for SecBlockWithHint< T, S, A >:

Public Types

typedef A::value_type value_type
 
typedef A::pointer iterator
 
typedef A::const_pointer const_iterator
 
typedef A::size_type size_type
 

Public Member Functions

 SecBlockWithHint (size_t size)
 construct a SecBlockWithHint with a count of elements
 
 operator const void * () const
 
 operator void * ()
 
 operator const T * () const
 
 operator T * ()
 
iterator begin ()
 Provides an iterator pointing to the first element in the memory block. More...
 
const_iterator begin () const
 Provides a constant iterator pointing to the first element in the memory block. More...
 
iterator end ()
 Provides an iterator pointing beyond the last element in the memory block. More...
 
const_iterator end () const
 Provides a constant iterator pointing beyond the last element in the memory block. More...
 
A::pointer data ()
 Provides a pointer to the first element in the memory block. More...
 
A::const_pointer data () const
 Provides a pointer to the first element in the memory block. More...
 
size_type size () const
 Provides the count of elements in the SecBlock. More...
 
bool empty () const
 Determines if the SecBlock is empty. More...
 
byte * BytePtr ()
 Provides a byte pointer to the first element in the memory block. More...
 
const byte * BytePtr () const
 Return a byte pointer to the first element in the memory block. More...
 
size_type SizeInBytes () const
 Provides the number of bytes in the SecBlock. More...
 
void Assign (const T *ptr, size_type len)
 Set contents and size from an array. More...
 
void Assign (const SecBlock< T, A > &t)
 Copy contents from another SecBlock. More...
 
SecBlock< T, A > & operator+= (const SecBlock< T, A > &t)
 Append contents from another SecBlock. More...
 
SecBlock< T, A > operator+ (const SecBlock< T, A > &t)
 Concatenate contents from another SecBlock. More...
 
bool operator== (const SecBlock< T, A > &t) const
 Bitwise compare two SecBlocks. More...
 
bool operator!= (const SecBlock< T, A > &t) const
 Bitwise compare two SecBlocks. More...
 
void New (size_type newSize)
 Change size without preserving contents. More...
 
void CleanNew (size_type newSize)
 Change size without preserving contents. More...
 
void Grow (size_type newSize)
 Change size and preserve contents. More...
 
void CleanGrow (size_type newSize)
 Change size and preserve contents. More...
 
void resize (size_type newSize)
 Change size and preserve contents. More...
 
void swap (SecBlock< T, A > &b)
 Swap contents with another SecBlock. More...
 

Public Attributes

m_alloc
 
size_type m_size
 
T * m_ptr
 

Detailed Description

template<class T, unsigned int S, class A = FixedSizeAllocatorWithCleanup<T, S, AllocatorWithCleanup<T> >>
class SecBlockWithHint< T, S, A >

Stack-based SecBlock that grows into the heap.

Template Parameters
Tclass or type
Sfixed-size of the stack-based memory block
AAllocatorBase derived class for allocation and cleanup

Definition at line 764 of file secblock.h.

Member Function Documentation

template<class T, class A = AllocatorWithCleanup<T>>
iterator SecBlock< T, A >::begin ( )
inlineinherited

Provides an iterator pointing to the first element in the memory block.

Returns
iterator pointing to the first element in the memory block

Definition at line 484 of file secblock.h.

Referenced by DEREncodeOctetString(), HuffmanEncoder::Initialize(), Deflator::IsolatedFlush(), Inflator::IsolatedFlush(), and Deflator::IsolatedInitialize().

template<class T, class A = AllocatorWithCleanup<T>>
const_iterator SecBlock< T, A >::begin ( ) const
inlineinherited

Provides a constant iterator pointing to the first element in the memory block.

Returns
constant iterator pointing to the first element in the memory block

Definition at line 488 of file secblock.h.

template<class T, class A = AllocatorWithCleanup<T>>
iterator SecBlock< T, A >::end ( )
inlineinherited

Provides an iterator pointing beyond the last element in the memory block.

Returns
iterator pointing beyond the last element in the memory block

Definition at line 492 of file secblock.h.

Referenced by HuffmanEncoder::Initialize(), Deflator::IsolatedFlush(), and Deflator::IsolatedInitialize().

template<class T, class A = AllocatorWithCleanup<T>>
const_iterator SecBlock< T, A >::end ( ) const
inlineinherited

Provides a constant iterator pointing beyond the last element in the memory block.

Returns
constant iterator pointing beyond the last element in the memory block

Definition at line 496 of file secblock.h.

template<class T, class A = AllocatorWithCleanup<T>>
A::pointer SecBlock< T, A >::data ( )
inlineinherited

Provides a pointer to the first element in the memory block.

Returns
pointer to the first element in the memory block

Definition at line 501 of file secblock.h.

Referenced by HKDF< T >::DeriveKey(), and RandomPool::GenerateIntoBufferedTransformation().

template<class T, class A = AllocatorWithCleanup<T>>
A::const_pointer SecBlock< T, A >::data ( ) const
inlineinherited

Provides a pointer to the first element in the memory block.

Returns
constant pointer to the first element in the memory block

Definition at line 504 of file secblock.h.

template<class T, class A = AllocatorWithCleanup<T>>
size_type SecBlock< T, A >::size ( ) const
inlineinherited

Provides the count of elements in the SecBlock.

Returns
number of elements in the memory block
Note
the return value is the count of elements, and not the number of bytes

Definition at line 509 of file secblock.h.

Referenced by PolynomialMod2::AllOnes(), DL_PrivateKey_EC< EC >::BERDecodePrivateKey(), Integer::Decode(), TF_DecryptorBase::Decrypt(), DL_DecryptorBase< SCHEME_OPTIONS::Element >::Decrypt(), DefaultDecryptor::DefaultDecryptor(), DefaultEncryptor::DefaultEncryptor(), DEREncodeOctetString(), HKDF< T >::DeriveKey(), PKCS12_PBKDF< T >::DeriveKey(), PolynomialMod2::Divide(), Integer::DivideByPowerOf2(), TF_EncryptorBase::Encrypt(), RandomPool::GenerateIntoBufferedTransformation(), X917RNG::GenerateIntoBufferedTransformation(), RandomNumberGenerator::GenerateIntoBufferedTransformation(), PolynomialMod2::GetByte(), TF_VerifierBase::InputSignature(), DL_VerifierBase< SCHEME_OPTIONS::Element >::InputSignature(), Integer::Integer(), IntegrityCheckModule(), Integer::InverseMod(), PolynomialMod2::IsIrreducible(), Deflator::IsolatedFlush(), Inflator::IsolatedInitialize(), SecBlock< word32 >::operator+(), SecBlock< word32 >::operator+=(), PolynomialMod2::Parity(), PolynomialMod2::PolynomialMod2(), DL_VerifierBase< SCHEME_OPTIONS::Element >::RecoverAndRestart(), AutoSeededX917RNG< BLOCK_CIPHER >::Reseed(), PolynomialOver< T >::SetCoefficient(), TF_SignerBase::SignAndRestart(), DL_SignerBase< SCHEME_OPTIONS::Element >::SignAndRestart(), Integer::Two(), DL_VerifierBase< SCHEME_OPTIONS::Element >::VerifyAndRestart(), and Integer::WordCount().

template<class T, class A = AllocatorWithCleanup<T>>
bool SecBlock< T, A >::empty ( ) const
inlineinherited

Determines if the SecBlock is empty.

Returns
true if number of elements in the memory block is 0, false otherwise

Definition at line 512 of file secblock.h.

template<class T, class A = AllocatorWithCleanup<T>>
byte* SecBlock< T, A >::BytePtr ( )
inlineinherited

Provides a byte pointer to the first element in the memory block.

Returns
byte pointer to the first element in the memory block

Definition at line 516 of file secblock.h.

Referenced by SHA3::TruncatedFinal(), Weak::PanamaHash< B >::TruncatedFinal(), VMAC_Base::UncheckedSetKey(), and SHA3::Update().

template<class T, class A = AllocatorWithCleanup<T>>
const byte* SecBlock< T, A >::BytePtr ( ) const
inlineinherited

Return a byte pointer to the first element in the memory block.

Returns
constant byte pointer to the first element in the memory block

Definition at line 519 of file secblock.h.

template<class T, class A = AllocatorWithCleanup<T>>
size_type SecBlock< T, A >::SizeInBytes ( ) const
inlineinherited

Provides the number of bytes in the SecBlock.

Returns
the number of bytes in the memory block
Note
the return value is the number of bytes, and not count of elements.

Definition at line 523 of file secblock.h.

Referenced by Integer::Decode(), and SHA3::Restart().

template<class T, class A = AllocatorWithCleanup<T>>
void SecBlock< T, A >::Assign ( const T *  ptr,
size_type  len 
)
inlineinherited

Set contents and size from an array.

Parameters
ptra pointer to an array of T
lenthe number of elements in the memory block

If the memory block is reduced in size, then the unused area is set to 0.

Definition at line 529 of file secblock.h.

Referenced by DL_VerifierBase< SCHEME_OPTIONS::Element >::InputSignature().

template<class T, class A = AllocatorWithCleanup<T>>
void SecBlock< T, A >::Assign ( const SecBlock< T, A > &  t)
inlineinherited

Copy contents from another SecBlock.

Parameters
tthe other SecBlock

Assign checks for self assignment.

If the memory block is reduced in size, then the unused area is set to 0.

Definition at line 540 of file secblock.h.

template<class T, class A = AllocatorWithCleanup<T>>
SecBlock<T, A>& SecBlock< T, A >::operator+= ( const SecBlock< T, A > &  t)
inlineinherited

Append contents from another SecBlock.

Parameters
tthe other SecBlock

Internally, this SecBlock calls Grow and then copies the new content.

If the memory block is reduced in size, then the unused area is set to 0.

Definition at line 565 of file secblock.h.

template<class T, class A = AllocatorWithCleanup<T>>
SecBlock<T, A> SecBlock< T, A >::operator+ ( const SecBlock< T, A > &  t)
inlineinherited

Concatenate contents from another SecBlock.

Parameters
tthe other SecBlock
Returns
a newly constructed SecBlock that is a conacentation of this and t

Internally, a temporary SecBlock is created and the content from this SecBlock and the other SecBlock are concatenated. The temporary SecBlock is returned to the caller.

Definition at line 586 of file secblock.h.

template<class T, class A = AllocatorWithCleanup<T>>
bool SecBlock< T, A >::operator== ( const SecBlock< T, A > &  t) const
inlineinherited

Bitwise compare two SecBlocks.

Parameters
tthe other SecBlock
Returns
true if the size and bits are equal, false otherwise

Uses a constant time compare if the arrays are equal size. The constant time compare is VerifyBufsEqual() found in misc.h.

See also
operator!=()

Definition at line 604 of file secblock.h.

template<class T, class A = AllocatorWithCleanup<T>>
bool SecBlock< T, A >::operator!= ( const SecBlock< T, A > &  t) const
inlineinherited

Bitwise compare two SecBlocks.

Parameters
tthe other SecBlock
Returns
true if the size and bits are equal, false otherwise

Uses a constant time compare if the arrays are equal size. The constant time compare is VerifyBufsEqual() found in misc.h.

Internally, operator!=() returns the inverse of operator==().

See also
operator==()

Definition at line 616 of file secblock.h.

template<class T, class A = AllocatorWithCleanup<T>>
void SecBlock< T, A >::New ( size_type  newSize)
inlineinherited

Change size without preserving contents.

Parameters
newSizethe new size of the memory block

Old content is not preserved. If the memory block is reduced in size, then the unused content is set to 0. If the memory block grows in size, then all content is uninitialized.

Internally, this SecBlock calls reallocate().

See also
New(), CleanNew(), Grow(), CleanGrow(), resize()

Definition at line 628 of file secblock.h.

Referenced by DEREncodeOctetString(), TF_VerifierBase::InputSignature(), Inflator::IsolatedFlush(), Deflator::IsolatedInitialize(), BaseN_Decoder::IsolatedInitialize(), DL_VerifierBase< SCHEME_OPTIONS::Element >::RecoverAndRestart(), and SAFER::Base::UncheckedSetKey().

template<class T, class A = AllocatorWithCleanup<T>>
void SecBlock< T, A >::CleanNew ( size_type  newSize)
inlineinherited

Change size without preserving contents.

Parameters
newSizethe new size of the memory block

Old content is not preserved. If the memory block is reduced in size, then the unused content is set to 0. Existing and new content is set to 0.

Internally, this SecBlock calls reallocate().

See also
New(), CleanNew(), Grow(), CleanGrow(), resize()

Definition at line 640 of file secblock.h.

Referenced by Integer::Decode(), PolynomialMod2::Divide(), Integer::Divide(), Integer::Times(), CMAC_Base::UncheckedSetKey(), and VMAC_Base::UncheckedSetKey().

template<class T, class A = AllocatorWithCleanup<T>>
void SecBlock< T, A >::Grow ( size_type  newSize)
inlineinherited

Change size and preserve contents.

Parameters
newSizethe new size of the memory block

Old content is preserved. If the memory block grows in size, then all content is uninitialized.

Internally, this SecBlock calls reallocate().

Note
reallocate() is called if the size increases. If the size does not increase, then Grow does not take action. If the size must change, then use resize().
See also
New(), CleanNew(), Grow(), CleanGrow(), resize()

Definition at line 655 of file secblock.h.

Referenced by PolynomialOver< T >::SetCoefficient().

template<class T, class A = AllocatorWithCleanup<T>>
void SecBlock< T, A >::CleanGrow ( size_type  newSize)
inlineinherited

Change size and preserve contents.

Parameters
newSizethe new size of the memory block

Old content is preserved. If the memory block is reduced in size, then the unused content is set to 0. If the memory block grows in size, then the new content is uninitialized.

Internally, this SecBlock calls reallocate().

Note
reallocate() is called if the size increases. If the size does not increase, then Grow does not take action. If the size must change, then use resize().
See also
New(), CleanNew(), Grow(), CleanGrow(), resize()

Definition at line 674 of file secblock.h.

Referenced by PolynomialMod2::AllOnes(), and PolynomialMod2::SetByte().

template<class T, class A = AllocatorWithCleanup<T>>
void SecBlock< T, A >::resize ( size_type  newSize)
inlineinherited

Change size and preserve contents.

Parameters
newSizethe new size of the memory block

Old content is preserved. If the memory block grows in size, then all content is uninitialized.

Internally, this SecBlock calls reallocate().

Note
reallocate() is called if the size increases. If the size does not increase, then Grow does not take action. If the size must change, then use resize().
See also
New(), CleanNew(), Grow(), CleanGrow(), resize()

Definition at line 693 of file secblock.h.

Referenced by DEREncodeBitString(), Integer::DivideByPowerOf2(), InvertibleESIGNFunction::GenerateRandom(), and IntegrityCheckModule().

template<class T, class A = AllocatorWithCleanup<T>>
void SecBlock< T, A >::swap ( SecBlock< T, A > &  b)
inlineinherited

Swap contents with another SecBlock.

Parameters
bthe other SecBlock

Internally, std::swap() is called on m_alloc, m_size and m_ptr.

Definition at line 702 of file secblock.h.


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