firmware: add verify blob_id
Add verification blob_id into the blob list. This blob_id will require
special handling in a few actions to be added later.
Goal behavior:
- on open, if all others closed, allows open (now only one of 3 can be
opened at once).
- on commit, starts verification process.
- on close, clears out any outstanding state (but doesn't abort
anything).
- on delete, returns failure.
Change-Id: Ifc759c1051cf1748624ccdb5f7dda0a9ea1681d4
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/firmware_handler.hpp b/firmware_handler.hpp
index c87e635..36faa05 100644
--- a/firmware_handler.hpp
+++ b/firmware_handler.hpp
@@ -75,6 +75,9 @@
lpc = (1 << 10), /* Expect to send contents over LPC bridge. */
};
+ /* TODO: All of the states may not be required - if we add abort() commands
+ * appropriately.
+ */
/** The state of the firmware update process. */
enum UpdateState
{
@@ -123,8 +126,8 @@
std::uint16_t bitmask) :
handlers(firmwares),
blobIDs(blobs), transports(transports), bitmask(bitmask),
- activeImage(activeImageBlobID), activeHash(activeHashBlobID), lookup(),
- state(UpdateState::notYetStarted)
+ activeImage(activeImageBlobID), activeHash(activeHashBlobID),
+ verifyImage(verifyBlobID), lookup(), state(UpdateState::notYetStarted)
{
}
~FirmwareBlobHandler() = default;
@@ -150,6 +153,9 @@
bool stat(uint16_t session, struct BlobMeta* meta) override;
bool expire(uint16_t session) override;
+ bool triggerVerification();
+
+ static const std::string verifyBlobID;
static const std::string hashBlobID;
static const std::string activeImageBlobID;
static const std::string activeHashBlobID;
@@ -179,6 +185,9 @@
/** Active hash session. */
Session activeHash;
+ /** Session for verification. */
+ Session verifyImage;
+
/** A quick method for looking up a session's mechanisms and details. */
std::map<std::uint16_t, Session*> lookup;