aboutsummaryrefslogtreecommitdiffstats
path: root/src/der_enc.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2007-11-14 18:08:10 +0000
committerlloyd <[email protected]>2007-11-14 18:08:10 +0000
commit167f765128c4aced6c6a9dcf73f16b933910a798 (patch)
tree12f39b1973090d04d77b3303e5b112e3d78eb748 /src/der_enc.cpp
parent2de4693562db51f6f0e0b2f3a95e3118c40db05d (diff)
Rename MemoryRegion::append to push_back
Change all callers in the library and self-test code.
Diffstat (limited to 'src/der_enc.cpp')
-rw-r--r--src/der_enc.cpp36
1 files changed, 18 insertions, 18 deletions
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);
}