Fix TZ backend issues 48/295548/2
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Mon, 10 Jul 2023 15:31:33 +0000 (17:31 +0200)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Tue, 11 Jul 2023 08:06:40 +0000 (08:06 +0000)
* Add missing namespaces
* Include ctx.cpp in TZ source list
* Add missing operation id to internal TZ calls

Change-Id: I59e71b7af5a1c418f797e7d915b8a9d1fc456edf

CMakeLists.txt
src/manager/crypto/sw-backend/ctx.cpp
src/manager/crypto/sw-backend/ctx.h
src/manager/crypto/tz-backend/ctx.cpp
src/manager/crypto/tz-backend/ctx.h

index 6af5d8cbc8d66dc5e9fdbd95509fb44a87d3d053..2ad368e5b5a8c5f8c8a3e3122ea4314e3e58504a 100644 (file)
@@ -84,6 +84,7 @@ IF (TZ_BACKEND_ENABLED)
     SET(TZ_BACKEND_SOURCES
         ${KEY_MANAGER_PATH}/crypto/tz-backend/internals.cpp
         ${KEY_MANAGER_PATH}/crypto/tz-backend/obj.cpp
+        ${KEY_MANAGER_PATH}/crypto/tz-backend/ctx.cpp
         ${KEY_MANAGER_PATH}/crypto/tz-backend/store.cpp
         ${KEY_MANAGER_PATH}/crypto/tz-backend/tz-context.cpp
         ${KEY_MANAGER_PATH}/crypto/tz-backend/tz-memory.cpp
index cffd4f4d9498c2a1dfd6ef59a961ca0479cf0338..1dcf0f7f7bfd21e9e34e9d8521aff98326911cac 100644 (file)
@@ -20,6 +20,7 @@
 
 namespace CKM {
 namespace Crypto {
+namespace SW {
 
 namespace {
 constexpr uint8_t STATE_INITIALIZED = 1;
@@ -109,5 +110,6 @@ RawBuffer CipherCtx::finalize(const RawBuffer& input)
        return tag;
 }
 
+} // namespace SW
 } // namespace Crypto
 } // namespace CKM
index 04f65a3393ccfdb0aab05a22f211ece769c2cfa1..428997f6177cf2a584e86a2a8491ab9a8887cc7b 100644 (file)
@@ -23,6 +23,7 @@
 
 namespace CKM {
 namespace Crypto {
+namespace SW {
 
 class CipherCtx : public GCtx {
 public:
@@ -38,5 +39,6 @@ private:
        uint8_t m_state;
 };
 
+} // namespace SW
 } // namespace Crypto
 } // namespace CKM
index 1fcc80bdc3239bf452553ad9655e541671e7cc8d..db877d8c92fccab224469843e83545253fc6a6e9 100644 (file)
@@ -20,6 +20,7 @@
 
 namespace CKM {
 namespace Crypto {
+namespace TZ {
 
 void CipherCtx::customize(const CryptoAlgorithm& algo)
 {
@@ -32,7 +33,7 @@ void CipherCtx::customize(const CryptoAlgorithm& algo)
 
 RawBuffer CipherCtx::update(const RawBuffer& input)
 {
-       return Internals::updateCipher(input);
+       return Internals::updateCipher(m_opId, input);
 }
 
 RawBuffer CipherCtx::finalize(const RawBuffer& input)
@@ -41,8 +42,9 @@ RawBuffer CipherCtx::finalize(const RawBuffer& input)
         * It is assumed that finalize for GCM encryption will return the GCM tag only.
         * In case of GCM decryption the tag will be passed as finalizeCipher argument.
         */
-       return Internals::finalizeCipher(input);
+       return Internals::finalizeCipher(m_opId, input);
 }
 
+} // namespace TZ
 } // namespace Crypto
 } // namespace CKM
index d12b5ceb308a5ec62f1bb9fdb7ecb4e320ce8cb6..32eba26c838247807548b7edc1d84f931949baa6 100644 (file)
@@ -20,6 +20,7 @@
 
 namespace CKM {
 namespace Crypto {
+namespace TZ {
 
 class CipherCtx : public GCtx {
 public:
@@ -33,5 +34,6 @@ private:
        uint32_t m_opId;
 };
 
+} // namespace TZ
 } // namespace Crypto
 } // namespace CKM