From f3cb3edb512bdcab498d825886c3366c341b3f78 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Sun, 11 Dec 2016 15:28:38 -0500 Subject: Convert to using standard uintN_t integer types Renames a couple of functions for somewhat better name consistency, eg make_u32bit becomes make_uint32. The old typedefs remain for now since probably lots of application code uses them. --- src/lib/x509/x509_ext.cpp | 66 +++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'src/lib/x509/x509_ext.cpp') diff --git a/src/lib/x509/x509_ext.cpp b/src/lib/x509/x509_ext.cpp index 9ef14e88d..199ca6bcc 100644 --- a/src/lib/x509/x509_ext.cpp +++ b/src/lib/x509/x509_ext.cpp @@ -146,7 +146,7 @@ std::vector, bool>> Extensions: return exts; } -std::map, bool>> Extensions::extensions_raw() const +std::map, bool>> Extensions::extensions_raw() const { return m_extensions_raw; } @@ -212,7 +212,7 @@ void Extensions::decode_from(BER_Decoder& from_source) while(sequence.more_items()) { OID oid; - std::vector value; + std::vector value; bool critical; sequence.start_cons(SEQUENCE) @@ -278,7 +278,7 @@ size_t Basic_Constraints::get_path_limit() const /* * Encode the extension */ -std::vector Basic_Constraints::encode_inner() const +std::vector Basic_Constraints::encode_inner() const { return DER_Encoder() .start_cons(SEQUENCE) @@ -294,7 +294,7 @@ std::vector Basic_Constraints::encode_inner() const /* * Decode the extension */ -void Basic_Constraints::decode_inner(const std::vector& in) +void Basic_Constraints::decode_inner(const std::vector& in) { BER_Decoder(in) .start_cons(SEQUENCE) @@ -313,20 +313,20 @@ void Basic_Constraints::decode_inner(const std::vector& in) void Basic_Constraints::contents_to(Data_Store& subject, Data_Store&) const { subject.add("X509v3.BasicConstraints.is_ca", (m_is_ca ? 1 : 0)); - subject.add("X509v3.BasicConstraints.path_constraint", static_cast(m_path_limit)); + subject.add("X509v3.BasicConstraints.path_constraint", static_cast(m_path_limit)); } /* * Encode the extension */ -std::vector Key_Usage::encode_inner() const +std::vector Key_Usage::encode_inner() const { if(m_constraints == NO_CONSTRAINTS) throw Encoding_Error("Cannot encode zero usage constraints"); const size_t unused_bits = low_bit(m_constraints) - 1; - std::vector der; + std::vector der; der.push_back(BIT_STRING); der.push_back(2 + ((unused_bits < 8) ? 1 : 0)); der.push_back(unused_bits % 8); @@ -340,7 +340,7 @@ std::vector Key_Usage::encode_inner() const /* * Decode the extension */ -void Key_Usage::decode_inner(const std::vector& in) +void Key_Usage::decode_inner(const std::vector& in) { BER_Decoder ber(in); @@ -358,7 +358,7 @@ void Key_Usage::decode_inner(const std::vector& in) obj.value[obj.value.size()-1] &= (0xFF << obj.value[0]); - u16bit usage = 0; + uint16_t usage = 0; for(size_t i = 1; i != obj.value.size(); ++i) { usage = (obj.value[i] << 8*(sizeof(usage)-i)) | usage; @@ -378,7 +378,7 @@ void Key_Usage::contents_to(Data_Store& subject, Data_Store&) const /* * Encode the extension */ -std::vector Subject_Key_ID::encode_inner() const +std::vector Subject_Key_ID::encode_inner() const { return DER_Encoder().encode(m_key_id, OCTET_STRING).get_contents_unlocked(); } @@ -386,7 +386,7 @@ std::vector Subject_Key_ID::encode_inner() const /* * Decode the extension */ -void Subject_Key_ID::decode_inner(const std::vector& in) +void Subject_Key_ID::decode_inner(const std::vector& in) { BER_Decoder(in).decode(m_key_id, OCTET_STRING).verify_end(); } @@ -402,13 +402,13 @@ void Subject_Key_ID::contents_to(Data_Store& subject, Data_Store&) const /* * Subject_Key_ID Constructor */ -Subject_Key_ID::Subject_Key_ID(const std::vector& pub_key) : m_key_id(unlock(SHA_160().process(pub_key))) +Subject_Key_ID::Subject_Key_ID(const std::vector& pub_key) : m_key_id(unlock(SHA_160().process(pub_key))) {} /* * Encode the extension */ -std::vector Authority_Key_ID::encode_inner() const +std::vector Authority_Key_ID::encode_inner() const { return DER_Encoder() .start_cons(SEQUENCE) @@ -420,7 +420,7 @@ std::vector Authority_Key_ID::encode_inner() const /* * Decode the extension */ -void Authority_Key_ID::decode_inner(const std::vector& in) +void Authority_Key_ID::decode_inner(const std::vector& in) { BER_Decoder(in) .start_cons(SEQUENCE) @@ -439,7 +439,7 @@ void Authority_Key_ID::contents_to(Data_Store&, Data_Store& issuer) const /* * Encode the extension */ -std::vector Alternative_Name::encode_inner() const +std::vector Alternative_Name::encode_inner() const { return DER_Encoder().encode(m_alt_name).get_contents_unlocked(); } @@ -447,7 +447,7 @@ std::vector Alternative_Name::encode_inner() const /* * Decode the extension */ -void Alternative_Name::decode_inner(const std::vector& in) +void Alternative_Name::decode_inner(const std::vector& in) { BER_Decoder(in).decode(m_alt_name); } @@ -499,7 +499,7 @@ Issuer_Alternative_Name::Issuer_Alternative_Name(const AlternativeName& name) : /* * Encode the extension */ -std::vector Extended_Key_Usage::encode_inner() const +std::vector Extended_Key_Usage::encode_inner() const { return DER_Encoder() .start_cons(SEQUENCE) @@ -511,7 +511,7 @@ std::vector Extended_Key_Usage::encode_inner() const /* * Decode the extension */ -void Extended_Key_Usage::decode_inner(const std::vector& in) +void Extended_Key_Usage::decode_inner(const std::vector& in) { BER_Decoder(in).decode_list(m_oids); } @@ -528,7 +528,7 @@ void Extended_Key_Usage::contents_to(Data_Store& subject, Data_Store&) const /* * Encode the extension */ -std::vector Name_Constraints::encode_inner() const +std::vector Name_Constraints::encode_inner() const { throw Not_Implemented("Name_Constraints encoding"); } @@ -537,7 +537,7 @@ std::vector Name_Constraints::encode_inner() const /* * Decode the extension */ -void Name_Constraints::decode_inner(const std::vector& in) +void Name_Constraints::decode_inner(const std::vector& in) { std::vector permit, exclude; BER_Decoder ber(in); @@ -689,7 +689,7 @@ class Policy_Information : public ASN1_Object /* * Encode the extension */ -std::vector Certificate_Policies::encode_inner() const +std::vector Certificate_Policies::encode_inner() const { std::vector policies; @@ -706,7 +706,7 @@ std::vector Certificate_Policies::encode_inner() const /* * Decode the extension */ -void Certificate_Policies::decode_inner(const std::vector& in) +void Certificate_Policies::decode_inner(const std::vector& in) { std::vector policies; @@ -726,7 +726,7 @@ void Certificate_Policies::contents_to(Data_Store& info, Data_Store&) const info.add("X509v3.CertificatePolicies", m_oids[i].as_string()); } -std::vector Authority_Information_Access::encode_inner() const +std::vector Authority_Information_Access::encode_inner() const { ASN1_String url(m_ocsp_responder, IA5_STRING); @@ -739,7 +739,7 @@ std::vector Authority_Information_Access::encode_inner() const .end_cons().get_contents_unlocked(); } -void Authority_Information_Access::decode_inner(const std::vector& in) +void Authority_Information_Access::decode_inner(const std::vector& in) { BER_Decoder ber = BER_Decoder(in).start_cons(SEQUENCE); @@ -795,7 +795,7 @@ CRL_Number* CRL_Number::copy() const /* * Encode the extension */ -std::vector CRL_Number::encode_inner() const +std::vector CRL_Number::encode_inner() const { return DER_Encoder().encode(m_crl_number).get_contents_unlocked(); } @@ -803,7 +803,7 @@ std::vector CRL_Number::encode_inner() const /* * Decode the extension */ -void CRL_Number::decode_inner(const std::vector& in) +void CRL_Number::decode_inner(const std::vector& in) { BER_Decoder(in).decode(m_crl_number); } @@ -813,13 +813,13 @@ void CRL_Number::decode_inner(const std::vector& in) */ void CRL_Number::contents_to(Data_Store& info, Data_Store&) const { - info.add("X509v3.CRLNumber", static_cast(m_crl_number)); + info.add("X509v3.CRLNumber", static_cast(m_crl_number)); } /* * Encode the extension */ -std::vector CRL_ReasonCode::encode_inner() const +std::vector CRL_ReasonCode::encode_inner() const { return DER_Encoder() .encode(static_cast(m_reason), ENUMERATED, UNIVERSAL) @@ -829,7 +829,7 @@ std::vector CRL_ReasonCode::encode_inner() const /* * Decode the extension */ -void CRL_ReasonCode::decode_inner(const std::vector& in) +void CRL_ReasonCode::decode_inner(const std::vector& in) { size_t reason_code = 0; BER_Decoder(in).decode(reason_code, ENUMERATED, UNIVERSAL); @@ -844,12 +844,12 @@ void CRL_ReasonCode::contents_to(Data_Store& info, Data_Store&) const info.add("X509v3.CRLReasonCode", m_reason); } -std::vector CRL_Distribution_Points::encode_inner() const +std::vector CRL_Distribution_Points::encode_inner() const { throw Not_Implemented("CRL_Distribution_Points encoding"); } -void CRL_Distribution_Points::decode_inner(const std::vector& buf) +void CRL_Distribution_Points::decode_inner(const std::vector& buf) { BER_Decoder(buf).decode_list(m_distribution_points).verify_end(); } @@ -882,12 +882,12 @@ void CRL_Distribution_Points::Distribution_Point::decode_from(class BER_Decoder& .end_cons().end_cons(); } -std::vector Unknown_Critical_Extension::encode_inner() const +std::vector Unknown_Critical_Extension::encode_inner() const { throw Not_Implemented("Unknown_Critical_Extension encoding"); } -void Unknown_Critical_Extension::decode_inner(const std::vector&) +void Unknown_Critical_Extension::decode_inner(const std::vector&) { } -- cgit v1.2.3