clang-format: copy latest and re-format
clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.
Change-Id: Ie4138afe359d52b9f1a32fdff6890a90dd31efa8
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index ea71ad6..d92a3f1 100644
--- a/.clang-format
+++ b/.clang-format
@@ -5,22 +5,24 @@
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
-AlignEscapedNewlinesLeft: false
-AlignOperands: true
-AlignTrailingComments: true
+AlignEscapedNewlines: Right
+AlignOperands: Align
+AlignTrailingComments:
+ Kind: Always
+ OverEmptyLines: 1
AllowAllParametersOfDeclarationOnNextLine: true
-AllowShortBlocksOnASingleLine: false
+AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
-AllowShortFunctionsOnASingleLine: None
+AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
-AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
-AlwaysBreakTemplateDeclarations: true
+AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
+ AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
@@ -29,19 +31,28 @@
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
+ AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
+ SplitEmptyFunction: false
+ SplitEmptyRecord: false
+ SplitEmptyNamespace: false
+BreakAfterAttributes: Never
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon
+BreakInheritanceList: AfterColon
+BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
+CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
+DeriveLineEnding: false
DerivePointerAlignment: false
PointerAlignment: Left
DisableFormat: false
@@ -51,21 +62,29 @@
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^[<"](gtest|gmock)'
- Priority: 5
+ Priority: 7
- Regex: '^"config.h"'
Priority: -1
- - Regex: '^".*\.hpp"'
+ - Regex: '^".*\.h"'
Priority: 1
- - Regex: '^<.*\.h>'
+ - Regex: '^".*\.hpp"'
Priority: 2
- - Regex: '^<.*'
+ - Regex: '^<.*\.h>'
Priority: 3
- - Regex: '.*'
+ - Regex: '^<.*\.hpp>'
Priority: 4
+ - Regex: '^<.*'
+ Priority: 5
+ - Regex: '.*'
+ Priority: 6
IndentCaseLabels: true
+IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: true
-KeepEmptyLinesAtTheStartOfBlocks: true
+InsertNewlineAtEOF: true
+KeepEmptyLinesAtTheStartOfBlocks: false
+LambdaBodyIndentation: OuterScope
+LineEnding: LF
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
@@ -73,18 +92,29 @@
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
+PenaltyBreakAssignment: 25
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
+PenaltyIndentedWhitespace: 0
+QualifierAlignment: Left
+ReferenceAlignment: Left
ReflowComments: true
+RequiresClausePosition: OwnLine
+RequiresExpressionIndentation: Keyword
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
+SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
+SpaceBeforeCpp11BracedList: false
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
+SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
@@ -92,7 +122,7 @@
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
-Standard: Cpp11
+Standard: Latest
TabWidth: 4
UseTab: Never
...
diff --git a/bmc-vmi-ca/ca_cert_entry.cpp b/bmc-vmi-ca/ca_cert_entry.cpp
index f4d7b2e..e193b60 100644
--- a/bmc-vmi-ca/ca_cert_entry.cpp
+++ b/bmc-vmi-ca/ca_cert_entry.cpp
@@ -1,15 +1,15 @@
-#include "config.h"
-
-#include "ca_cert_entry.hpp"
-
-#include "ca_certs_manager.hpp"
-
-namespace ca::cert
-{
-
-void Entry::delete_()
-{
- // Remove entry D-bus object
- manager.erase(id);
-}
-} // namespace ca::cert
+#include "config.h"
+
+#include "ca_cert_entry.hpp"
+
+#include "ca_certs_manager.hpp"
+
+namespace ca::cert
+{
+
+void Entry::delete_()
+{
+ // Remove entry D-bus object
+ manager.erase(id);
+}
+} // namespace ca::cert
diff --git a/bmc-vmi-ca/ca_certs_manager.cpp b/bmc-vmi-ca/ca_certs_manager.cpp
index f08c1e7..ed0f337 100644
--- a/bmc-vmi-ca/ca_certs_manager.cpp
+++ b/bmc-vmi-ca/ca_certs_manager.cpp
@@ -2,13 +2,14 @@
#include "ca_certs_manager.hpp"
-#include <filesystem>
-#include <fstream>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/log.hpp>
#include <xyz/openbmc_project/Common/error.hpp>
+#include <filesystem>
+#include <fstream>
+
namespace ca::cert
{
namespace fs = std::filesystem;
@@ -35,8 +36,8 @@
Argument::ARGUMENT_VALUE(csr.c_str()));
}
auto id = lastEntryId + 1;
- objPath =
- fs::path(objectNamePrefix) / "ca" / "entry" / std::to_string(id);
+ objPath = fs::path(objectNamePrefix) / "ca" / "entry" /
+ std::to_string(id);
std::string cert;
// Creating the dbus object here with the empty certificate string
// actual signing is being done by the hypervisor, once it signs then
diff --git a/bmc-vmi-ca/mainapp.cpp b/bmc-vmi-ca/mainapp.cpp
index fc1c7af..5f5d233 100644
--- a/bmc-vmi-ca/mainapp.cpp
+++ b/bmc-vmi-ca/mainapp.cpp
@@ -3,6 +3,7 @@
#include "ca_certs_manager.hpp"
#include <sdbusplus/server/manager.hpp>
+
#include <string>
int main()
diff --git a/certificate.cpp b/certificate.cpp
index 9628b55..52c3c2a 100644
--- a/certificate.cpp
+++ b/certificate.cpp
@@ -16,6 +16,13 @@
#include <openssl/pem.h>
#include <openssl/x509v3.h>
+#include <phosphor-logging/elog-errors.hpp>
+#include <phosphor-logging/elog.hpp>
+#include <phosphor-logging/log.hpp>
+#include <watch.hpp>
+#include <xyz/openbmc_project/Certs/error.hpp>
+#include <xyz/openbmc_project/Common/error.hpp>
+
#include <cstdint>
#include <cstdio>
#include <cstdlib>
@@ -23,14 +30,8 @@
#include <filesystem>
#include <fstream>
#include <map>
-#include <phosphor-logging/elog-errors.hpp>
-#include <phosphor-logging/elog.hpp>
-#include <phosphor-logging/log.hpp>
#include <utility>
#include <vector>
-#include <watch.hpp>
-#include <xyz/openbmc_project/Certs/error.hpp>
-#include <xyz/openbmc_project/Common/error.hpp>
namespace phosphor::certs
{
diff --git a/certificate.hpp b/certificate.hpp
index 8a5f70e..e2864eb 100644
--- a/certificate.hpp
+++ b/certificate.hpp
@@ -5,16 +5,17 @@
#include <openssl/ossl_typ.h>
#include <openssl/x509.h>
-#include <functional>
-#include <memory>
#include <sdbusplus/server/object.hpp>
-#include <string>
-#include <string_view>
-#include <unordered_map>
#include <xyz/openbmc_project/Certs/Certificate/server.hpp>
#include <xyz/openbmc_project/Certs/Replace/server.hpp>
#include <xyz/openbmc_project/Object/Delete/server.hpp>
+#include <functional>
+#include <memory>
+#include <string>
+#include <string_view>
+#include <unordered_map>
+
namespace phosphor::certs
{
diff --git a/certs_manager.cpp b/certs_manager.cpp
index 984a896..6e31091 100644
--- a/certs_manager.cpp
+++ b/certs_manager.cpp
@@ -15,6 +15,17 @@
#include <openssl/rsa.h>
#include <unistd.h>
+#include <phosphor-logging/elog-errors.hpp>
+#include <phosphor-logging/elog.hpp>
+#include <phosphor-logging/log.hpp>
+#include <sdbusplus/bus.hpp>
+#include <sdbusplus/exception.hpp>
+#include <sdbusplus/message.hpp>
+#include <sdeventplus/source/base.hpp>
+#include <sdeventplus/source/child.hpp>
+#include <xyz/openbmc_project/Certs/error.hpp>
+#include <xyz/openbmc_project/Common/error.hpp>
+
#include <algorithm>
#include <array>
#include <cerrno>
@@ -25,17 +36,7 @@
#include <cstring>
#include <exception>
#include <fstream>
-#include <phosphor-logging/elog-errors.hpp>
-#include <phosphor-logging/elog.hpp>
-#include <phosphor-logging/log.hpp>
-#include <sdbusplus/bus.hpp>
-#include <sdbusplus/exception.hpp>
-#include <sdbusplus/message.hpp>
-#include <sdeventplus/source/base.hpp>
-#include <sdeventplus/source/child.hpp>
#include <utility>
-#include <xyz/openbmc_project/Certs/error.hpp>
-#include <xyz/openbmc_project/Common/error.hpp>
namespace phosphor::certs
{
@@ -186,8 +187,8 @@
if (certType != CertificateType::authority)
{
// watch for certificate file create/replace
- certWatchPtr = std::make_unique<
- Watch>(event, certInstallPath, [this]() {
+ certWatchPtr = std::make_unique<Watch>(event, certInstallPath,
+ [this]() {
try
{
// if certificate file existing update it
@@ -311,8 +312,8 @@
log<level::INFO>("Starts authority list install");
fs::path authorityStore(certInstallPath);
- fs::path authoritiesListFile =
- authorityStore / defaultAuthoritiesListFileName;
+ fs::path authoritiesListFile = authorityStore /
+ defaultAuthoritiesListFileName;
// Atomically install all the certificates
fs::path tempPath = Certificate::generateUniqueFilePath(authorityStore);
@@ -325,8 +326,8 @@
X509StorePtr x509Store = getX509Store(sourceFile);
for (const auto& authority : authorities)
{
- std::string certObjectPath =
- objectPath + '/' + std::to_string(tempCertIdCounter);
+ std::string certObjectPath = objectPath + '/' +
+ std::to_string(tempCertIdCounter);
tempCertificates.emplace_back(std::make_unique<Certificate>(
bus, certObjectPath, certType, tempPath, *x509Store, authority,
certWatchPtr.get(), *this, /*restore=*/false));
@@ -387,8 +388,8 @@
// If the authorities list exists, delete it as well
if (certType == CertificateType::authority)
{
- if (fs::path authoritiesList =
- fs::path(certInstallPath) / defaultAuthoritiesListFileName;
+ if (fs::path authoritiesList = fs::path(certInstallPath) /
+ defaultAuthoritiesListFileName;
fs::exists(authoritiesList))
{
fs::remove(authoritiesList);
@@ -401,11 +402,11 @@
void Manager::deleteCertificate(const Certificate* const certificate)
{
- std::vector<std::unique_ptr<Certificate>>::iterator const& certIt =
+ const std::vector<std::unique_ptr<Certificate>>::iterator& certIt =
std::find_if(installedCerts.begin(), installedCerts.end(),
- [certificate](std::unique_ptr<Certificate> const& cert) {
- return (cert.get() == certificate);
- });
+ [certificate](const std::unique_ptr<Certificate>& cert) {
+ return (cert.get() == certificate);
+ });
if (certIt != installedCerts.end())
{
installedCerts.erase(certIt);
@@ -482,8 +483,8 @@
else
{
using namespace sdeventplus::source;
- Child::Callback callback = [this](Child& eventSource,
- const siginfo_t* si) {
+ Child::Callback callback =
+ [this](Child& eventSource, const siginfo_t* si) {
eventSource.set_enabled(Enabled::On);
if (si->si_status != 0)
{
@@ -643,9 +644,10 @@
const static std::array<const char*, 6> usageList = {
"ServerAuthentication", "ClientAuthentication", "OCSPSigning",
"Timestamping", "CodeSigning", "EmailProtection"};
- auto it = std::find_if(
- usageList.begin(), usageList.end(),
- [&usage](const char* s) { return (strcmp(s, usage.c_str()) == 0); });
+ auto it = std::find_if(usageList.begin(), usageList.end(),
+ [&usage](const char* s) {
+ return (strcmp(s, usage.c_str()) == 0);
+ });
return it != usageList.end();
}
EVPPkeyPtr Manager::generateRSAKeyPair(const int64_t keyBitLength)
@@ -842,8 +844,8 @@
log<level::ERR>("Error occurred creating private key file");
elog<InternalFailure>();
}
- int ret =
- PEM_write_PrivateKey(fp, pKey.get(), nullptr, nullptr, 0, 0, nullptr);
+ int ret = PEM_write_PrivateKey(fp, pKey.get(), nullptr, nullptr, 0, 0,
+ nullptr);
std::fclose(fp);
if (ret == 0)
{
@@ -930,8 +932,8 @@
}
// If the authorities list exists, recover from it and return
- if (fs::path authoritiesListFilePath =
- fs::path(certInstallPath) / defaultAuthoritiesListFileName;
+ if (fs::path authoritiesListFilePath = fs::path(certInstallPath) /
+ defaultAuthoritiesListFileName;
fs::exists(authoritiesListFilePath))
{
// remove all other files and directories
@@ -994,8 +996,8 @@
void Manager::createRSAPrivateKeyFile()
{
- fs::path rsaPrivateKeyFileName =
- certParentInstallPath / defaultRSAPrivateKeyFileName;
+ fs::path rsaPrivateKeyFileName = certParentInstallPath /
+ defaultRSAPrivateKeyFileName;
try
{
@@ -1023,8 +1025,8 @@
Argument::ARGUMENT_NAME("KEYBITLENGTH"),
Argument::ARGUMENT_VALUE(std::to_string(keyBitLength).c_str()));
}
- fs::path rsaPrivateKeyFileName =
- certParentInstallPath / defaultRSAPrivateKeyFileName;
+ fs::path rsaPrivateKeyFileName = certParentInstallPath /
+ defaultRSAPrivateKeyFileName;
FILE* privateKeyFile = std::fopen(rsaPrivateKeyFileName.c_str(), "r");
if (!privateKeyFile)
@@ -1111,8 +1113,8 @@
{
if (std::any_of(
installedCerts.begin(), installedCerts.end(),
- [&filePath, certToDrop](std::unique_ptr<Certificate> const& cert) {
- return cert.get() != certToDrop && cert->isSame(filePath);
+ [&filePath, certToDrop](const std::unique_ptr<Certificate>& cert) {
+ return cert.get() != certToDrop && cert->isSame(filePath);
}))
{
return false;
diff --git a/certs_manager.hpp b/certs_manager.hpp
index 064d801..2c35fa7 100644
--- a/certs_manager.hpp
+++ b/certs_manager.hpp
@@ -8,20 +8,21 @@
#include <openssl/ossl_typ.h>
#include <openssl/x509.h>
-#include <cstdint>
-#include <filesystem>
-#include <memory>
#include <sdbusplus/server/object.hpp>
#include <sdeventplus/source/child.hpp>
#include <sdeventplus/source/event.hpp>
-#include <string>
-#include <vector>
#include <xyz/openbmc_project/Certs/CSR/Create/server.hpp>
#include <xyz/openbmc_project/Certs/Install/server.hpp>
#include <xyz/openbmc_project/Certs/InstallAll/server.hpp>
#include <xyz/openbmc_project/Certs/ReplaceAll/server.hpp>
#include <xyz/openbmc_project/Collection/DeleteAll/server.hpp>
+#include <cstdint>
+#include <filesystem>
+#include <memory>
+#include <string>
+#include <vector>
+
namespace phosphor::certs
{
diff --git a/csr.cpp b/csr.cpp
index 5f400e5..88fb761 100644
--- a/csr.cpp
+++ b/csr.cpp
@@ -8,16 +8,17 @@
#include <openssl/pem.h>
#include <openssl/x509.h>
-#include <cstdio>
-#include <filesystem>
-#include <memory>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/log.hpp>
-#include <utility>
#include <xyz/openbmc_project/Certs/error.hpp>
#include <xyz/openbmc_project/Common/error.hpp>
+#include <cstdio>
+#include <filesystem>
+#include <memory>
+#include <utility>
+
namespace phosphor::certs
{
diff --git a/csr.hpp b/csr.hpp
index e891681..cf9017e 100644
--- a/csr.hpp
+++ b/csr.hpp
@@ -1,8 +1,9 @@
#pragma once
#include <sdbusplus/server/object.hpp>
-#include <string>
#include <xyz/openbmc_project/Certs/CSR/server.hpp>
+#include <string>
+
namespace phosphor::certs
{
diff --git a/mainapp.cpp b/mainapp.cpp
index 6e37ca4..5e47aeb 100644
--- a/mainapp.cpp
+++ b/mainapp.cpp
@@ -22,10 +22,11 @@
#include <systemd/sd-event.h>
-#include <cctype>
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server/manager.hpp>
#include <sdeventplus/event.hpp>
+
+#include <cctype>
#include <string>
#include <utility>
diff --git a/test/ca_certs_manager_test.cpp b/test/ca_certs_manager_test.cpp
index 9043aa3..92b9624 100644
--- a/test/ca_certs_manager_test.cpp
+++ b/test/ca_certs_manager_test.cpp
@@ -2,11 +2,12 @@
#include "bmc-vmi-ca/ca_certs_manager.hpp"
-#include <iterator>
-#include <string>
#include <xyz/openbmc_project/Certs/error.hpp>
#include <xyz/openbmc_project/Common/error.hpp>
+#include <iterator>
+#include <string>
+
#include <gtest/gtest.h>
namespace ca::cert
@@ -21,8 +22,7 @@
public:
MockCACertMgr(sdbusplus::bus_t& bus, const char* path) :
CACertMgr(bus, path)
- {
- }
+ {}
void deleteAll()
{
@@ -51,9 +51,7 @@
class TestCACertMgr : public ::testing::Test
{
public:
- TestCACertMgr() : bus(sdbusplus::bus::new_default())
- {
- }
+ TestCACertMgr() : bus(sdbusplus::bus::new_default()) {}
protected:
sdbusplus::bus_t bus;
@@ -98,7 +96,6 @@
}
TEST_F(TestCACertMgr, DeleteObjectEntry)
{
-
auto bus = sdbusplus::bus::new_default();
std::string objPath = "/xyz/openbmc_project/certs/ca";
MockCACertMgr manager(bus, objPath.c_str());
diff --git a/test/certs_manager_test.cpp b/test/certs_manager_test.cpp
index 9caa9d3..f30abad 100644
--- a/test/certs_manager_test.cpp
+++ b/test/certs_manager_test.cpp
@@ -11,6 +11,11 @@
#include <systemd/sd-event.h>
#include <unistd.h>
+#include <sdbusplus/bus.hpp>
+#include <sdeventplus/event.hpp>
+#include <xyz/openbmc_project/Certs/error.hpp>
+#include <xyz/openbmc_project/Common/error.hpp>
+
#include <cstdint>
#include <cstdio>
#include <cstdlib>
@@ -20,14 +25,10 @@
#include <iterator>
#include <memory>
#include <new>
-#include <sdbusplus/bus.hpp>
-#include <sdeventplus/event.hpp>
#include <string>
#include <unordered_set>
#include <utility>
#include <vector>
-#include <xyz/openbmc_project/Certs/error.hpp>
-#include <xyz/openbmc_project/Common/error.hpp>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@@ -71,9 +72,7 @@
class TestCertificates : public ::testing::Test
{
public:
- TestCertificates() : bus(sdbusplus::bus::new_default())
- {
- }
+ TestCertificates() : bus(sdbusplus::bus::new_default()) {}
void SetUp() override
{
char dirTemplate[] = "/tmp/FakeCerts.XXXXXX";
@@ -218,8 +217,7 @@
phosphor::certs::CSR* csr = nullptr) :
manager(manager),
csr_(csr)
- {
- }
+ {}
void install(std::string& path)
{
manager->install(path);
@@ -260,8 +258,7 @@
const char* path, CertificateType type,
const std::string& unit, const std::string& installPath) :
Manager(bus, event, path, type, unit, installPath)
- {
- }
+ {}
MOCK_METHOD(void, reloadOrReset, (const std::string&), (override));
};
@@ -344,8 +341,8 @@
EXPECT_EQ(certs.front()->subject(), "O=openbmc-project.xyz,CN=localhost");
EXPECT_EQ(certs.front()->issuer(), "O=openbmc-project.xyz,CN=localhost");
- std::string verifyPath =
- verifyDir + "/" + getCertSubjectNameHash(certificateFile) + ".0";
+ std::string verifyPath = verifyDir + "/" +
+ getCertSubjectNameHash(certificateFile) + ".0";
// Check that certificate has been created at installation directory
EXPECT_FALSE(fs::is_empty(verifyDir));
@@ -384,8 +381,8 @@
EXPECT_EQ(certs.front()->validNotBefore(), 0);
EXPECT_EQ(certs.front()->validNotAfter(), 253402300799ULL);
- std::string verifyPath =
- verifyDir + "/" + getCertSubjectNameHash(certificateFile) + ".0";
+ std::string verifyPath = verifyDir + "/" +
+ getCertSubjectNameHash(certificateFile) + ".0";
// Check that certificate has been created at installation directory
EXPECT_FALSE(fs::is_empty(verifyDir));
@@ -422,8 +419,8 @@
EXPECT_FALSE(certs.empty());
// Check that certificate has been created at installation directory
- std::string verifyPath =
- verifyDir + "/" + getCertSubjectNameHash(certificateFile) + ".0";
+ std::string verifyPath = verifyDir + "/" +
+ getCertSubjectNameHash(certificateFile) + ".0";
EXPECT_FALSE(fs::is_empty(verifyDir));
EXPECT_TRUE(fs::exists(verifyPath));
@@ -479,8 +476,8 @@
EXPECT_FALSE(certs.empty());
// Check that certificate has been created at installation directory
- std::string verifyPath0 =
- verifyDir + "/" + getCertSubjectNameHash(certificateFile) + ".0";
+ std::string verifyPath0 = verifyDir + "/" +
+ getCertSubjectNameHash(certificateFile) + ".0";
EXPECT_FALSE(fs::is_empty(verifyDir));
EXPECT_TRUE(fs::exists(verifyPath0));
@@ -497,8 +494,8 @@
EXPECT_EQ(certs.size(), 2);
// Check that certificate has been created at installation directory
- std::string verifyPath1 =
- verifyDir + "/" + getCertSubjectNameHash(certificateFile) + ".1";
+ std::string verifyPath1 = verifyDir + "/" +
+ getCertSubjectNameHash(certificateFile) + ".1";
EXPECT_TRUE(fs::exists(verifyPath1));
// Check that installed cert is identical to input one
@@ -547,8 +544,8 @@
EXPECT_EQ(certs.size(), i + 1);
// Check that certificate has been created at installation directory
- std::string verifyPath =
- verifyDir + "/" + getCertSubjectNameHash(certificateFile) + ".0";
+ std::string verifyPath = verifyDir + "/" +
+ getCertSubjectNameHash(certificateFile) + ".0";
EXPECT_FALSE(fs::is_empty(verifyDir));
EXPECT_TRUE(fs::exists(verifyPath));
@@ -703,8 +700,8 @@
// Certificate successfully installed
EXPECT_FALSE(certs.empty());
- std::string verifyPath =
- verifyDir + "/" + getCertSubjectNameHash(certificateFile) + ".0";
+ std::string verifyPath = verifyDir + "/" +
+ getCertSubjectNameHash(certificateFile) + ".0";
// Check that certificate has been created at installation directory
EXPECT_FALSE(fs::is_empty(verifyDir));
@@ -859,9 +856,7 @@
class TestInvalidCertificate : public ::testing::Test
{
public:
- TestInvalidCertificate() : bus(sdbusplus::bus::new_default())
- {
- }
+ TestInvalidCertificate() : bus(sdbusplus::bus::new_default()) {}
void SetUp() override
{
char dirTemplate[] = "/tmp/FakeCerts.XXXXXX";
@@ -1665,8 +1660,8 @@
std::string name = "root_" + std::to_string(i);
EXPECT_EQ(certs[i]->subject(), "O=openbmc-project.xyz,CN=" + name);
EXPECT_EQ(certs[i]->issuer(), "O=openbmc-project.xyz,CN=" + name);
- std::string symbolLink =
- authoritiesListFolder / (certs[i]->getCertId().substr(0, 8) + ".0");
+ std::string symbolLink = authoritiesListFolder /
+ (certs[i]->getCertId().substr(0, 8) + ".0");
expectedFiles.insert(symbolLink);
expectedFiles.insert(certs[i]->getCertFilePath());
ASSERT_TRUE(fs::exists(symbolLink));
diff --git a/watch.cpp b/watch.cpp
index a39d492..1bfc109 100644
--- a/watch.cpp
+++ b/watch.cpp
@@ -4,17 +4,18 @@
#include <sys/inotify.h>
#include <unistd.h>
+#include <phosphor-logging/elog-errors.hpp>
+#include <phosphor-logging/elog.hpp>
+#include <phosphor-logging/log.hpp>
+#include <sdeventplus/source/io.hpp>
+#include <xyz/openbmc_project/Common/error.hpp>
+
#include <array>
#include <cerrno>
#include <climits>
#include <cstdint>
#include <cstring>
#include <filesystem>
-#include <phosphor-logging/elog-errors.hpp>
-#include <phosphor-logging/elog.hpp>
-#include <phosphor-logging/log.hpp>
-#include <sdeventplus/source/io.hpp>
-#include <xyz/openbmc_project/Common/error.hpp>
namespace phosphor::certs
{
diff --git a/watch.hpp b/watch.hpp
index 2cf34aa..51d67d4 100644
--- a/watch.hpp
+++ b/watch.hpp
@@ -1,8 +1,9 @@
#pragma once
-#include <functional>
-#include <memory>
#include <sdeventplus/source/event.hpp>
#include <sdeventplus/source/io.hpp>
+
+#include <functional>
+#include <memory>
#include <string>
namespace phosphor::certs
diff --git a/x509_utils.cpp b/x509_utils.cpp
index 6173830..7978771 100644
--- a/x509_utils.cpp
+++ b/x509_utils.cpp
@@ -10,16 +10,17 @@
#include <openssl/ssl3.h>
#include <openssl/x509_vfy.h>
-#include <cstdio>
-#include <ctime>
-#include <exception>
-#include <memory>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/log.hpp>
#include <xyz/openbmc_project/Certs/error.hpp>
#include <xyz/openbmc_project/Common/error.hpp>
+#include <cstdio>
+#include <ctime>
+#include <exception>
+#include <memory>
+
namespace phosphor::certs
{