const uint32_t ctrLenOrTagSizeBits,
const RawBuffer &aad,
const RawBuffer &keyToWrapId,
- const Pwd &keyToWrapPwd)
+ const Pwd &keyToWrapPwd,
+ tz_data_type keyToWrapType)
{
// command ID = CMD_EXPORT_WRAPPED_KEY
LogDebug("TrustZoneContext::exportWrappedKey");
ctrLenOrTagSizeBits,
aad,
keyToWrapId,
- keyToWrapPwd);
+ keyToWrapPwd,
+ keyToWrapType);
TrustZoneMemory inMemory(m_Context, sIn.GetSize(), TEEC_MEM_INPUT);
sIn.Serialize(inMemory);
- uint32_t data_size = 0;
- GetDataSize(keyToWrapId, data_size);
+ uint32_t dataSize = 0;
+ GetDataSize(keyToWrapId, keyToWrapType, dataSize);
- LogDebug("GetData data_size = [" << data_size << "]");
+ LogDebug("GetData data_size = [" << dataSize << "]");
// encrypted data may be longer
TZSerializer sOut;
- sOut.Push(new TZSerializableBinary(data_size + KM_ENCRYPTION_OVERHEAD));
+ sOut.Push(new TZSerializableBinary(dataSize + KM_ENCRYPTION_OVERHEAD));
TrustZoneMemory outMemory(m_Context, sOut.GetSize(), TEEC_MEM_OUTPUT);
sOut.Serialize(outMemory);
return wrappedKey;
}
-void TrustZoneContext::GetDataSize(const RawBuffer &dataId, uint32_t &dataSize)
+void TrustZoneContext::GetDataSize(const RawBuffer &dataId,
+ const tz_data_type type,
+ uint32_t &dataSize)
{
// command ID = CMD_GET_DATA_SIZE
LogDebug("Object ID (passed to CMD_GET_DATA_SIZE) is (hex): " << rawToHexString(dataId));
- auto sIn = makeSerializer(dataId);
+ auto sIn = makeSerializer(dataId, type);
TrustZoneMemory inMemory(m_Context, sIn.GetSize(), TEEC_MEM_INPUT);
sIn.Serialize(inMemory);
void TrustZoneContext::getData(const RawBuffer &dataId,
const Pwd &pwd,
+ const tz_data_type type,
RawBuffer &data)
{
// command ID = CMD_GET_DATA
LogDebug("Object ID (passed to CMD_GET_DATA) is (hex): " << rawToHexString(dataId));
- auto sIn = makeSerializer(dataId, pwd);
+ auto sIn = makeSerializer(dataId, pwd, type);
TrustZoneMemory inMemory(m_Context, sIn.GetSize(), TEEC_MEM_INPUT);
sIn.Serialize(inMemory);
uint32_t data_size = 0;
- GetDataSize(dataId, data_size);
+ GetDataSize(dataId, type, data_size);
LogDebug("GetData data_size = [" << data_size << "]");