Botan
1.10.9
|
#include <secmem.h>
Public Member Functions | |
T * | begin () |
const T * | begin () const |
void | clear () |
void | copy (const T in[], size_t n) |
void | copy (size_t off, const T in[], size_t n) |
bool | empty () const |
T * | end () |
const T * | end () const |
operator const T * () const | |
operator T * () | |
bool | operator!= (const MemoryRegion< T > &other) const |
bool | operator< (const MemoryRegion< T > &other) const |
MemoryRegion< T > & | operator= (const MemoryRegion< T > &other) |
bool | operator== (const MemoryRegion< T > &other) const |
void | push_back (T x) |
void | resize (size_t n) |
size_t | size () const |
void | swap (MemoryRegion< T > &other) |
~MemoryRegion () | |
Protected Member Functions | |
void | init (bool locking, size_t length=0) |
MemoryRegion () | |
MemoryRegion (const MemoryRegion< T > &other) | |
This class represents variable length memory buffers.
|
inline |
|
inlineprotected |
|
inlineprotected |
|
inline |
Get a pointer to the first element in the buffer.
Definition at line 53 of file secmem.h.
Referenced by Botan::Blowfish::clear(), Botan::Bzip_Compression::end_msg(), Botan::Zlib_Compression::end_msg(), Botan::Bzip_Decompression::end_msg(), Botan::Zlib_Decompression::end_msg(), Botan::Bzip_Compression::flush(), Botan::Zlib_Compression::flush(), Botan::rfc3394_keyunwrap(), Botan::rfc3394_keywrap(), Botan::Bzip_Compression::write(), Botan::Zlib_Compression::write(), Botan::Bzip_Decompression::write(), and Botan::Zlib_Decompression::write().
|
inline |
|
inline |
Reset this buffer to an empty buffer with size zero.
Definition at line 152 of file secmem.h.
Referenced by Botan::X509_DN::add_attribute(), Botan::ANSI_X931_RNG::clear(), Botan::BER_Decoder::decode_optional_string(), Botan::PK_Encryptor_Filter::end_msg(), Botan::PK_Decryptor_Filter::end_msg(), Botan::CMS_Encoder::get_contents(), Botan::BER_Decoder::raw_bytes(), and Botan::Filter::send().
|
inline |
Copy the contents of an array of objects of type T into this buffer. The former contents of *this are discarded. The length of *this must be at least n, otherwise memory errors occur.
in | the array to copy the contents from |
n | the length of in |
Definition at line 120 of file secmem.h.
Referenced by Botan::MDx_HashFunction::add_data(), Botan::BigInt::BigInt(), Botan::OctetString::change(), Botan::MemoryRegion< word >::MemoryRegion(), Botan::MemoryVector< byte >::MemoryVector(), Botan::MemoryRegion< word >::operator=(), Botan::MemoryVector< byte >::operator=(), Botan::SecureVector< word >::operator=(), Botan::operator^(), Botan::SecureVector< word >::SecureVector(), Botan::Record_Writer::send(), Botan::CTR_BE::set_iv(), Botan::OFB::set_iv(), Botan::Base64_Encoder::write(), and Botan::Hex_Encoder::write().
|
inline |
Copy the contents of an array of objects of type T into this buffer. The former contents of *this are discarded. The length of *this must be at least n, otherwise memory errors occur.
off | the offset position inside this buffer to start inserting the copied bytes |
in | the array to copy the contents from |
n | the length of in |
Definition at line 134 of file secmem.h.
|
inline |
Find out whether this buffer is empty.
Definition at line 35 of file secmem.h.
Referenced by Botan::BER_Decoder::decode(), Botan::X509_DN::encode_into(), Botan::PK_Verifier_Filter::end_msg(), Botan::X509::load_key(), and Botan::CMS_Encoder::set_data().
|
inline |
|
inline |
|
inlineprotected |
locking | should we use a locking allocator |
length | the initial length to use |
Definition at line 189 of file secmem.h.
Referenced by Botan::MemoryVector< byte >::MemoryVector(), and Botan::SecureVector< word >::SecureVector().
|
inline |
|
inline |
|
inline |
bool Botan::MemoryRegion< T >::operator< | ( | const MemoryRegion< T > & | other | ) | const |
Compare two buffers
Definition at line 233 of file secmem.h.
References Botan::MemoryRegion< T >::size().
|
inline |
|
inline |
|
inline |
Append a single element.
x | the element to append |
Definition at line 143 of file secmem.h.
Referenced by Botan::append_tls_length_value(), Botan::CVC_EAC::create_cvc_req(), Botan::EC2OSP(), Botan::DER_Encoder::encode(), Botan::OID::encode_into(), Botan::make_cvc_cert(), Botan::operator+=(), Botan::BER_Decoder::raw_bytes(), Botan::RTSS_Share::split(), and Botan::HandshakeHash::update().
void Botan::MemoryRegion< T >::resize | ( | size_t | n | ) |
Inserts or erases elements at the end such that the size becomes n, leaving elements in the range 0...n unmodified if set or otherwise zero-initialized
n | length of the new buffer |
Definition at line 211 of file secmem.h.
References Botan::clear_mem(), Botan::copy_mem(), and n.
Referenced by Botan::ANSI_X931_RNG::ANSI_X931_RNG(), Botan::base64_decode(), Botan::BigInt::BigInt(), Botan::BigInt::binary_decode(), Botan::Buffered_Filter::Buffered_Filter(), Botan::CBC_Decryption::CBC_Decryption(), Botan::CBC_Encryption::CBC_Encryption(), Botan::CFB_Decryption::CFB_Decryption(), Botan::CFB_Encryption::CFB_Encryption(), Botan::OctetString::change(), Botan::MemoryRegion< word >::clear(), Botan::CMAC::CMAC(), Botan::CTS_Decryption::CTS_Decryption(), Botan::CTS_Encryption::CTS_Encryption(), Botan::BER_Decoder::decode(), Botan::divide(), Botan::EAX_Decryption::EAX_Decryption(), Botan::ECB_Decryption::ECB_Decryption(), Botan::ECB_Encryption::ECB_Encryption(), Botan::Montgomery_Exponentiator::execute(), Botan::Entropy_Accumulator::get_io_buffer(), Botan::BER_Decoder::get_next_object(), Botan::Record_Reader::get_record(), Botan::BigInt::grow_reg(), Botan::BigInt::grow_to(), Botan::hex_decode(), Botan::Hex_Decoder::Hex_Decoder(), Botan::Hex_Encoder::Hex_Encoder(), Botan::HMAC::HMAC(), Botan::MemoryRegion< word >::init(), Botan::Lion::Lion(), Botan::MemoryRegion< word >::MemoryRegion(), Botan::MemoryVector< byte >::MemoryVector(), Botan::OFB::OFB(), Botan::operator+=(), Botan::MemoryRegion< word >::operator=(), Botan::MemoryVector< byte >::operator=(), Botan::SecureVector< word >::operator=(), Botan::MemoryRegion< word >::push_back(), Botan::Randpool::Randpool(), Botan::Pipe::read_all(), Botan::SAFER_SK::SAFER_SK(), Botan::SecureVector< word >::SecureVector(), Botan::CMS_Encoder::set_data(), Botan::PK_Verifier_Filter::set_signature(), and Botan::SSL3_MAC::SSL3_MAC().
|
inline |
Find out the size of the buffer, i.e. how many objects of type T it contains.
Definition at line 29 of file secmem.h.
Referenced by Botan::Data_Store::add(), Botan::MDx_HashFunction::add_data(), Botan::Randpool::add_entropy(), Botan::DER_Encoder::add_object(), Botan::Alert::Alert(), Botan::append_tls_length_value(), Botan::OctetString::as_string(), Botan::base64_encode(), Botan::BigInt::binary_decode(), Botan::check_passhash9(), Botan::PK_Verifier::check_signature(), Botan::Turing::cipher(), Botan::Salsa20::cipher(), Botan::ARC4::cipher(), Botan::CTR_BE::cipher(), Botan::OFB::cipher(), Botan::WiderWake_41_BE::cipher(), Botan::MD5::compress_n(), Botan::MemoryRegion< word >::copy(), Botan::BER::decode(), Botan::BER_Decoder::decode(), Botan::EME::decode(), Botan::BigInt::decode(), Botan::decode_concatenation(), Botan::OID::decode_from(), Botan::EAC_Time::decode_from(), Botan::AlternativeName::decode_from(), Botan::BER_Decoder::decode_null(), Botan::BER_Decoder::decode_octet_string_bigint(), Botan::CryptoBox::decrypt(), Botan::PK_Decryptor::decrypt(), Botan::RC5::decrypt_n(), Botan::X942_PRF::derive(), Botan::KDF2::derive(), Botan::KDF::derive_key(), Botan::OpenPGP_S2K::derive_key(), Botan::PKCS5_PBKDF1::derive_key(), Botan::PK_Key_Agreement::derive_key(), Botan::PEM_Code::encode(), Botan::DER_Encoder::encode(), Botan::EME::encode(), Botan::EMSA3::encoding_of(), Botan::CryptoBox::encrypt(), Botan::PK_Encryptor::encrypt(), Botan::RC5::encrypt_n(), Botan::MemoryRegion< word >::end(), Botan::Zlib_Compression::end_msg(), Botan::Bzip_Compression::end_msg(), Botan::Bzip_Decompression::end_msg(), Botan::Zlib_Decompression::end_msg(), Botan::Hash_Filter::end_msg(), Botan::MAC_Filter::end_msg(), Botan::DataSource_Memory::end_of_data(), Botan::Montgomery_Exponentiator::execute(), Botan::MDx_HashFunction::final_result(), Botan::Certificate_Store_Memory::find_cert_by_subject_and_key_id(), Botan::Certificate_Store_Memory::find_crl_by_subject_and_key_id(), Botan::Bzip_Compression::flush(), Botan::Zlib_Compression::flush(), Botan::generate_dsa_primes(), Botan::generate_passhash9(), Botan::CMS_Decoder::get_data(), Botan::Record_Reader::get_record(), Botan::GOST_3410_PublicKey::GOST_3410_PublicKey(), Botan::Hex_Decoder::Hex_Decoder(), Botan::hex_encode(), Botan::Hex_Encoder::Hex_Encoder(), Botan::ANSI_X931_RNG::is_seeded(), Botan::MGF1::mask(), Botan::PEM_Code::matches(), Botan::EME1::maximum_input_size(), Botan::MemoryRegion< word >::MemoryRegion(), Botan::MemoryVector< byte >::MemoryVector(), Botan::BigInt::operator*=(), Botan::BigInt::operator+=(), Botan::operator+=(), Botan::MemoryRegion< T >::operator<(), Botan::operator<<(), Botan::MemoryRegion< word >::operator=(), Botan::MemoryVector< byte >::operator=(), Botan::SecureVector< word >::operator=(), Botan::MemoryRegion< word >::operator==(), Botan::operator>>(), Botan::OS2ECP(), Botan::OSSL_BN::OSSL_BN(), Botan::DataSource_Memory::peek(), Botan::DataSource_Stream::peek(), Botan::FTW_EntropySource::poll(), Botan::Win32_CAPI_EntropySource::poll(), Botan::Device_EntropySource::poll(), Botan::Unix_EntropySource::poll(), Botan::CMAC::poly_double(), Botan::Client_Key_Exchange::pre_master_secret(), Botan::Buffered_Computation::process(), Botan::Pipe::process_msg(), Botan::MemoryRegion< word >::push_back(), Botan::random_prime(), Botan::RandomNumberGenerator::random_vec(), Botan::ANSI_X931_RNG::randomize(), Botan::Randpool::randomize(), Botan::BigInt::randomize(), Botan::DER_Encoder::raw_bytes(), Botan::DataSource_Memory::read(), Botan::Pipe::read_all(), Botan::Pipe::read_all_as_string(), Botan::TLS_Data_Reader::remaining_bytes(), Botan::Randpool::reseed(), Botan::rfc3394_keyunwrap(), Botan::rfc3394_keywrap(), Botan::SecureVector< word >::SecureVector(), Botan::HandshakeMessage::send(), Botan::Record_Writer::send(), Botan::Filter::send(), Botan::Montgomery_Exponentiator::set_base(), Botan::Turing::set_iv(), Botan::EAX_Base::set_iv(), Botan::WiderWake_41_BE::set_iv(), Botan::OctetString::set_odd_parity(), Botan::CMS_Encoder::sign(), Botan::PK_Signer::sign_message(), Botan::PK_Signer::signature(), Botan::RTSS_Share::split(), Botan::BER_Decoder::start_cons(), Botan::ASN1::to_string(), Botan::RTSS_Share::to_string(), Botan::Buffered_Computation::update(), Botan::PK_Signer::update(), Botan::PK_Verifier::update(), Botan::EMSA3::verify(), Botan::MessageAuthenticationCode::verify_mac(), Botan::PK_Verifier::verify_message(), Botan::Bzip_Compression::write(), Botan::Zlib_Compression::write(), Botan::Base64_Encoder::write(), Botan::Buffered_Filter::write(), Botan::Hex_Encoder::write(), Botan::StreamCipher_Filter::write(), Botan::Bzip_Decompression::write(), Botan::Zlib_Decompression::write(), Botan::Hex_Decoder::write(), Botan::Base64_Decoder::write(), Botan::Pipe::write(), and Botan::zeroise().
void Botan::MemoryRegion< T >::swap | ( | MemoryRegion< T > & | other | ) |
Swap this buffer with another object.
Definition at line 254 of file secmem.h.
References alloc, and std::swap().
Referenced by Botan::PointGFp::swap(), std::swap(), and Botan::BigInt::swap().