bmc: abort from verificationStarted

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I649ad1779075ef07908740a1430ca285f856512c
diff --git a/firmware_handler.cpp b/firmware_handler.cpp
index 865c045..03342aa 100644
--- a/firmware_handler.cpp
+++ b/firmware_handler.cpp
@@ -655,10 +655,12 @@
              */
             break;
         case UpdateState::verificationStarted:
-            /* TODO: If they close this blob before verification finishes,
-             * that's an abort.
+            /* Abort without checking to see if it happened to finish. Require
+             * the caller to stat() deliberately.
              */
-            return false;
+            abortVerification();
+            abortProcess();
+            break;
         case UpdateState::verificationCompleted:
             if (lastVerificationStatus == ActionStatus::success)
             {
@@ -723,6 +725,24 @@
     return {};
 }
 
+void FirmwareBlobHandler::abortProcess()
+{
+    /* Closing of open files is handled from close() -- Reaching here from
+     * delete may never be supported.
+     */
+    removeBlobId(verifyBlobId);
+    removeBlobId(updateBlobId);
+    removeBlobId(activeImageBlobId);
+    removeBlobId(activeHashBlobId);
+
+    state = UpdateState::notYetStarted;
+}
+
+void FirmwareBlobHandler::abortVerification()
+{
+    verification->abort();
+}
+
 bool FirmwareBlobHandler::triggerVerification()
 {
     bool result = verification->trigger();