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 6af5d8c..2ad368e 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 cffd4f4..1dcf0f7 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 04f65a3..428997f 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 1fcc80b..db877d8 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 d12b5ce..32eba26 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