diff options
author | René Korthaus <[email protected]> | 2016-01-11 14:25:13 +0100 |
---|---|---|
committer | René Korthaus <[email protected]> | 2016-01-11 14:25:13 +0100 |
commit | 643c57b7593f8106d9142e20fcb8dcf7e8160f94 (patch) | |
tree | 9898499f290b7bb717d621eff14f7b21dfd17468 /src/lib | |
parent | 672d29570e55686b90126b5d6f5d337ddf0b8f04 (diff) |
Prefix more member vars with m_ prefix
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/base/key_spec.h | 32 | ||||
-rw-r--r-- | src/lib/cert/x509/x509_ext.cpp | 92 | ||||
-rw-r--r-- | src/lib/cert/x509/x509_ext.h | 78 | ||||
-rw-r--r-- | src/lib/pubkey/rsa/rsa.cpp | 16 |
4 files changed, 109 insertions, 109 deletions
diff --git a/src/lib/base/key_spec.h b/src/lib/base/key_spec.h index 78b6b8a23..f9cdcc78d 100644 --- a/src/lib/base/key_spec.h +++ b/src/lib/base/key_spec.h @@ -23,9 +23,9 @@ class BOTAN_DLL Key_Length_Specification * @param keylen the supported key length */ Key_Length_Specification(size_t keylen) : - min_keylen(keylen), - max_keylen(keylen), - keylen_mod(1) + m_min_keylen(keylen), + m_max_keylen(keylen), + m_keylen_mod(1) { } @@ -38,9 +38,9 @@ class BOTAN_DLL Key_Length_Specification Key_Length_Specification(size_t min_k, size_t max_k, size_t k_mod = 1) : - min_keylen(min_k), - max_keylen(max_k ? max_k : min_k), - keylen_mod(k_mod) + m_min_keylen(min_k), + m_max_keylen(max_k ? max_k : min_k), + m_keylen_mod(k_mod) { } @@ -50,9 +50,9 @@ class BOTAN_DLL Key_Length_Specification */ bool valid_keylength(size_t length) const { - return ((length >= min_keylen) && - (length <= max_keylen) && - (length % keylen_mod == 0)); + return ((length >= m_min_keylen) && + (length <= m_max_keylen) && + (length % m_keylen_mod == 0)); } /** @@ -60,7 +60,7 @@ class BOTAN_DLL Key_Length_Specification */ size_t minimum_keylength() const { - return min_keylen; + return m_min_keylen; } /** @@ -68,7 +68,7 @@ class BOTAN_DLL Key_Length_Specification */ size_t maximum_keylength() const { - return max_keylen; + return m_max_keylen; } /** @@ -76,18 +76,18 @@ class BOTAN_DLL Key_Length_Specification */ size_t keylength_multiple() const { - return keylen_mod; + return m_keylen_mod; } Key_Length_Specification multiple(size_t n) const { - return Key_Length_Specification(n * min_keylen, - n * max_keylen, - n * keylen_mod); + return Key_Length_Specification(n * m_min_keylen, + n * m_max_keylen, + n * m_keylen_mod); } private: - size_t min_keylen, max_keylen, keylen_mod; + size_t m_min_keylen, m_max_keylen, m_keylen_mod; }; } diff --git a/src/lib/cert/x509/x509_ext.cpp b/src/lib/cert/x509/x509_ext.cpp index 78c75f271..5e5b60677 100644 --- a/src/lib/cert/x509/x509_ext.cpp +++ b/src/lib/cert/x509/x509_ext.cpp @@ -179,9 +179,9 @@ namespace Cert_Extension { */ size_t Basic_Constraints::get_path_limit() const { - if(!is_ca) + if(!m_is_ca) throw Invalid_State("Basic_Constraints::get_path_limit: Not a CA"); - return path_limit; + return m_path_limit; } /* @@ -191,10 +191,10 @@ std::vector<byte> Basic_Constraints::encode_inner() const { return DER_Encoder() .start_cons(SEQUENCE) - .encode_if(is_ca, + .encode_if(m_is_ca, DER_Encoder() - .encode(is_ca) - .encode_optional(path_limit, NO_CERT_PATH_LIMIT) + .encode(m_is_ca) + .encode_optional(m_path_limit, NO_CERT_PATH_LIMIT) ) .end_cons() .get_contents_unlocked(); @@ -207,13 +207,13 @@ void Basic_Constraints::decode_inner(const std::vector<byte>& in) { BER_Decoder(in) .start_cons(SEQUENCE) - .decode_optional(is_ca, BOOLEAN, UNIVERSAL, false) - .decode_optional(path_limit, INTEGER, UNIVERSAL, NO_CERT_PATH_LIMIT) + .decode_optional(m_is_ca, BOOLEAN, UNIVERSAL, false) + .decode_optional(m_path_limit, INTEGER, UNIVERSAL, NO_CERT_PATH_LIMIT) .verify_end() .end_cons(); - if(is_ca == false) - path_limit = 0; + if(m_is_ca == false) + m_path_limit = 0; } /* @@ -221,8 +221,8 @@ void Basic_Constraints::decode_inner(const std::vector<byte>& in) */ void Basic_Constraints::contents_to(Data_Store& subject, Data_Store&) const { - subject.add("X509v3.BasicConstraints.is_ca", (is_ca ? 1 : 0)); - subject.add("X509v3.BasicConstraints.path_constraint", path_limit); + subject.add("X509v3.BasicConstraints.is_ca", (m_is_ca ? 1 : 0)); + subject.add("X509v3.BasicConstraints.path_constraint", m_path_limit); } /* @@ -230,18 +230,18 @@ void Basic_Constraints::contents_to(Data_Store& subject, Data_Store&) const */ std::vector<byte> Key_Usage::encode_inner() const { - if(constraints == NO_CONSTRAINTS) + if(m_constraints == NO_CONSTRAINTS) throw Encoding_Error("Cannot encode zero usage constraints"); - const size_t unused_bits = low_bit(constraints) - 1; + const size_t unused_bits = low_bit(m_constraints) - 1; std::vector<byte> der; 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.push_back(constraints & 0xFF); + der.push_back((m_constraints >> 8) & 0xFF); + if(m_constraints & 0xFF) + der.push_back(m_constraints & 0xFF); return der; } @@ -271,7 +271,7 @@ void Key_Usage::decode_inner(const std::vector<byte>& in) for(size_t i = 1; i != obj.value.size(); ++i) usage = (obj.value[i] << 8) | usage; - constraints = Key_Constraints(usage); + m_constraints = Key_Constraints(usage); } /* @@ -279,7 +279,7 @@ void Key_Usage::decode_inner(const std::vector<byte>& in) */ void Key_Usage::contents_to(Data_Store& subject, Data_Store&) const { - subject.add("X509v3.KeyUsage", constraints); + subject.add("X509v3.KeyUsage", m_constraints); } /* @@ -287,7 +287,7 @@ void Key_Usage::contents_to(Data_Store& subject, Data_Store&) const */ std::vector<byte> Subject_Key_ID::encode_inner() const { - return DER_Encoder().encode(key_id, OCTET_STRING).get_contents_unlocked(); + return DER_Encoder().encode(m_key_id, OCTET_STRING).get_contents_unlocked(); } /* @@ -295,7 +295,7 @@ std::vector<byte> Subject_Key_ID::encode_inner() const */ void Subject_Key_ID::decode_inner(const std::vector<byte>& in) { - BER_Decoder(in).decode(key_id, OCTET_STRING).verify_end(); + BER_Decoder(in).decode(m_key_id, OCTET_STRING).verify_end(); } /* @@ -303,7 +303,7 @@ void Subject_Key_ID::decode_inner(const std::vector<byte>& in) */ void Subject_Key_ID::contents_to(Data_Store& subject, Data_Store&) const { - subject.add("X509v3.SubjectKeyIdentifier", key_id); + subject.add("X509v3.SubjectKeyIdentifier", m_key_id); } /* @@ -312,7 +312,7 @@ void Subject_Key_ID::contents_to(Data_Store& subject, Data_Store&) const Subject_Key_ID::Subject_Key_ID(const std::vector<byte>& pub_key) { SHA_160 hash; - key_id = unlock(hash.process(pub_key)); + m_key_id = unlock(hash.process(pub_key)); } /* @@ -322,7 +322,7 @@ std::vector<byte> Authority_Key_ID::encode_inner() const { return DER_Encoder() .start_cons(SEQUENCE) - .encode(key_id, OCTET_STRING, ASN1_Tag(0), CONTEXT_SPECIFIC) + .encode(m_key_id, OCTET_STRING, ASN1_Tag(0), CONTEXT_SPECIFIC) .end_cons() .get_contents_unlocked(); } @@ -334,7 +334,7 @@ void Authority_Key_ID::decode_inner(const std::vector<byte>& in) { BER_Decoder(in) .start_cons(SEQUENCE) - .decode_optional_string(key_id, OCTET_STRING, 0); + .decode_optional_string(m_key_id, OCTET_STRING, 0); } /* @@ -342,8 +342,8 @@ void Authority_Key_ID::decode_inner(const std::vector<byte>& in) */ void Authority_Key_ID::contents_to(Data_Store&, Data_Store& issuer) const { - if(key_id.size()) - issuer.add("X509v3.AuthorityKeyIdentifier", key_id); + if(m_key_id.size()) + issuer.add("X509v3.AuthorityKeyIdentifier", m_key_id); } /* @@ -414,7 +414,7 @@ std::vector<byte> Extended_Key_Usage::encode_inner() const { return DER_Encoder() .start_cons(SEQUENCE) - .encode_list(oids) + .encode_list(m_oids) .end_cons() .get_contents_unlocked(); } @@ -424,7 +424,7 @@ std::vector<byte> Extended_Key_Usage::encode_inner() const */ void Extended_Key_Usage::decode_inner(const std::vector<byte>& in) { - BER_Decoder(in).decode_list(oids); + BER_Decoder(in).decode_list(m_oids); } /* @@ -432,8 +432,8 @@ void Extended_Key_Usage::decode_inner(const std::vector<byte>& in) */ void Extended_Key_Usage::contents_to(Data_Store& subject, Data_Store&) const { - for(size_t i = 0; i != oids.size(); ++i) - subject.add("X509v3.ExtendedKeyUsage", oids[i].as_string()); + for(size_t i = 0; i != m_oids.size(); ++i) + subject.add("X509v3.ExtendedKeyUsage", m_oids[i].as_string()); } namespace { @@ -475,8 +475,8 @@ std::vector<byte> Certificate_Policies::encode_inner() const { std::vector<Policy_Information> policies; - for(size_t i = 0; i != oids.size(); ++i) - policies.push_back(oids[i]); + for(size_t i = 0; i != m_oids.size(); ++i) + policies.push_back(m_oids[i]); return DER_Encoder() .start_cons(SEQUENCE) @@ -494,9 +494,9 @@ void Certificate_Policies::decode_inner(const std::vector<byte>& in) BER_Decoder(in).decode_list(policies); - oids.clear(); + m_oids.clear(); for(size_t i = 0; i != policies.size(); ++i) - oids.push_back(policies[i].oid); + m_oids.push_back(policies[i].oid); } /* @@ -504,8 +504,8 @@ void Certificate_Policies::decode_inner(const std::vector<byte>& in) */ void Certificate_Policies::contents_to(Data_Store& info, Data_Store&) const { - for(size_t i = 0; i != oids.size(); ++i) - info.add("X509v3.CertificatePolicies", oids[i].as_string()); + for(size_t i = 0; i != m_oids.size(); ++i) + info.add("X509v3.CertificatePolicies", m_oids[i].as_string()); } std::vector<byte> Authority_Information_Access::encode_inner() const @@ -559,9 +559,9 @@ void Authority_Information_Access::contents_to(Data_Store& subject, Data_Store&) */ size_t CRL_Number::get_crl_number() const { - if(!has_value) + if(!m_has_value) throw Invalid_State("CRL_Number::get_crl_number: Not set"); - return crl_number; + return m_crl_number; } /* @@ -569,9 +569,9 @@ size_t CRL_Number::get_crl_number() const */ CRL_Number* CRL_Number::copy() const { - if(!has_value) + if(!m_has_value) throw Invalid_State("CRL_Number::copy: Not set"); - return new CRL_Number(crl_number); + return new CRL_Number(m_crl_number); } /* @@ -579,7 +579,7 @@ CRL_Number* CRL_Number::copy() const */ std::vector<byte> CRL_Number::encode_inner() const { - return DER_Encoder().encode(crl_number).get_contents_unlocked(); + return DER_Encoder().encode(m_crl_number).get_contents_unlocked(); } /* @@ -587,7 +587,7 @@ std::vector<byte> CRL_Number::encode_inner() const */ void CRL_Number::decode_inner(const std::vector<byte>& in) { - BER_Decoder(in).decode(crl_number); + BER_Decoder(in).decode(m_crl_number); } /* @@ -595,7 +595,7 @@ void CRL_Number::decode_inner(const std::vector<byte>& in) */ void CRL_Number::contents_to(Data_Store& info, Data_Store&) const { - info.add("X509v3.CRLNumber", crl_number); + info.add("X509v3.CRLNumber", m_crl_number); } /* @@ -604,7 +604,7 @@ void CRL_Number::contents_to(Data_Store& info, Data_Store&) const std::vector<byte> CRL_ReasonCode::encode_inner() const { return DER_Encoder() - .encode(static_cast<size_t>(reason), ENUMERATED, UNIVERSAL) + .encode(static_cast<size_t>(m_reason), ENUMERATED, UNIVERSAL) .get_contents_unlocked(); } @@ -615,7 +615,7 @@ void CRL_ReasonCode::decode_inner(const std::vector<byte>& in) { size_t reason_code = 0; BER_Decoder(in).decode(reason_code, ENUMERATED, UNIVERSAL); - reason = static_cast<CRL_Code>(reason_code); + m_reason = static_cast<CRL_Code>(reason_code); } /* @@ -623,7 +623,7 @@ void CRL_ReasonCode::decode_inner(const std::vector<byte>& in) */ void CRL_ReasonCode::contents_to(Data_Store& info, Data_Store&) const { - info.add("X509v3.CRLReasonCode", reason); + info.add("X509v3.CRLReasonCode", m_reason); } std::vector<byte> CRL_Distribution_Points::encode_inner() const diff --git a/src/lib/cert/x509/x509_ext.h b/src/lib/cert/x509/x509_ext.h index 5816dc699..cc8c0f793 100644 --- a/src/lib/cert/x509/x509_ext.h +++ b/src/lib/cert/x509/x509_ext.h @@ -90,12 +90,12 @@ class BOTAN_DLL Basic_Constraints : public Certificate_Extension { public: Basic_Constraints* copy() const override - { return new Basic_Constraints(is_ca, path_limit); } + { return new Basic_Constraints(m_is_ca, m_path_limit); } Basic_Constraints(bool ca = false, size_t limit = 0) : - is_ca(ca), path_limit(limit) {} + m_is_ca(ca), m_path_limit(limit) {} - bool get_is_ca() const { return is_ca; } + bool get_is_ca() const { return m_is_ca; } size_t get_path_limit() const; private: std::string oid_name() const override @@ -105,8 +105,8 @@ class BOTAN_DLL Basic_Constraints : public Certificate_Extension void decode_inner(const std::vector<byte>&) override; void contents_to(Data_Store&, Data_Store&) const override; - bool is_ca; - size_t path_limit; + bool m_is_ca; + size_t m_path_limit; }; /** @@ -115,21 +115,21 @@ class BOTAN_DLL Basic_Constraints : public Certificate_Extension class BOTAN_DLL Key_Usage : public Certificate_Extension { public: - Key_Usage* copy() const override { return new Key_Usage(constraints); } + Key_Usage* copy() const override { return new Key_Usage(m_constraints); } - Key_Usage(Key_Constraints c = NO_CONSTRAINTS) : constraints(c) {} + Key_Usage(Key_Constraints c = NO_CONSTRAINTS) : m_constraints(c) {} - Key_Constraints get_constraints() const { return constraints; } + Key_Constraints get_constraints() const { return m_constraints; } private: std::string oid_name() const override { return "X509v3.KeyUsage"; } bool should_encode() const override - { return (constraints != NO_CONSTRAINTS); } + { return (m_constraints != NO_CONSTRAINTS); } std::vector<byte> encode_inner() const override; void decode_inner(const std::vector<byte>&) override; void contents_to(Data_Store&, Data_Store&) const override; - Key_Constraints constraints; + Key_Constraints m_constraints; }; /** @@ -139,22 +139,22 @@ class BOTAN_DLL Subject_Key_ID : public Certificate_Extension { public: Subject_Key_ID* copy() const override - { return new Subject_Key_ID(key_id); } + { return new Subject_Key_ID(m_key_id); } Subject_Key_ID() {} Subject_Key_ID(const std::vector<byte>&); - std::vector<byte> get_key_id() const { return key_id; } + std::vector<byte> get_key_id() const { return m_key_id; } private: std::string oid_name() const override { return "X509v3.SubjectKeyIdentifier"; } - bool should_encode() const override { return (key_id.size() > 0); } + bool should_encode() const override { return (m_key_id.size() > 0); } std::vector<byte> encode_inner() const override; void decode_inner(const std::vector<byte>&) override; void contents_to(Data_Store&, Data_Store&) const override; - std::vector<byte> key_id; + std::vector<byte> m_key_id; }; /** @@ -164,22 +164,22 @@ class BOTAN_DLL Authority_Key_ID : public Certificate_Extension { public: Authority_Key_ID* copy() const override - { return new Authority_Key_ID(key_id); } + { return new Authority_Key_ID(m_key_id); } Authority_Key_ID() {} - Authority_Key_ID(const std::vector<byte>& k) : key_id(k) {} + Authority_Key_ID(const std::vector<byte>& k) : m_key_id(k) {} - std::vector<byte> get_key_id() const { return key_id; } + std::vector<byte> get_key_id() const { return m_key_id; } private: std::string oid_name() const override { return "X509v3.AuthorityKeyIdentifier"; } - bool should_encode() const override { return (key_id.size() > 0); } + bool should_encode() const override { return (m_key_id.size() > 0); } std::vector<byte> encode_inner() const override; void decode_inner(const std::vector<byte>&) override; void contents_to(Data_Store&, Data_Store&) const override; - std::vector<byte> key_id; + std::vector<byte> m_key_id; }; /** @@ -237,22 +237,22 @@ class BOTAN_DLL Extended_Key_Usage : public Certificate_Extension { public: Extended_Key_Usage* copy() const override - { return new Extended_Key_Usage(oids); } + { return new Extended_Key_Usage(m_oids); } Extended_Key_Usage() {} - Extended_Key_Usage(const std::vector<OID>& o) : oids(o) {} + Extended_Key_Usage(const std::vector<OID>& o) : m_oids(o) {} - std::vector<OID> get_oids() const { return oids; } + std::vector<OID> get_oids() const { return m_oids; } private: std::string oid_name() const override { return "X509v3.ExtendedKeyUsage"; } - bool should_encode() const override { return (oids.size() > 0); } + bool should_encode() const override { return (m_oids.size() > 0); } std::vector<byte> encode_inner() const override; void decode_inner(const std::vector<byte>&) override; void contents_to(Data_Store&, Data_Store&) const override; - std::vector<OID> oids; + std::vector<OID> m_oids; }; /** @@ -262,22 +262,22 @@ class BOTAN_DLL Certificate_Policies : public Certificate_Extension { public: Certificate_Policies* copy() const override - { return new Certificate_Policies(oids); } + { return new Certificate_Policies(m_oids); } Certificate_Policies() {} - Certificate_Policies(const std::vector<OID>& o) : oids(o) {} + Certificate_Policies(const std::vector<OID>& o) : m_oids(o) {} - std::vector<OID> get_oids() const { return oids; } + std::vector<OID> get_oids() const { return m_oids; } private: std::string oid_name() const override { return "X509v3.CertificatePolicies"; } - bool should_encode() const override { return (oids.size() > 0); } + bool should_encode() const override { return (m_oids.size() > 0); } std::vector<byte> encode_inner() const override; void decode_inner(const std::vector<byte>&) override; void contents_to(Data_Store&, Data_Store&) const override; - std::vector<OID> oids; + std::vector<OID> m_oids; }; class BOTAN_DLL Authority_Information_Access : public Certificate_Extension @@ -313,20 +313,20 @@ class BOTAN_DLL CRL_Number : public Certificate_Extension public: CRL_Number* copy() const override; - CRL_Number() : has_value(false), crl_number(0) {} - CRL_Number(size_t n) : has_value(true), crl_number(n) {} + CRL_Number() : m_has_value(false), m_crl_number(0) {} + CRL_Number(size_t n) : m_has_value(true), m_crl_number(n) {} size_t get_crl_number() const; private: std::string oid_name() const override { return "X509v3.CRLNumber"; } - bool should_encode() const override { return has_value; } + bool should_encode() const override { return m_has_value; } std::vector<byte> encode_inner() const override; void decode_inner(const std::vector<byte>&) override; void contents_to(Data_Store&, Data_Store&) const override; - bool has_value; - size_t crl_number; + bool m_has_value; + size_t m_crl_number; }; /** @@ -336,20 +336,20 @@ class BOTAN_DLL CRL_ReasonCode : public Certificate_Extension { public: CRL_ReasonCode* copy() const override - { return new CRL_ReasonCode(reason); } + { return new CRL_ReasonCode(m_reason); } - CRL_ReasonCode(CRL_Code r = UNSPECIFIED) : reason(r) {} + CRL_ReasonCode(CRL_Code r = UNSPECIFIED) : m_reason(r) {} - CRL_Code get_reason() const { return reason; } + CRL_Code get_reason() const { return m_reason; } private: std::string oid_name() const override { return "X509v3.ReasonCode"; } - bool should_encode() const override { return (reason != UNSPECIFIED); } + bool should_encode() const override { return (m_reason != UNSPECIFIED); } std::vector<byte> encode_inner() const override; void decode_inner(const std::vector<byte>&) override; void contents_to(Data_Store&, Data_Store&) const override; - CRL_Code reason; + CRL_Code m_reason; }; /** diff --git a/src/lib/pubkey/rsa/rsa.cpp b/src/lib/pubkey/rsa/rsa.cpp index 8d75d4a29..18a694754 100644 --- a/src/lib/pubkey/rsa/rsa.cpp +++ b/src/lib/pubkey/rsa/rsa.cpp @@ -191,23 +191,23 @@ class RSA_Public_Operation { public: RSA_Public_Operation(const RSA_PublicKey& rsa) : - n(rsa.get_n()), powermod_e_n(rsa.get_e(), rsa.get_n()) + m_n(rsa.get_n()), m_powermod_e_n(rsa.get_e(), rsa.get_n()) {} - size_t get_max_input_bits() const { return (n.bits() - 1); } + size_t get_max_input_bits() const { return (m_n.bits() - 1); } protected: BigInt public_op(const BigInt& m) const { - if(m >= n) + if(m >= m_n) throw Invalid_Argument("RSA public op - input is too large"); - return powermod_e_n(m); + return m_powermod_e_n(m); } - const BigInt& get_n() const { return n; } + const BigInt& get_n() const { return m_n; } - const BigInt& n; - Fixed_Exponent_Power_Mod powermod_e_n; + const BigInt& m_n; + Fixed_Exponent_Power_Mod m_powermod_e_n; }; class RSA_Encryption_Operation : public PK_Ops::Encryption_with_EME, @@ -228,7 +228,7 @@ class RSA_Encryption_Operation : public PK_Ops::Encryption_with_EME, RandomNumberGenerator&) override { BigInt m(msg, msg_len); - return BigInt::encode_1363(public_op(m), n.bytes()); + return BigInt::encode_1363(public_op(m), m_n.bytes()); } }; |