bmc: enable configuration of all verification
Enable verification configuration beyond the result file check. This
patchset allows a developer to provide their own verification mechanisms
by implementing an interface and adding configuration to enable using
their custom version.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Iba5d4be75bb49d9c4ab84be8578f0306c15b5be9
diff --git a/firmware_handler.hpp b/firmware_handler.hpp
index 3467ccd..88cb957 100644
--- a/firmware_handler.hpp
+++ b/firmware_handler.hpp
@@ -5,24 +5,12 @@
#include "data_handler.hpp"
#include "image_handler.hpp"
#include "util.hpp"
+#include "verify.hpp"
#include <blobs-ipmid/blobs.hpp>
#include <cstdint>
#include <map>
#include <memory>
-#if HAVE_SDBUSPLUS
-#include <sdbusplus/bus.hpp>
-#else
-namespace sdbusplus
-{
-namespace bus
-{
-class bus
-{
-};
-} // namespace bus
-} // namespace sdbusplus
-#endif
#include <string>
#include <vector>
@@ -111,48 +99,37 @@
verificationCompleted,
};
- /** The return values for verification. */
- enum class VerifyCheckResponses : std::uint8_t
- {
- running = 0,
- success = 1,
- failed = 2,
- other = 3,
- };
-
/**
* Create a FirmwareBlobHandler.
*
- * @param[in] bus - an sdbusplus handler for a bus to use.
* @param[in] firmwares - list of firmware blob_ids to support.
* @param[in] transports - list of transports to support.
- * @param[in[ verificationPath - path to check for verification output
+ * @param[in] verification - pointer to object for triggering verification
*/
static std::unique_ptr<GenericBlobInterface> CreateFirmwareBlobHandler(
- sdbusplus::bus::bus&& bus, const std::vector<HandlerPack>& firmwares,
+ const std::vector<HandlerPack>& firmwares,
const std::vector<DataHandlerPack>& transports,
- const std::string& verificationPath);
+ std::unique_ptr<VerificationInterface> verification);
/**
* Create a FirmwareBlobHandler.
*
- * @param[in] bus - an sdbusplus handler for a bus to use
* @param[in] firmwares - list of firmware types and their handlers
* @param[in] blobs - list of blobs_ids to support
* @param[in] transports - list of transport types and their handlers
* @param[in] bitmask - bitmask of transports to support
+ * @param[in] verification - pointer to object for triggering verification
*/
- FirmwareBlobHandler(sdbusplus::bus::bus&& bus,
- const std::vector<HandlerPack>& firmwares,
+ FirmwareBlobHandler(const std::vector<HandlerPack>& firmwares,
const std::vector<std::string>& blobs,
const std::vector<DataHandlerPack>& transports,
std::uint16_t bitmask,
- const std::string& verificationPath) :
- bus(std::move(bus)),
- handlers(firmwares), blobIDs(blobs), transports(transports),
- bitmask(bitmask), activeImage(activeImageBlobId),
- activeHash(activeHashBlobId), verifyImage(verifyBlobId), lookup(),
- state(UpdateState::notYetStarted), verificationPath(verificationPath)
+ std::unique_ptr<VerificationInterface> verification) :
+ handlers(firmwares),
+ blobIDs(blobs), transports(transports), bitmask(bitmask),
+ activeImage(activeImageBlobId), activeHash(activeHashBlobId),
+ verifyImage(verifyBlobId), lookup(), state(UpdateState::notYetStarted),
+ verification(std::move(verification))
{
}
~FirmwareBlobHandler() = default;
@@ -187,8 +164,6 @@
};
private:
- sdbusplus::bus::bus bus;
-
/** List of handlers by type. */
std::vector<HandlerPack> handlers;
@@ -216,7 +191,7 @@
/** The firmware update state. */
UpdateState state;
- const std::string verificationPath;
+ std::unique_ptr<VerificationInterface> verification;
/** Temporary variable to track whether a blob is open. */
bool fileOpen = false;