FixedSizeSecBlock< T, S, A > Class Template Reference

Fixed size stack-based SecBlock. More...

Inheritance diagram for FixedSizeSecBlock< T, S, A >:
SecBlock< T, A >

List of all members.

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

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

Public Attributes

m_alloc
size_type m_size
T * m_ptr

Detailed Description

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

Fixed size stack-based SecBlock.

Template Parameters:
T class or type
S fixed-size of the stack-based memory block
A AllocatorBase derived class for allocation and cleanup

Definition at line 744 of file secblock.h.


Member Function Documentation

template<class T, class A = AllocatorWithCleanup<T>>
iterator SecBlock< T, A >::begin (  )  [inline, inherited]

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 487 of file secblock.h.

Referenced by HuffmanEncoder::Initialize().

template<class T, class A = AllocatorWithCleanup<T>>
const_iterator SecBlock< T, A >::begin (  )  const [inline, inherited]

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 491 of file secblock.h.

template<class T, class A = AllocatorWithCleanup<T>>
iterator SecBlock< T, A >::end (  )  [inline, inherited]

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 495 of file secblock.h.

Referenced by HuffmanEncoder::Initialize().

template<class T, class A = AllocatorWithCleanup<T>>
const_iterator SecBlock< T, A >::end (  )  const [inline, inherited]

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 499 of file secblock.h.

template<class T, class A = AllocatorWithCleanup<T>>
A::pointer SecBlock< T, A >::data (  )  [inline, inherited]

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

Returns:
pointer to the first element in the memory block

Definition at line 504 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 [inline, inherited]

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 507 of file secblock.h.

template<class T, class A = AllocatorWithCleanup<T>>
size_type SecBlock< T, A >::size (  )  const [inline, inherited]

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 512 of file secblock.h.

Referenced by PolynomialMod2::AllOnes(), DL_PrivateKey_EC< EC >::BERDecodePrivateKey(), Integer::Decode(), DL_DecryptorBase< SCHEME_OPTIONS::Element >::Decrypt(), TF_DecryptorBase::Decrypt(), PKCS12_PBKDF< T >::DeriveKey(), HKDF< T >::DeriveKey(), Integer::DivideByPowerOf2(), TF_EncryptorBase::Encrypt(), KDF2_RNG::GenerateBlock(), X917RNG::GenerateIntoBufferedTransformation(), RandomPool::GenerateIntoBufferedTransformation(), RandomNumberGenerator::GenerateIntoBufferedTransformation(), Integer::GetBit(), Integer::GetByte(), PolynomialMod2::GetByte(), DL_VerifierBase< SCHEME_OPTIONS::Element >::InputSignature(), TF_VerifierBase::InputSignature(), Integer::Integer(), IntegrityCheckModule(), Integer::InverseMod(), SecBlock< word32 >::operator+(), SecBlock< word32 >::operator+=(), PolynomialMod2::Parity(), PolynomialMod2::PolynomialMod2(), SignerFilter::Put2(), PK_DefaultEncryptionFilter::Put2(), Grouper::Put2(), DL_VerifierBase< SCHEME_OPTIONS::Element >::RecoverAndRestart(), AutoSeededX917RNG< BLOCK_CIPHER >::Reseed(), Integer::SetBit(), DL_SignerBase< SCHEME_OPTIONS::Element >::SignAndRestart(), TF_SignerBase::SignAndRestart(), DMAC_Base< T >::UncheckedSetKey(), DL_VerifierBase< SCHEME_OPTIONS::Element >::VerifyAndRestart(), Integer::WordCount(), and PolynomialMod2::WordCount().

template<class T, class A = AllocatorWithCleanup<T>>
bool SecBlock< T, A >::empty (  )  const [inline, inherited]

Determines if the SecBlock is empty.

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

Definition at line 515 of file secblock.h.

template<class T, class A = AllocatorWithCleanup<T>>
byte* SecBlock< T, A >::BytePtr (  )  [inline, inherited]

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 519 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 [inline, inherited]

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 522 of file secblock.h.

