diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/alloc/secmem.h | 2 | ||||
-rw-r--r-- | src/asn1/asn1_dn.cpp | 2 | ||||
-rw-r--r-- | src/asn1/ber_dec.cpp | 6 | ||||
-rw-r--r-- | src/asn1/der_enc.cpp | 9 | ||||
-rw-r--r-- | src/cms/cms_algo.cpp | 2 | ||||
-rw-r--r-- | src/cms/cms_enc.cpp | 2 | ||||
-rw-r--r-- | src/filters/filter.cpp | 2 | ||||
-rw-r--r-- | src/filters/pk_filts/pk_filts.cpp | 4 | ||||
-rw-r--r-- | src/pk_pad/emsa_raw/emsa_raw.cpp | 6 | ||||
-rw-r--r-- | src/rng/x931_rng/x931_rng.cpp | 2 | ||||
-rw-r--r-- | src/ssl/tls_session_key.cpp | 4 |
11 files changed, 20 insertions, 21 deletions
diff --git a/src/alloc/secmem.h b/src/alloc/secmem.h index 37930b963..117b8754f 100644 --- a/src/alloc/secmem.h +++ b/src/alloc/secmem.h @@ -149,7 +149,7 @@ class MemoryRegion /** * Reset this buffer to an empty buffer with size zero. */ - void destroy() { resize(0); } + void clear() { resize(0); } /** * Inserts or erases elements at the end such that the size diff --git a/src/asn1/asn1_dn.cpp b/src/asn1/asn1_dn.cpp index 6b08fa1ff..1de8b8c7f 100644 --- a/src/asn1/asn1_dn.cpp +++ b/src/asn1/asn1_dn.cpp @@ -67,7 +67,7 @@ void X509_DN::add_attribute(const OID& oid, const std::string& str) return; multimap_insert(dn_info, oid, ASN1_String(str)); - dn_bits.destroy(); + dn_bits.clear(); } /* diff --git a/src/asn1/ber_dec.cpp b/src/asn1/ber_dec.cpp index 1c0d218ca..1bbcd72c2 100644 --- a/src/asn1/ber_dec.cpp +++ b/src/asn1/ber_dec.cpp @@ -110,7 +110,7 @@ u32bit find_eoc(DataSource* ber) } DataSource_Memory source(data); - data.destroy(); + data.clear(); u32bit length = 0; while(true) @@ -168,7 +168,7 @@ BER_Decoder& BER_Decoder::verify_end() */ BER_Decoder& BER_Decoder::raw_bytes(MemoryRegion<byte>& out) { - out.destroy(); + out.clear(); byte buf; while(source->read_byte(buf)) out.append(buf); @@ -469,7 +469,7 @@ BER_Decoder& BER_Decoder::decode_optional_string(MemoryRegion<byte>& out, ASN1_Tag type_tag = static_cast<ASN1_Tag>(type_no); - out.destroy(); + out.clear(); push_back(obj); if(obj.type_tag == type_tag && obj.class_tag == CONTEXT_SPECIFIC) diff --git a/src/asn1/der_enc.cpp b/src/asn1/der_enc.cpp index e410292bb..dd173590f 100644 --- a/src/asn1/der_enc.cpp +++ b/src/asn1/der_enc.cpp @@ -86,7 +86,7 @@ SecureVector<byte> DER_Encoder::DER_Sequence::get_contents() retval.append(encoded_tag); retval.append(encoded_length); retval.append(contents); - contents.destroy(); + contents.clear(); return retval; } @@ -125,10 +125,9 @@ SecureVector<byte> DER_Encoder::get_contents() if(subsequences.size() != 0) throw Invalid_State("DER_Encoder: Sequence hasn't been marked done"); - SecureVector<byte> retval; - retval = contents; - contents.destroy(); - return retval; + SecureVector<byte> output; + std::swap(output, contents); + return output; } /* diff --git a/src/cms/cms_algo.cpp b/src/cms/cms_algo.cpp index 686a79b4e..8c6806699 100644 --- a/src/cms/cms_algo.cpp +++ b/src/cms/cms_algo.cpp @@ -41,7 +41,7 @@ SecureVector<byte> do_rfc3217_wrap(RandomNumberGenerator& rng, { for(u32bit j = 0; j != buf.size(); j++) send(buf[buf.size()-j-1]); - buf.destroy(); + buf.clear(); } Flip_Bytes(const SecureVector<byte>& prefix) { buf.append(prefix); } private: diff --git a/src/cms/cms_enc.cpp b/src/cms/cms_enc.cpp index ebb89df60..3437c15e3 100644 --- a/src/cms/cms_enc.cpp +++ b/src/cms/cms_enc.cpp @@ -46,7 +46,7 @@ SecureVector<byte> CMS_Encoder::get_contents() end_explicit(). end_cons(); - data.destroy(); + data.clear(); return encoder.get_contents(); } diff --git a/src/filters/filter.cpp b/src/filters/filter.cpp index ff223ae8c..d722c1f67 100644 --- a/src/filters/filter.cpp +++ b/src/filters/filter.cpp @@ -40,7 +40,7 @@ void Filter::send(const byte input[], u32bit length) if(nothing_attached) write_queue.append(input, length); else - write_queue.destroy(); + write_queue.clear(); } /* diff --git a/src/filters/pk_filts/pk_filts.cpp b/src/filters/pk_filts/pk_filts.cpp index 05b45227f..1b800520e 100644 --- a/src/filters/pk_filts/pk_filts.cpp +++ b/src/filters/pk_filts/pk_filts.cpp @@ -23,7 +23,7 @@ void PK_Encryptor_Filter::write(const byte input[], u32bit length) void PK_Encryptor_Filter::end_msg() { send(cipher->encrypt(buffer, buffer.size(), rng)); - buffer.destroy(); + buffer.clear(); } /* @@ -40,7 +40,7 @@ void PK_Decryptor_Filter::write(const byte input[], u32bit length) void PK_Decryptor_Filter::end_msg() { send(cipher->decrypt(buffer, buffer.size())); - buffer.destroy(); + buffer.clear(); } /* diff --git a/src/pk_pad/emsa_raw/emsa_raw.cpp b/src/pk_pad/emsa_raw/emsa_raw.cpp index 734dc3698..696c6bc5c 100644 --- a/src/pk_pad/emsa_raw/emsa_raw.cpp +++ b/src/pk_pad/emsa_raw/emsa_raw.cpp @@ -22,9 +22,9 @@ void EMSA_Raw::update(const byte input[], u32bit length) */ SecureVector<byte> EMSA_Raw::raw_data() { - SecureVector<byte> buf = message; - message.destroy(); - return buf; + SecureVector<byte> output; + std::swap(message, output); + return output; } /* diff --git a/src/rng/x931_rng/x931_rng.cpp b/src/rng/x931_rng/x931_rng.cpp index 4a06fca39..f92f5ae99 100644 --- a/src/rng/x931_rng/x931_rng.cpp +++ b/src/rng/x931_rng/x931_rng.cpp @@ -113,7 +113,7 @@ void ANSI_X931_RNG::clear() cipher->clear(); prng->clear(); zeroise(R); - V.destroy(); + V.clear(); position = 0; } diff --git a/src/ssl/tls_session_key.cpp b/src/ssl/tls_session_key.cpp index 594b99e19..138d0a77c 100644 --- a/src/ssl/tls_session_key.cpp +++ b/src/ssl/tls_session_key.cpp @@ -84,7 +84,7 @@ SymmetricKey SessionKeys::ssl3_keygen(u32bit prf_gen, master_sec = prf.derive_key(48, pre_master, salt); - salt.destroy(); + salt.clear(); salt.append(server_random); salt.append(client_random); @@ -115,7 +115,7 @@ SymmetricKey SessionKeys::tls1_keygen(u32bit prf_gen, master_sec = prf.derive_key(48, pre_master, salt); - salt.destroy(); + salt.clear(); salt.append(KEY_GEN_MAGIC, sizeof(KEY_GEN_MAGIC)); salt.append(server_random); salt.append(client_random); |