- pass TEEC_Context by reference, not by value.
- print return origin from TEEC_InvokeCommand
Change-Id: Ib26415d0dfb454540c0f0b85d2dc50466f63ae14
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:
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);
}
}
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);
}
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;
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;
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;