X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fmanager%2Fcrypto%2Ftz-backend%2Ftz-context.cpp;h=8710982146a30d6e223ba7e29ae7381cd09f38a2;hb=be88a910febc394cfb434103c1a306e8ff5f45ea;hp=2c013aee7f964ae0263d1d12cfba9bfb08b4f6a8;hpb=8a54921eda17972b09813e2b3822d0ebfab0dd01;p=platform%2Fcore%2Fsecurity%2Fkey-manager.git diff --git a/src/manager/crypto/tz-backend/tz-context.cpp b/src/manager/crypto/tz-backend/tz-context.cpp index 2c013ae..8710982 100644 --- a/src/manager/crypto/tz-backend/tz-context.cpp +++ b/src/manager/crypto/tz-backend/tz-context.cpp @@ -746,7 +746,8 @@ RawBuffer TrustZoneContext::exportWrappedKey(const RawBuffer &wrappingKeyId, 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"); @@ -758,19 +759,20 @@ RawBuffer TrustZoneContext::exportWrappedKey(const RawBuffer &wrappingKeyId, 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); @@ -786,12 +788,14 @@ RawBuffer TrustZoneContext::exportWrappedKey(const RawBuffer &wrappingKeyId, 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); @@ -803,17 +807,18 @@ void TrustZoneContext::GetDataSize(const RawBuffer &dataId, uint32_t &dataSize) 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 << "]");