diff options
author | r.tyminski <r.tyminski@partner.samsung.com> | 2018-04-26 15:23:53 +0200 |
---|---|---|
committer | Krzysztof Jackiewicz <k.jackiewicz@samsung.com> | 2018-10-12 12:33:19 +0000 |
commit | c15f6c7133f96ebf9cc108444aed8d9f5c9edb41 (patch) | |
tree | 72699448516d8a4874b5ca9586f015f1efefce34 | |
parent | faaf6d04916cb32e9358afa4861646a6fa273494 (diff) | |
download | key-manager-c15f6c7133f96ebf9cc108444aed8d9f5c9edb41.tar.gz key-manager-c15f6c7133f96ebf9cc108444aed8d9f5c9edb41.tar.bz2 key-manager-c15f6c7133f96ebf9cc108444aed8d9f5c9edb41.zip |
Some TZ backend fixes.
- pass TEEC_Context by reference, not by value.
- print return origin from TEEC_InvokeCommand
Change-Id: Ib26415d0dfb454540c0f0b85d2dc50466f63ae14
-rw-r--r-- | src/manager/crypto/tz-backend/tz-context.cpp | 6 | ||||
-rw-r--r-- | src/manager/crypto/tz-backend/tz-memory.cpp | 4 | ||||
-rw-r--r-- | src/manager/crypto/tz-backend/tz-memory.h | 4 |
3 files changed, 8 insertions, 6 deletions
diff --git a/src/manager/crypto/tz-backend/tz-context.cpp b/src/manager/crypto/tz-backend/tz-context.cpp index 83ac694..c6f2527 100644 --- a/src/manager/crypto/tz-backend/tz-context.cpp +++ b/src/manager/crypto/tz-backend/tz-context.cpp @@ -997,9 +997,10 @@ void TrustZoneContext::Reload() void TrustZoneContext::Execute(tz_command commandID, TEEC_Operation* op) { + uint32_t retOrigin = 0; LogDebug("Executing TZ operation " << commandID); - TEEC_Result result = TEEC_InvokeCommand(&m_Session, static_cast<unsigned int>(commandID), op, NULL); + TEEC_Result result = TEEC_InvokeCommand(&m_Session, static_cast<unsigned int>(commandID), op, &retOrigin); if (result != TEEC_SUCCESS) { switch (result) { case TEEC_ERROR_TARGET_DEAD: @@ -1011,7 +1012,8 @@ void TrustZoneContext::Execute(tz_command commandID, TEEC_Operation* op) default: ThrowErr(Exc::Crypto::InternalError, "TA failed to invoke command ", static_cast<unsigned int>(commandID), " with error: ", std::hex, - static_cast<unsigned int>(result)); + static_cast<unsigned int>(result), " with origin: ", std::hex, + retOrigin); } } diff --git a/src/manager/crypto/tz-backend/tz-memory.cpp b/src/manager/crypto/tz-backend/tz-memory.cpp index 1f76e41..324463d 100644 --- a/src/manager/crypto/tz-backend/tz-memory.cpp +++ b/src/manager/crypto/tz-backend/tz-memory.cpp @@ -31,7 +31,7 @@ namespace Crypto { namespace TZ { namespace Internals { -TrustZoneMemory::TrustZoneMemory(TEEC_Context context, const size_t size, const uint32_t flags) +TrustZoneMemory::TrustZoneMemory(TEEC_Context &context, const size_t size, const uint32_t flags) { Allocate(context, size, flags); } @@ -41,7 +41,7 @@ TrustZoneMemory::~TrustZoneMemory() Release(); } -void TrustZoneMemory::Allocate(TEEC_Context context, const size_t size, const uint32_t flags) +void TrustZoneMemory::Allocate(TEEC_Context &context, const size_t size, const uint32_t flags) { m_SharedMemory.size = size; m_SharedMemory.flags = flags; diff --git a/src/manager/crypto/tz-backend/tz-memory.h b/src/manager/crypto/tz-backend/tz-memory.h index e4f559c..74e505c 100644 --- a/src/manager/crypto/tz-backend/tz-memory.h +++ b/src/manager/crypto/tz-backend/tz-memory.h @@ -32,7 +32,7 @@ namespace Internals { class TrustZoneMemory final { public: - TrustZoneMemory(TEEC_Context context, const size_t size, const uint32_t flags); + TrustZoneMemory(TEEC_Context &context, const size_t size, const uint32_t flags); TrustZoneMemory(const TrustZoneMemory&) = delete; TrustZoneMemory(TrustZoneMemory &&) = delete; TrustZoneMemory& operator=(const TrustZoneMemory&) = delete; @@ -42,7 +42,7 @@ public: TEEC_SharedMemory* Get() const; private: - void Allocate(TEEC_Context context, const size_t size, const uint32_t flags); + void Allocate(TEEC_Context &context, const size_t size, const uint32_t flags); void Release(); mutable TEEC_SharedMemory m_SharedMemory; |