Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions bmc-acf/acf_manager.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <acf_manager.hpp>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/log.hpp>
#include <phosphor-logging/lg2.hpp>
#include <tacf.hpp>
#include <xyz/openbmc_project/Certs/error.hpp>

Expand Down Expand Up @@ -87,15 +87,12 @@ acf_info ACFCertMgr::installACF(std::vector<uint8_t> accessControlFile)
return std::make_tuple(accessControlFile, acfInstalled(), sDate);
}
// Verify and install ACF and get expiration date.
Tacf tacf{[](std::string msg) {
log<phosphor::logging::level::INFO>(msg.c_str());
}};
Tacf tacf{[](std::string msg) { lg2::info("Note: {MSG}", "MSG", msg); }};
int rc = tacf.install(accessControlFile.data(), accessControlFile.size(),
sDate);
if (rc)
{
log<level::INFO>("ACF install failed");
log<level::ERR>("Error: ", entry("rc=%0x", rc));
lg2::error("Error: ACF install failed, rc={RC}", "RC", lg2::hex, rc);
elog<InvalidCertificate>(Reason("ACF validation failed"));
}

Expand All @@ -109,20 +106,18 @@ std::tuple<std::vector<uint8_t>, bool, std::string> ACFCertMgr::getACFInfo(void)

if (!readBinaryFile(ACF_FILE_PATH, accessControlFile))
{
log<level::ERR>("ACF not installed or not readable");
lg2::error("ACF not installed or not readable");
}
else
{
// Verify ACF and get expiration date.
Tacf tacf{[](std::string msg) {
log<phosphor::logging::level::INFO>(msg.c_str());
}};
Tacf tacf{
[](std::string msg) { lg2::info("Note: {MSG}", "MSG", msg); }};
int rc = tacf.verify(accessControlFile.data(), accessControlFile.size(),
sDate);
if (rc)
{
log<level::INFO>("ACF is not valid");
log<level::ERR>("Error: ", entry("rc=%0x", rc));
lg2::error("Error: ACF is not valid, rc={RC}", "RC", lg2::hex, rc);
accessControlFile.clear();
sDate.clear();
}
Expand Down
4 changes: 2 additions & 2 deletions bmc-acf/acf_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class ACFCertMgr : public CreateIface
*/
ACFCertMgr(sdbusplus::bus::bus& bus, sdeventplus::Event& event,
const char* path) :
CreateIface(bus, path),
bus(bus), event(event), objectPath(path), lastEntryId(0){};
CreateIface(bus, path), bus(bus), event(event), objectPath(path),
lastEntryId(0) {};

/** @brief Implementation for InstallACF
* Replace the existing ACF with another ACF
Expand Down
2 changes: 1 addition & 1 deletion bmc-vmi-ca/ca_certs_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class CACertMgr : public internal::ManagerInterface
*/
CACertMgr(sdbusplus::bus_t& bus, const char* path) :
internal::ManagerInterface(bus, path), bus(bus), objectPath(path),
lastEntryId(0){};
lastEntryId(0) {};

/** @brief This method provides signing authority functionality.
It signs the certificate and creates the CSR request entry Dbus
Expand Down
6 changes: 3 additions & 3 deletions certs_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ std::vector<std::string> splitCertificates(const std::string& sourceFilePath)
Manager::Manager(sdbusplus::bus_t& bus, sdeventplus::Event& event,
const char* path, CertificateType type,
const std::string& unit, const std::string& installPath) :
internal::ManagerInterface(bus, path),
bus(bus), event(event), objectPath(path), certType(type),
unitToRestart(std::move(unit)), certInstallPath(std::move(installPath)),
internal::ManagerInterface(bus, path), bus(bus), event(event),
objectPath(path), certType(type), unitToRestart(std::move(unit)),
certInstallPath(std::move(installPath)),
certParentInstallPath(fs::path(certInstallPath).parent_path())
{
try
Expand Down
4 changes: 1 addition & 3 deletions test/certs_manager_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,7 @@ class MainApp
{
public:
MainApp(phosphor::certs::Manager* manager,
phosphor::certs::CSR* csr = nullptr) :
manager(manager),
csr_(csr)
phosphor::certs::CSR* csr = nullptr) : manager(manager), csr_(csr)
{}
void install(std::string& path)
{
Expand Down