aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/cert
diff options
context:
space:
mode:
authorDaniel Neus <[email protected]>2016-01-04 21:35:24 +0100
committerDaniel Neus <[email protected]>2016-01-04 21:35:24 +0100
commit443a5c25db02aa7ac505fdc3b0fa60c1d584a5f1 (patch)
tree6683223da4ea9917914c0eb9d7d1110cc86ac6f6 /src/lib/cert
parent9d3ad9a0f44a9321185ed9f221c828dac81b9f0c (diff)
String comparision fixes
fix PVS-Studio perfomance warnings
Diffstat (limited to 'src/lib/cert')
-rw-r--r--src/lib/cert/x509/certstor.cpp2
-rw-r--r--src/lib/cert/x509/ocsp.cpp2
-rw-r--r--src/lib/cert/x509/x509_ext.cpp2
-rw-r--r--src/lib/cert/x509/x509_ext.h2
-rw-r--r--src/lib/cert/x509/x509cert.cpp6
-rw-r--r--src/lib/cert/x509/x509opt.cpp4
-rw-r--r--src/lib/cert/x509/x509path.cpp2
-rw-r--r--src/lib/cert/x509/x509self.cpp2
8 files changed, 11 insertions, 11 deletions
diff --git a/src/lib/cert/x509/certstor.cpp b/src/lib/cert/x509/certstor.cpp
index e3498f602..26c9ce117 100644
--- a/src/lib/cert/x509/certstor.cpp
+++ b/src/lib/cert/x509/certstor.cpp
@@ -115,7 +115,7 @@ Certificate_Store_In_Memory::Certificate_Store_In_Memory(const X509_Certificate&
Certificate_Store_In_Memory::Certificate_Store_In_Memory(const std::string& dir)
{
- if(dir == "")
+ if(dir.empty())
return;
std::vector<std::string> maybe_certs = get_files_recursive(dir);
diff --git a/src/lib/cert/x509/ocsp.cpp b/src/lib/cert/x509/ocsp.cpp
index 75475fe55..4f4a3aece 100644
--- a/src/lib/cert/x509/ocsp.cpp
+++ b/src/lib/cert/x509/ocsp.cpp
@@ -228,7 +228,7 @@ Response online_check(const X509_Certificate& issuer,
{
const std::string responder_url = subject.ocsp_responder();
- if(responder_url == "")
+ if(responder_url.empty())
throw Exception("No OCSP responder specified");
OCSP::Request req(issuer, subject);
diff --git a/src/lib/cert/x509/x509_ext.cpp b/src/lib/cert/x509/x509_ext.cpp
index f752500c0..a05d27d3e 100644
--- a/src/lib/cert/x509/x509_ext.cpp
+++ b/src/lib/cert/x509/x509_ext.cpp
@@ -549,7 +549,7 @@ void Authority_Information_Access::decode_inner(const std::vector<byte>& in)
void Authority_Information_Access::contents_to(Data_Store& subject, Data_Store&) const
{
- if(m_ocsp_responder != "")
+ if(!m_ocsp_responder.empty())
subject.add("OCSP.responder", m_ocsp_responder);
}
diff --git a/src/lib/cert/x509/x509_ext.h b/src/lib/cert/x509/x509_ext.h
index 2ed892055..0ce49231a 100644
--- a/src/lib/cert/x509/x509_ext.h
+++ b/src/lib/cert/x509/x509_ext.h
@@ -295,7 +295,7 @@ class BOTAN_DLL Authority_Information_Access : public Certificate_Extension
std::string oid_name() const override
{ return "PKIX.AuthorityInformationAccess"; }
- bool should_encode() const override { return (m_ocsp_responder != ""); }
+ bool should_encode() const override { return (!m_ocsp_responder.empty()); }
std::vector<byte> encode_inner() const override;
void decode_inner(const std::vector<byte>&) override;
diff --git a/src/lib/cert/x509/x509cert.cpp b/src/lib/cert/x509/x509cert.cpp
index 3d1ebbbad..7e5199c00 100644
--- a/src/lib/cert/x509/x509cert.cpp
+++ b/src/lib/cert/x509/x509cert.cpp
@@ -379,7 +379,7 @@ std::string X509_Certificate::fingerprint(const std::string& hash_name) const
bool X509_Certificate::matches_dns_name(const std::string& name) const
{
- if(name == "")
+ if(name.empty())
return false;
std::vector<std::string> issued_names = subject_info("DNS");
@@ -508,9 +508,9 @@ std::string X509_Certificate::to_string() const
out << " " << ex_constraints[i] << "\n";
}
- if(ocsp_responder() != "")
+ if(!ocsp_responder().empty())
out << "OCSP responder " << ocsp_responder() << "\n";
- if(crl_distribution_point() != "")
+ if(!crl_distribution_point().empty())
out << "CRL " << crl_distribution_point() << "\n";
out << "Signature algorithm: " <<
diff --git a/src/lib/cert/x509/x509opt.cpp b/src/lib/cert/x509/x509opt.cpp
index 52845658f..158f4c779 100644
--- a/src/lib/cert/x509/x509opt.cpp
+++ b/src/lib/cert/x509/x509opt.cpp
@@ -66,7 +66,7 @@ void X509_Cert_Options::CA_key(size_t limit)
*/
void X509_Cert_Options::sanity_check() const
{
- if(common_name == "" || country == "")
+ if(common_name.empty() || country.empty())
throw Encoding_Error("X.509 certificate: name and country MUST be set");
if(country.size() != 2)
throw Encoding_Error("Invalid ISO country code: " + country);
@@ -89,7 +89,7 @@ X509_Cert_Options::X509_Cert_Options(const std::string& initial_opts,
start = X509_Time(now);
end = X509_Time(now + std::chrono::seconds(expiration_time));
- if(initial_opts == "")
+ if(initial_opts.empty())
return;
std::vector<std::string> parsed = split_on(initial_opts, '/');
diff --git a/src/lib/cert/x509/x509path.cpp b/src/lib/cert/x509/x509path.cpp
index 5e12ddb2a..71c025280 100644
--- a/src/lib/cert/x509/x509path.cpp
+++ b/src/lib/cert/x509/x509path.cpp
@@ -249,7 +249,7 @@ Path_Validation_Result x509_path_validate(
std::vector<std::set<Certificate_Status_Code>> res = check_chain(cert_path, restrictions, certstores);
- if(hostname != "" && !cert_path[0].matches_dns_name(hostname))
+ if(!hostname.empty() && !cert_path[0].matches_dns_name(hostname))
res[0].insert(Certificate_Status_Code::CERT_NAME_NOMATCH);
if(!cert_path[0].allowed_usage(usage))
diff --git a/src/lib/cert/x509/x509self.cpp b/src/lib/cert/x509/x509self.cpp
index 2f2f6a59f..7d1c01c37 100644
--- a/src/lib/cert/x509/x509self.cpp
+++ b/src/lib/cert/x509/x509self.cpp
@@ -126,7 +126,7 @@ PKCS10_Request create_cert_req(const X509_Cert_Options& opts,
.raw_bytes(pub_key)
.start_explicit(0);
- if(opts.challenge != "")
+ if(!opts.challenge.empty())
{
ASN1_String challenge(opts.challenge, DIRECTORY_STRING);