summaryrefslogtreecommitdiff
path: root/include/ssl_key_handler.hpp
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2022-01-25 21:39:19 +0300
committerEd Tanous <ed@tanous.net>2022-02-15 03:35:55 +0300
commite662eae819f545ef07193f216b42e161b7ff7a46 (patch)
tree2b13d88ae009fa7af3396252c8787992ff2cc6c8 /include/ssl_key_handler.hpp
parentc5ba4c27ddb28c7844c0ea3078df4114f531dd25 (diff)
downloadbmcweb-e662eae819f545ef07193f216b42e161b7ff7a46.tar.xz
Enable readability-implicit-bool-conversion checks
These checks ensure that we're not implicitly converting ints or pointers into bools, which makes the code easier to read. Tested: Ran series through redfish service validator. No changes observed. UUID failing in Qemu both before and after. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I1ca0be980d136bd4e5474341f4fd62f2f6bbdbae
Diffstat (limited to 'include/ssl_key_handler.hpp')
-rw-r--r--include/ssl_key_handler.hpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/include/ssl_key_handler.hpp b/include/ssl_key_handler.hpp
index fcb79f24f6..30145f8136 100644
--- a/include/ssl_key_handler.hpp
+++ b/include/ssl_key_handler.hpp
@@ -40,7 +40,7 @@ inline bool validateCertificate(X509* const cert)
{
// Create an empty X509_STORE structure for certificate validation.
X509_STORE* x509Store = X509_STORE_new();
- if (!x509Store)
+ if (x509Store == nullptr)
{
BMCWEB_LOG_ERROR << "Error occurred during X509_STORE_new call";
return false;
@@ -48,7 +48,7 @@ inline bool validateCertificate(X509* const cert)
// Load Certificate file into the X509 structure.
X509_STORE_CTX* storeCtx = X509_STORE_CTX_new();
- if (!storeCtx)
+ if (storeCtx == nullptr)
{
BMCWEB_LOG_ERROR << "Error occurred during X509_STORE_CTX_new call";
X509_STORE_free(x509Store);
@@ -147,7 +147,7 @@ inline bool verifyOpensslKeyCert(const std::string& filepath)
EVP_PKEY_CTX* pkeyCtx =
EVP_PKEY_CTX_new_from_pkey(nullptr, pkey, nullptr);
- if (!pkeyCtx)
+ if (pkeyCtx == nullptr)
{
std::cerr << "Unable to allocate pkeyCtx " << ERR_get_error()
<< "\n";
@@ -198,7 +198,7 @@ inline bool verifyOpensslKeyCert(const std::string& filepath)
inline X509* loadCert(const std::string& filePath)
{
BIO* certFileBio = BIO_new_file(filePath.c_str(), "rb");
- if (!certFileBio)
+ if (certFileBio == nullptr)
{
BMCWEB_LOG_ERROR << "Error occured during BIO_new_file call, "
<< "FILE= " << filePath;
@@ -206,7 +206,7 @@ inline X509* loadCert(const std::string& filePath)
}
X509* cert = X509_new();
- if (!cert)
+ if (cert == nullptr)
{
BMCWEB_LOG_ERROR << "Error occured during X509_new call, "
<< ERR_get_error();
@@ -214,7 +214,7 @@ inline X509* loadCert(const std::string& filePath)
return nullptr;
}
- if (!PEM_read_bio_X509(certFileBio, &cert, nullptr, nullptr))
+ if (PEM_read_bio_X509(certFileBio, &cert, nullptr, nullptr) == nullptr)
{
BMCWEB_LOG_ERROR << "Error occured during PEM_read_bio_X509 call, "
<< "FILE= " << filePath;
@@ -235,7 +235,7 @@ inline int addExt(X509* cert, int nid, const char* value)
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast)
ex = X509V3_EXT_conf_nid(nullptr, &ctx, nid, const_cast<char*>(value));
- if (!ex)
+ if (ex == nullptr)
{
BMCWEB_LOG_ERROR << "Error: In X509V3_EXT_conf_nidn: " << value;
return -1;