Fix unwrap concatenated 51/323151/2
authorJakub Wlostowski <j.wlostowski@samsung.com>
Wed, 23 Apr 2025 10:11:56 +0000 (12:11 +0200)
committerJakub Wlostowski <j.wlostowski@samsung.com>
Wed, 23 Apr 2025 14:37:07 +0000 (16:37 +0200)
Change-Id: Ia4774163f4870488be9c0427a9a7aa70da62dad5

src/hal-backend-security-keys-api.cpp

index 664f08d3048fe762705c81fc97e017abe38bdf45..30a0883dc21b49280907c4e9c8f0a89348f2b57f 100644 (file)
@@ -1098,12 +1098,11 @@ int security_keys_unwrap_concatenated_data(const hal_security_keys_context_s con
        s_in.Serialize(in_memory);
 
        TZSerializer s_out;
-       uint32_t out_memory_size = KM_RSA_BLOCK_SIZE;
+       s_out.Push(new TZSerializableBinary(KM_RSA_BLOCK_SIZE, false));
        bool with_pwd = !key_pwd.password.buffer ? 0 : 1;
        if (with_pwd)
-               out_memory_size += Params::DEFAULT_AES_GCM_TAG_LEN_BYTES;
+               s_out.Push(new TZSerializableBinary(Params::DEFAULT_AES_GCM_TAG_LEN_BYTES));
 
-       s_out.Push(new TZSerializableBinary(out_memory_size, false));
        TrustZoneMemory out_memory(*tz_context, s_out.GetSize(), TEEC_MEM_OUTPUT);
        s_out.Serialize(out_memory);