aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--checks/dolook2.cpp2
-rw-r--r--include/secmem.h11
-rw-r--r--modules/eng_ossl/ossl_bc.cpp2
-rw-r--r--src/alg_id.cpp4
-rw-r--r--src/asn1_oid.cpp8
-rw-r--r--src/ber_dec.cpp4
-rw-r--r--src/big_code.cpp2
-rw-r--r--src/der_enc.cpp36
-rw-r--r--src/emsa_raw.cpp2
-rw-r--r--src/filter.cpp2
-rw-r--r--src/kdf.cpp2
-rw-r--r--src/pk_filts.cpp4
-rw-r--r--src/prf_x942.cpp2
-rw-r--r--src/pubkey.cpp2
-rw-r--r--src/symkey.cpp2
-rw-r--r--src/x509_ext.cpp10
16 files changed, 48 insertions, 47 deletions
diff --git a/checks/dolook2.cpp b/checks/dolook2.cpp
index b6c9ba339..1cd103c3b 100644
--- a/checks/dolook2.cpp
+++ b/checks/dolook2.cpp
@@ -62,7 +62,7 @@ class KDF_Filter : public Filter
{
public:
void write(const byte in[], u32bit len)
- { secret.append(in, len); }
+ { secret.push_back(in, len); }
void end_msg()
{
SymmetricKey x = kdf->derive_key(outlen,
diff --git a/include/secmem.h b/include/secmem.h
index b50022c83..a38f28a79 100644
--- a/include/secmem.h
+++ b/include/secmem.h
@@ -52,10 +52,11 @@ class MemoryRegion
void set(const T in[], u32bit n) { create(n); copy(in, n); }
void set(const MemoryRegion<T>& in) { set(in.begin(), in.size()); }
- void append(const T data[], u32bit n)
+ void push_back(T x) { push_back(&x, 1); }
+ void push_back(const T data[], u32bit n)
{ grow_to(size()+n); copy(size() - n, data, n); }
- void append(T x) { append(&x, 1); }
- void append(const MemoryRegion<T>& x) { append(x.begin(), x.size()); }
+ void push_back(const MemoryRegion<T>& x)
+ { push_back(x.begin(), x.size()); }
void clear() { clear_mem(buf, allocated); }
void destroy() { create(0); }
@@ -172,7 +173,7 @@ class MemoryVector : public MemoryRegion<T>
MemoryVector(const MemoryRegion<T>& in)
{ MemoryRegion<T>::init(false); set(in); }
MemoryVector(const MemoryRegion<T>& in1, const MemoryRegion<T>& in2)
- { MemoryRegion<T>::init(false); set(in1); append(in2); }
+ { MemoryRegion<T>::init(false); set(in1); push_back(in2); }
};
/*************************************************
@@ -191,7 +192,7 @@ class SecureVector : public MemoryRegion<T>
SecureVector(const MemoryRegion<T>& in)
{ MemoryRegion<T>::init(true); set(in); }
SecureVector(const MemoryRegion<T>& in1, const MemoryRegion<T>& in2)
- { MemoryRegion<T>::init(true); set(in1); append(in2); }
+ { MemoryRegion<T>::init(true); set(in1); push_back(in2); }
};
/*************************************************
diff --git a/modules/eng_ossl/ossl_bc.cpp b/modules/eng_ossl/ossl_bc.cpp
index 0782a9674..91767258c 100644
--- a/modules/eng_ossl/ossl_bc.cpp
+++ b/modules/eng_ossl/ossl_bc.cpp
@@ -113,7 +113,7 @@ void EVP_BlockCipher::key(const byte key[], u32bit length)
SecureVector<byte> full_key(key, length);
if(cipher_name == "TripleDES" && length == 16)
- full_key.append(key, 8);
+ full_key.push_back(key, 8);
else
if(EVP_CIPHER_CTX_set_key_length(&encrypt, length) == 0 ||
EVP_CIPHER_CTX_set_key_length(&decrypt, length) == 0)
diff --git a/src/alg_id.cpp b/src/alg_id.cpp
index d85396295..317329102 100644
--- a/src/alg_id.cpp
+++ b/src/alg_id.cpp
@@ -40,7 +40,7 @@ AlgorithmIdentifier::AlgorithmIdentifier(const OID& alg_id,
oid = alg_id;
if(option == USE_NULL_PARAM)
- parameters.append(DER_NULL, sizeof(DER_NULL));
+ parameters.push_back(DER_NULL, sizeof(DER_NULL));
}
/*************************************************
@@ -53,7 +53,7 @@ AlgorithmIdentifier::AlgorithmIdentifier(const std::string& alg_id,
oid = OIDS::lookup(alg_id);
if(option == USE_NULL_PARAM)
- parameters.append(DER_NULL, sizeof(DER_NULL));
+ parameters.push_back(DER_NULL, sizeof(DER_NULL));
}
/*************************************************
diff --git a/src/asn1_oid.cpp b/src/asn1_oid.cpp
index ad64f4602..875fd7e67 100644
--- a/src/asn1_oid.cpp
+++ b/src/asn1_oid.cpp
@@ -120,20 +120,20 @@ void OID::encode_into(DER_Encoder& der) const
throw Invalid_Argument("OID::encode_into: OID is invalid");
MemoryVector<byte> encoding;
- encoding.append(40 * id[0] + id[1]);
+ encoding.push_back(40 * id[0] + id[1]);
for(u32bit j = 2; j != id.size(); ++j)
{
if(id[j] == 0)
- encoding.append(0);
+ encoding.push_back(0);
else
{
u32bit blocks = high_bit(id[j]) + 6;
blocks = (blocks - (blocks % 7)) / 7;
for(u32bit k = 0; k != blocks - 1; ++k)
- encoding.append(0x80 | ((id[j] >> 7*(blocks-k-1)) & 0x7F));
- encoding.append(id[j] & 0x7F);
+ encoding.push_back(0x80 | ((id[j] >> 7*(blocks-k-1)) & 0x7F));
+ encoding.push_back(id[j] & 0x7F);
}
}
der.add_object(OBJECT_ID, UNIVERSAL, encoding);
diff --git a/src/ber_dec.cpp b/src/ber_dec.cpp
index 2537a917b..afe678f84 100644
--- a/src/ber_dec.cpp
+++ b/src/ber_dec.cpp
@@ -104,7 +104,7 @@ u32bit find_eoc(DataSource* ber)
const u32bit got = ber->peek(buffer, buffer.size(), data.size());
if(got == 0)
break;
- data.append(buffer, got);
+ data.push_back(buffer, got);
}
DataSource_Memory source(data);
@@ -169,7 +169,7 @@ BER_Decoder& BER_Decoder::raw_bytes(MemoryRegion<byte>& out)
out.destroy();
byte buf;
while(source->read_byte(buf))
- out.append(buf);
+ out.push_back(buf);
return (*this);
}
diff --git a/src/big_code.cpp b/src/big_code.cpp
index f56fc53c4..03fa72dbd 100644
--- a/src/big_code.cpp
+++ b/src/big_code.cpp
@@ -104,7 +104,7 @@ BigInt BigInt::decode(const byte buf[], u32bit length, Base base)
SecureVector<byte> hex;
for(u32bit j = 0; j != length; ++j)
if(Hex_Decoder::is_valid(buf[j]))
- hex.append(buf[j]);
+ hex.push_back(buf[j]);
u32bit offset = (hex.size() % 2);
SecureVector<byte> binary(hex.size() / 2 + offset);
diff --git a/src/der_enc.cpp b/src/der_enc.cpp
index e418568bc..5467e78c0 100644
--- a/src/der_enc.cpp
+++ b/src/der_enc.cpp
@@ -26,16 +26,16 @@ SecureVector<byte> encode_tag(ASN1_Tag type_tag, ASN1_Tag class_tag)
SecureVector<byte> encoded_tag;
if(type_tag <= 30)
- encoded_tag.append(static_cast<byte>(type_tag | class_tag));
+ encoded_tag.push_back(static_cast<byte>(type_tag | class_tag));
else
{
u32bit blocks = high_bit(type_tag) + 6;
blocks = (blocks - (blocks % 7)) / 7;
- encoded_tag.append(class_tag | 0x1F);
+ encoded_tag.push_back(class_tag | 0x1F);
for(u32bit k = 0; k != blocks - 1; ++k)
- encoded_tag.append(0x80 | ((type_tag >> 7*(blocks-k-1)) & 0x7F));
- encoded_tag.append(type_tag & 0x7F);
+ encoded_tag.push_back(0x80 | ((type_tag >> 7*(blocks-k-1)) & 0x7F));
+ encoded_tag.push_back(type_tag & 0x7F);
}
return encoded_tag;
@@ -48,13 +48,13 @@ SecureVector<byte> encode_length(u32bit length)
{
SecureVector<byte> encoded_length;
if(length <= 127)
- encoded_length.append(static_cast<byte>(length));
+ encoded_length.push_back(static_cast<byte>(length));
else
{
const u32bit top_byte = significant_bytes(length);
- encoded_length.append(static_cast<byte>(0x80 | top_byte));
+ encoded_length.push_back(static_cast<byte>(0x80 | top_byte));
for(u32bit j = 4-top_byte; j != 4; ++j)
- encoded_length.append(get_byte(j, length));
+ encoded_length.push_back(get_byte(j, length));
}
return encoded_length;
}
@@ -74,16 +74,16 @@ SecureVector<byte> DER_Encoder::DER_Sequence::get_contents()
{
std::sort(set_contents.begin(), set_contents.end());
for(u32bit j = 0; j != set_contents.size(); ++j)
- contents.append(set_contents[j]);
+ contents.push_back(set_contents[j]);
set_contents.clear();
}
SecureVector<byte> encoded_length = encode_length(contents.size());
SecureVector<byte> retval;
- retval.append(encoded_tag);
- retval.append(encoded_length);
- retval.append(contents);
+ retval.push_back(encoded_tag);
+ retval.push_back(encoded_length);
+ retval.push_back(contents);
contents.destroy();
return retval;
}
@@ -96,7 +96,7 @@ void DER_Encoder::DER_Sequence::add_bytes(const byte data[], u32bit length)
if(type_tag == SET)
set_contents.push_back(SecureVector<byte>(data, length));
else
- contents.append(data, length);
+ contents.push_back(data, length);
}
/*************************************************
@@ -190,7 +190,7 @@ DER_Encoder& DER_Encoder::raw_bytes(const byte bytes[], u32bit length)
if(subsequences.size())
subsequences[subsequences.size()-1].add_bytes(bytes, length);
else
- contents.append(bytes, length);
+ contents.push_back(bytes, length);
return (*this);
}
@@ -313,8 +313,8 @@ DER_Encoder& DER_Encoder::encode(const byte bytes[], u32bit length,
if(real_type == BIT_STRING)
{
SecureVector<byte> encoded;
- encoded.append(0);
- encoded.append(bytes, length);
+ encoded.push_back(0);
+ encoded.push_back(bytes, length);
return add_object(type_tag, class_tag, encoded);
}
else
@@ -350,9 +350,9 @@ DER_Encoder& DER_Encoder::add_object(ASN1_Tag type_tag, ASN1_Tag class_tag,
SecureVector<byte> encoded_length = encode_length(length);
SecureVector<byte> buffer;
- buffer.append(encoded_tag);
- buffer.append(encoded_length);
- buffer.append(rep, length);
+ buffer.push_back(encoded_tag);
+ buffer.push_back(encoded_length);
+ buffer.push_back(rep, length);
return raw_bytes(buffer);
}
diff --git a/src/emsa_raw.cpp b/src/emsa_raw.cpp
index 4639d624d..a3a57dbcd 100644
--- a/src/emsa_raw.cpp
+++ b/src/emsa_raw.cpp
@@ -12,7 +12,7 @@ namespace Botan {
*************************************************/
void EMSA_Raw::update(const byte input[], u32bit length)
{
- message.append(input, length);
+ message.push_back(input, length);
}
/*************************************************
diff --git a/src/filter.cpp b/src/filter.cpp
index 385ab28a8..e27501e80 100644
--- a/src/filter.cpp
+++ b/src/filter.cpp
@@ -37,7 +37,7 @@ void Filter::send(const byte input[], u32bit length)
nothing_attached = false;
}
if(nothing_attached)
- write_queue.append(input, length);
+ write_queue.push_back(input, length);
else if(write_queue.has_items())
write_queue.destroy();
}
diff --git a/src/kdf.cpp b/src/kdf.cpp
index 22d8ac7cc..b1b92dfe6 100644
--- a/src/kdf.cpp
+++ b/src/kdf.cpp
@@ -110,7 +110,7 @@ SecureVector<byte> KDF2::derive(u32bit out_len,
SecureVector<byte> hash_result = hash->final();
u32bit added = std::min(hash_result.size(), out_len);
- output.append(hash_result, added);
+ output.push_back(hash_result, added);
out_len -= added;
++counter;
diff --git a/src/pk_filts.cpp b/src/pk_filts.cpp
index 93ccea337..d7d09d9a0 100644
--- a/src/pk_filts.cpp
+++ b/src/pk_filts.cpp
@@ -12,7 +12,7 @@ namespace Botan {
*************************************************/
void PK_Encryptor_Filter::write(const byte input[], u32bit length)
{
- buffer.append(input, length);
+ buffer.push_back(input, length);
}
/*************************************************
@@ -29,7 +29,7 @@ void PK_Encryptor_Filter::end_msg()
*************************************************/
void PK_Decryptor_Filter::write(const byte input[], u32bit length)
{
- buffer.append(input, length);
+ buffer.push_back(input, length);
}
/*************************************************
diff --git a/src/prf_x942.cpp b/src/prf_x942.cpp
index 8ede79efa..18deca46d 100644
--- a/src/prf_x942.cpp
+++ b/src/prf_x942.cpp
@@ -67,7 +67,7 @@ SecureVector<byte> X942_PRF::derive(u32bit key_len,
);
SecureVector<byte> digest = hash->final();
- key.append(digest, std::min(digest.size(), key_len - key.size()));
+ key.push_back(digest, std::min(digest.size(), key_len - key.size()));
++counter;
}
diff --git a/src/pubkey.cpp b/src/pubkey.cpp
index dae6ee936..fd0d099c9 100644
--- a/src/pubkey.cpp
+++ b/src/pubkey.cpp
@@ -305,7 +305,7 @@ bool PK_Verifier::check_signature(const byte sig[], u32bit length)
{
BigInt sig_part;
ber_sig.decode(sig_part);
- real_sig.append(BigInt::encode_1363(sig_part,
+ real_sig.push_back(BigInt::encode_1363(sig_part,
key_message_part_size()));
++count;
}
diff --git a/src/symkey.cpp b/src/symkey.cpp
index b1f0786b0..9ab8c3ed3 100644
--- a/src/symkey.cpp
+++ b/src/symkey.cpp
@@ -29,7 +29,7 @@ void OctetString::change(const std::string& hex_string)
SecureVector<byte> hex;
for(u32bit j = 0; j != hex_string.length(); ++j)
if(Hex_Decoder::is_valid(hex_string[j]))
- hex.append(hex_string[j]);
+ hex.push_back(hex_string[j]);
if(hex.size() % 2 != 0)
throw Invalid_Argument("OctetString: hex string must encode full bytes");
diff --git a/src/x509_ext.cpp b/src/x509_ext.cpp
index 65ea2872c..47e44cc1d 100644
--- a/src/x509_ext.cpp
+++ b/src/x509_ext.cpp
@@ -201,12 +201,12 @@ MemoryVector<byte> Key_Usage::encode_inner() const
const u32bit unused_bits = low_bit(constraints) - 1;
SecureVector<byte> der;
- der.append(BIT_STRING);
- der.append(2 + ((unused_bits < 8) ? 1 : 0));
- der.append(unused_bits % 8);
- der.append((constraints >> 8) & 0xFF);
+ der.push_back(BIT_STRING);
+ der.push_back(2 + ((unused_bits < 8) ? 1 : 0));
+ der.push_back(unused_bits % 8);
+ der.push_back((constraints >> 8) & 0xFF);
if(constraints & 0xFF)
- der.append(constraints & 0xFF);
+ der.push_back(constraints & 0xFF);
return der;
}