aboutsummaryrefslogtreecommitdiffstats
path: root/src/cert
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-09-15 13:44:42 +0000
committerlloyd <[email protected]>2010-09-15 13:44:42 +0000
commit180c5358cb31e9c003cada3705bb30cf01732878 (patch)
tree951038dfaf2c33bcee5e27c4b1d2980eb35494a3 /src/cert
parenta9d0f37596e5413cae45f32740738c5c68abcce1 (diff)
Update all uses of MemoryRegion::append to use either push_back or operator+=
Diffstat (limited to 'src/cert')
-rw-r--r--src/cert/cvc/asn1_eac_tm.cpp12
-rw-r--r--src/cert/cvc/cvc_ado.cpp6
-rw-r--r--src/cert/cvc/cvc_cert.cpp4
-rw-r--r--src/cert/cvc/cvc_self.cpp8
-rw-r--r--src/cert/cvc/ecdsa_sig.cpp2
-rw-r--r--src/cert/x509/x509_ext.cpp10
6 files changed, 20 insertions, 22 deletions
diff --git a/src/cert/cvc/asn1_eac_tm.cpp b/src/cert/cvc/asn1_eac_tm.cpp
index b048d3aa5..0eaca49d6 100644
--- a/src/cert/cvc/asn1_eac_tm.cpp
+++ b/src/cert/cvc/asn1_eac_tm.cpp
@@ -23,15 +23,15 @@ SecureVector<byte> enc_two_digit(u32bit in)
SecureVector<byte> result;
in %= 100;
if (in < 10)
- result.append(0x00);
+ result.push_back(0x00);
else
{
u32bit y_first_pos = round_down<u32bit>(in, 10) / 10;
- result.append(static_cast<byte>(y_first_pos));
+ result.push_back(static_cast<byte>(y_first_pos));
}
u32bit y_sec_pos = in % 10;
- result.append(static_cast<byte>(y_sec_pos));
+ result.push_back(static_cast<byte>(y_sec_pos));
return result;
}
@@ -300,9 +300,9 @@ u32bit EAC_Time::get_day() const
SecureVector<byte> EAC_Time::encoded_eac_time() const
{
SecureVector<byte> result;
- result.append(enc_two_digit(year));
- result.append(enc_two_digit(month));
- result.append(enc_two_digit(day));
+ result += enc_two_digit(year);
+ result += enc_two_digit(month);
+ result += enc_two_digit(day);
return result;
}
diff --git a/src/cert/cvc/cvc_ado.cpp b/src/cert/cvc/cvc_ado.cpp
index 8c38e90ae..38f51e8dc 100644
--- a/src/cert/cvc/cvc_ado.cpp
+++ b/src/cert/cvc/cvc_ado.cpp
@@ -87,12 +87,8 @@ void EAC1_1_ADO::decode_info(DataSource& source,
.end_cons()
.get_contents();
- SecureVector<byte> enc_car = DER_Encoder()
- .encode(car)
- .get_contents();
-
res_tbs_bits = enc_cert;
- res_tbs_bits.append(enc_car);
+ res_tbs_bits += DER_Encoder().encode(car).get_contents();
res_sig = decode_concatenation(concat_sig);
}
diff --git a/src/cert/cvc/cvc_cert.cpp b/src/cert/cvc/cvc_cert.cpp
index 9cc2bb7e5..536520b37 100644
--- a/src/cert/cvc/cvc_cert.cpp
+++ b/src/cert/cvc/cvc_cert.cpp
@@ -106,10 +106,10 @@ EAC1_1_CVC make_cvc_cert(PK_Signer& signer,
{
OID chat_oid(OIDS::lookup("CertificateHolderAuthorizationTemplate"));
MemoryVector<byte> enc_chat_val;
- enc_chat_val.append(holder_auth_templ);
+ enc_chat_val.push_back(holder_auth_templ);
MemoryVector<byte> enc_cpi;
- enc_cpi.append(0x00);
+ enc_cpi.push_back(0x00);
MemoryVector<byte> tbs = DER_Encoder()
.encode(enc_cpi, OCTET_STRING, ASN1_Tag(41), APPLICATION) // cpi
.encode(car)
diff --git a/src/cert/cvc/cvc_self.cpp b/src/cert/cvc/cvc_self.cpp
index fbd042676..f1d539923 100644
--- a/src/cert/cvc/cvc_self.cpp
+++ b/src/cert/cvc/cvc_self.cpp
@@ -136,7 +136,7 @@ EAC1_1_Req create_cvc_req(Private_Key const& key,
MemoryVector<byte> enc_public_key = eac_1_1_encoding(priv_key, sig_algo.oid);
MemoryVector<byte> enc_cpi;
- enc_cpi.append(0x00);
+ enc_cpi.push_back(0x00);
MemoryVector<byte> tbs = DER_Encoder()
.encode(enc_cpi, OCTET_STRING, ASN1_Tag(41), APPLICATION)
.raw_bytes(enc_public_key)
@@ -166,8 +166,10 @@ EAC1_1_ADO create_ado_req(Private_Key const& key,
std::string padding_and_hash = padding_and_hash_from_oid(req.signature_algorithm().oid);
PK_Signer signer(*priv_key, padding_and_hash);
SecureVector<byte> tbs_bits = req.BER_encode();
- tbs_bits.append(DER_Encoder().encode(car).get_contents());
- MemoryVector<byte> signed_cert = EAC1_1_ADO::make_signed(signer, tbs_bits, rng);
+ tbs_bits += DER_Encoder().encode(car).get_contents();
+
+ MemoryVector<byte> signed_cert =
+ EAC1_1_ADO::make_signed(signer, tbs_bits, rng);
DataSource_Memory source(signed_cert);
return EAC1_1_ADO(source);
diff --git a/src/cert/cvc/ecdsa_sig.cpp b/src/cert/cvc/ecdsa_sig.cpp
index 6a44f6803..dba2ece8d 100644
--- a/src/cert/cvc/ecdsa_sig.cpp
+++ b/src/cert/cvc/ecdsa_sig.cpp
@@ -38,7 +38,7 @@ MemoryVector<byte> ECDSA_Signature::get_concatenation() const
SecureVector<byte> sv_s = BigInt::encode_1363(m_s, enc_len);
SecureVector<byte> result(sv_r);
- result.append(sv_s);
+ result += sv_s;
return result;
}
diff --git a/src/cert/x509/x509_ext.cpp b/src/cert/x509/x509_ext.cpp
index 3e51d1fa2..bb4bc1775 100644
--- a/src/cert/x509/x509_ext.cpp
+++ b/src/cert/x509/x509_ext.cpp
@@ -223,12 +223,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;
}