template<class T, class A = AllocatorWithCleanup<T>>
size_type SecBlock< T, A >::SizeInBytes (  )  const [inline, inherited]

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 526 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 
) [inline, inherited]

Set contents and size from an array.

Parameters:
ptr a pointer to an array of T
len the 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 532 of file secblock.h.

Referenced by DL_VerifierBase< SCHEME_OPTIONS::Element >::InputSignature(), Grouper::IsolatedInitialize(), and SecBlock< word32 >::operator=().

template<class T, class A = AllocatorWithCleanup<T>>
void SecBlock< T, A >::Assign ( const SecBlock< T, A > &  t  )  [inline, inherited]

Copy contents from another SecBlock.

Parameters:
t the 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 543 of file secblock.h.

template<class T, class A = AllocatorWithCleanup<T>>
SecBlock<T, A>& SecBlock< T, A >::operator+= ( const SecBlock< T, A > &  t  )  [inline, inherited]

Append contents from another SecBlock.

Parameters:
t the 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 568 of file secblock.h.

template<class T, class A = AllocatorWithCleanup<T>>
SecBlock<T, A> SecBlock< T, A >::operator+ ( const SecBlock< T, A > &  t  )  [inline, inherited]

Concatenate contents from another SecBlock.

Parameters:
t the 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 589 of file secblock.h.

template<class T, class A = AllocatorWithCleanup<T>>
bool SecBlock< T, A >::operator== ( const SecBlock< T, A > &  t  )  const [inline, inherited]

Bitwise compare two SecBlocks.

Parameters:
t the 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 607 of file secblock.h.

Referenced by SecBlock< word32 >::operator!=().

template<class T, class A = AllocatorWithCleanup<T>>
bool SecBlock< T, A >::operator!= ( const SecBlock< T, A > &  t  )  const [inline, inherited]

Bitwise compare two SecBlocks.

Parameters:
t the 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 619 of file secblock.h.

template<class T, class A = AllocatorWithCleanup<T>>
void SecBlock< T, A >::New ( size_type  newSize  )  [inline, inherited]

Change size without preserving contents.

Parameters:
newSize the 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 631 of file secblock.h.

Referenced by SecBlock< word32 >::Assign(), SecBlock< word32 >::CleanNew(), TF_VerifierBase::InputSignature(), Deflator::IsolatedInitialize(), BaseN_Decoder::IsolatedInitialize(), SignerFilter::Put2(), 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  )  [inline, inherited]

Change size without preserving contents.

Parameters:
newSize the 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 643 of file secblock.h.

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

template<class T, class A = AllocatorWithCleanup<T>>
void SecBlock< T, A >::Grow ( size_type  newSize  )  [inline, inherited]

Change size and preserve contents.

Parameters:
newSize the 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 658 of file secblock.h.

Referenced by SecBlock< word32 >::operator+=().

template<class T, class A = AllocatorWithCleanup<T>>
void SecBlock< T, A >::CleanGrow ( size_type  newSize  )  [inline, inherited]

Change size and preserve contents.

Parameters:
newSize the 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 677 of file secblock.h.

Referenced by Integer::SetBit(), Integer::SetByte(), and PolynomialMod2::SetByte().

template<class T, class A = AllocatorWithCleanup<T>>
void SecBlock< T, A >::resize ( size_type  newSize  )  [inline, inherited]

Change size and preserve contents.

Parameters:
newSize the 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 696 of file secblock.h.

Referenced by Integer::DivideByPowerOf2(), InvertibleESIGNFunction::GenerateRandom(), HuffmanEncoder::Initialize(), IntegrityCheckModule(), PK_DefaultDecryptionFilter::Put2(), PK_DefaultEncryptionFilter::Put2(), and DMAC_Base< T >::UncheckedSetKey().

template<class T, class A = AllocatorWithCleanup<T>>
void SecBlock< T, A >::swap ( SecBlock< T, A > &  b  )  [inline, inherited]

Swap contents with another SecBlock.

Parameters:
b the other SecBlock

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

Definition at line 705 of file secblock.h.

Referenced by SecBlock< word32 >::swap(), and Integer::swap().


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

Generated on 24 Mar 2016 for Crypto++ by  doxygen 1.6.1