Static layout: support image verification
Add support of image verification for static layout PNOR code update.
Tested: Verify the PNOR code update succeeds with valid-signed PNOR;
and fails with invalid-signed PNOR or a PNOR tarball without
signature.
Change-Id: I1aafeb4e8e07eaa16c170f33f4f21940f7c9c146
Signed-off-by: Lei YU <mine260309@gmail.com>
diff --git a/image_verify.hpp b/image_verify.hpp
index 31b5742..0aff4b8 100644
--- a/image_verify.hpp
+++ b/image_verify.hpp
@@ -31,9 +31,6 @@
using EVP_MD_CTX_Ptr =
std::unique_ptr<EVP_MD_CTX, decltype(&::EVP_MD_CTX_free)>;
-// PNOR flash image file name.
-constexpr auto squashFSImage = "pnor.xz.squashfs";
-
/** @struct CustomFd
*
* RAII wrapper for file descriptor.
@@ -133,7 +130,9 @@
* @param[in] signedConfPath - Path of public key
* hash function files
*/
- Signature(const fs::path& imageDirPath, const fs::path& signedConfPath);
+ explicit Signature(const fs::path& imageDirPath,
+ const std::string& pnorFileName,
+ const fs::path& signedConfPath);
/**
* @brief Image signature verification function.
@@ -205,6 +204,9 @@
/** @brief Directory where software images are placed*/
fs::path imageDirPath;
+ /** @brief The PNOR file name in imageDirPath */
+ std::string pnorFileName;
+
/** @brief Path of public key and hash function files */
fs::path signedConfPath;