Signature validation failure handling based on field mode

Added support to stop the codeupdate only for the fieldmode
enabled systems, for signature validation failures.

Change-Id: Icaea4c7c80eca42a22794bbb67d93b8a95058ab8
Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
diff --git a/activation.cpp b/activation.cpp
index 34ff2b2..ee0bcf8 100644
--- a/activation.cpp
+++ b/activation.cpp
@@ -9,7 +9,6 @@
 #include <phosphor-logging/elog-errors.hpp>
 #include <xyz/openbmc_project/Common/error.hpp>
 #include "image_verify.hpp"
-#include "config.h"
 #endif
 
 namespace phosphor
@@ -26,6 +25,7 @@
 #ifdef WANT_SIGNATURE_VERIFY
 using InternalFailure =
     sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
+namespace control = sdbusplus::xyz::openbmc_project::Control::server;
 #endif
 
 void Activation::subscribeToSystemdSignals()
@@ -86,8 +86,16 @@
                 log<level::ERR>("Error occurred during image validation");
                 report<InternalFailure>();
 
-                return softwareServer::Activation::activation(
-                    softwareServer::Activation::Activations::Failed);
+                // Stop the activation process, if fieldMode is enabled.
+                if (parent.control::FieldMode::fieldModeEnabled())
+                {
+                    // Cleanup
+                    activationBlocksTransition.reset(nullptr);
+                    activationProgress.reset(nullptr);
+
+                    return softwareServer::Activation::activation(
+                        softwareServer::Activation::Activations::Failed);
+                }
             }
 #endif