config.h.in: use const variables instead of macros
Most style guides try to avoid preprocessor macros, especially the use
case here: const objects. This change replaced them with const
variables. Their names are also changed according to the OpenBMC style
guide.
Reference:
https://google.github.io/styleguide/cppguide.html#Preprocessor_Macros
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I0786c7c83f3a0d892c14f1cb813d0aa16d627b3e
diff --git a/certs_manager.cpp b/certs_manager.cpp
index ed6e375..9adca20 100644
--- a/certs_manager.cpp
+++ b/certs_manager.cpp
@@ -155,7 +155,7 @@
elog<NotAllowed>(Reason("Certificate already exist"));
}
else if (certType == phosphor::certs::AUTHORITY &&
- installedCerts.size() >= AUTHORITY_CERTIFICATES_LIMIT)
+ installedCerts.size() >= maxNumAuthorityCertificates)
{
elog<NotAllowed>(Reason("Certificates limit reached"));
}
@@ -418,7 +418,7 @@
}
// Write private key to file
- writePrivateKey(pKey, PRIV_KEY_FILE_NAME);
+ writePrivateKey(pKey, defaultPrivateKeyFileName);
// set sign key of x509 req
ret = X509_REQ_sign(x509Req.get(), pKey.get(), EVP_sha256());
@@ -429,7 +429,7 @@
}
log<level::INFO>("Writing CSR to file");
- fs::path csrFilePath = certParentInstallPath / CSR_FILE_NAME;
+ fs::path csrFilePath = certParentInstallPath / defaultCSRFileName;
writeCSR(csrFilePath.string(), x509Req);
}
@@ -778,14 +778,14 @@
void Manager::createRSAPrivateKeyFile()
{
fs::path rsaPrivateKeyFileName =
- certParentInstallPath / RSA_PRIV_KEY_FILE_NAME;
+ certParentInstallPath / defaultRSAPrivateKeyFileName;
try
{
if (!fs::exists(rsaPrivateKeyFileName))
{
writePrivateKey(generateRSAKeyPair(SUPPORTED_KEYBITLENGTH),
- RSA_PRIV_KEY_FILE_NAME);
+ defaultRSAPrivateKeyFileName);
}
}
catch (const InternalFailure& e)
@@ -807,7 +807,7 @@
Argument::ARGUMENT_VALUE(std::to_string(keyBitLength).c_str()));
}
fs::path rsaPrivateKeyFileName =
- certParentInstallPath / RSA_PRIV_KEY_FILE_NAME;
+ certParentInstallPath / defaultRSAPrivateKeyFileName;
FILE* privateKeyFile = std::fopen(rsaPrivateKeyFileName.c_str(), "r");
if (!privateKeyFile)