image-verify: Skip full verify for non-BMC images
The verifyFullImage() only supports verify BMC image, but does not apply
to other images like BIOS.
Skip doing verifyFullImage() for non-BMC images so that it is possible
to do BIOS code update when fieldMode is enabled.
Tested: Verify BIOS update is successful without verification error.
Add related unit test case and verify it passes.
Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: Id9e72367bd2797f7a61c017b61fb81df1dd4d15c
diff --git a/image_verify.hpp b/image_verify.hpp
index 8cda65c..38129f9 100644
--- a/image_verify.hpp
+++ b/image_verify.hpp
@@ -1,5 +1,6 @@
#pragma once
#include "openssl_alloc.hpp"
+#include "version.hpp"
#include <openssl/evp.h>
#include <openssl/pem.h>
@@ -26,6 +27,8 @@
using HashFilePath = fs::path;
using KeyHashPathPair = std::pair<HashFilePath, PublicKeyPath>;
using AvailableKeyTypes = std::set<Key_t>;
+using VersionPurpose =
+ sdbusplus::xyz::openbmc_project::Software::server::Version::VersionPurpose;
// RAII support for openSSL functions.
using BIO_MEM_Ptr = std::unique_ptr<BIO, decltype(&::BIO_free)>;
@@ -218,6 +221,9 @@
/** @brief Hash type defined in mainfest file */
Hash_t hashType;
+ /** @brief The image purpose */
+ VersionPurpose purpose;
+
/** @brief Check and Verify the required image files
*
* @param[in] filePath - BMC tarball file path