diff options
author | Jack Lloyd <[email protected]> | 2017-12-19 01:01:46 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-12-19 01:01:46 -0500 |
commit | ac754772afbf7be397f8631ebbb3d2921b0a7753 (patch) | |
tree | 357ec592ba996dea9c3affeb3d63109aeafcd37b /src/lib/asn1/ber_dec.h | |
parent | 395a8ab3b1d38f545e79f4bf169c71037fa6cc18 (diff) |
Fix some other copy+paste code in BER_Decoder
Diffstat (limited to 'src/lib/asn1/ber_dec.h')
-rw-r--r-- | src/lib/asn1/ber_dec.h | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/lib/asn1/ber_dec.h b/src/lib/asn1/ber_dec.h index fbe62e464..637cdc527 100644 --- a/src/lib/asn1/ber_dec.h +++ b/src/lib/asn1/ber_dec.h @@ -66,15 +66,32 @@ class BOTAN_PUBLIC_API(2,0) BER_Decoder final return (*this); } - BER_Decoder& raw_bytes(secure_vector<uint8_t>& v); - BER_Decoder& raw_bytes(std::vector<uint8_t>& v); + /* + * Save all the bytes remaining in the source + */ + template<typename Alloc> + BER_Decoder& raw_bytes(std::vector<uint8_t, Alloc>& out) + { + out.clear(); + uint8_t buf; + while(m_source->read_byte(buf)) + out.push_back(buf); + return (*this); + } BER_Decoder& decode_null(); BER_Decoder& decode(bool& v); BER_Decoder& decode(size_t& v); BER_Decoder& decode(class BigInt& v); - BER_Decoder& decode(std::vector<uint8_t>& v, ASN1_Tag type_tag); - BER_Decoder& decode(secure_vector<uint8_t>& v, ASN1_Tag type_tag); + + /* + * BER decode a BIT STRING or OCTET STRING + */ + template<typename Alloc> + BER_Decoder& decode(std::vector<uint8_t, Alloc>& out, ASN1_Tag real_type) + { + return decode(out, real_type, real_type, UNIVERSAL); + } BER_Decoder& decode(bool& v, ASN1_Tag type_tag, |