From 180c5358cb31e9c003cada3705bb30cf01732878 Mon Sep 17 00:00:00 2001 From: lloyd Date: Wed, 15 Sep 2010 13:44:42 +0000 Subject: Update all uses of MemoryRegion::append to use either push_back or operator+= --- src/cert/cvc/asn1_eac_tm.cpp | 12 ++++++------ src/cert/cvc/cvc_ado.cpp | 6 +----- src/cert/cvc/cvc_cert.cpp | 4 ++-- src/cert/cvc/cvc_self.cpp | 8 +++++--- src/cert/cvc/ecdsa_sig.cpp | 2 +- src/cert/x509/x509_ext.cpp | 10 +++++----- 6 files changed, 20 insertions(+), 22 deletions(-) (limited to 'src/cert') 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 enc_two_digit(u32bit in) SecureVector result; in %= 100; if (in < 10) - result.append(0x00); + result.push_back(0x00); else { u32bit y_first_pos = round_down(in, 10) / 10; - result.append(static_cast(y_first_pos)); + result.push_back(static_cast(y_first_pos)); } u32bit y_sec_pos = in % 10; - result.append(static_cast(y_sec_pos)); + result.push_back(static_cast(y_sec_pos)); return result; } @@ -300,9 +300,9 @@ u32bit EAC_Time::get_day() const SecureVector EAC_Time::encoded_eac_time() const { SecureVector 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 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 enc_chat_val; - enc_chat_val.append(holder_auth_templ); + enc_chat_val.push_back(holder_auth_templ); MemoryVector enc_cpi; - enc_cpi.append(0x00); + enc_cpi.push_back(0x00); MemoryVector 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 enc_public_key = eac_1_1_encoding(priv_key, sig_algo.oid); MemoryVector enc_cpi; - enc_cpi.append(0x00); + enc_cpi.push_back(0x00); MemoryVector 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 tbs_bits = req.BER_encode(); - tbs_bits.append(DER_Encoder().encode(car).get_contents()); - MemoryVector signed_cert = EAC1_1_ADO::make_signed(signer, tbs_bits, rng); + tbs_bits += DER_Encoder().encode(car).get_contents(); + + MemoryVector 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 ECDSA_Signature::get_concatenation() const SecureVector sv_s = BigInt::encode_1363(m_s, enc_len); SecureVector 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 Key_Usage::encode_inner() const const u32bit unused_bits = low_bit(constraints) - 1; SecureVector 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; } -- cgit v1.2.3