Pass key length to KBKDF in TZ backend 50/296150/2
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Thu, 20 Jul 2023 12:20:20 +0000 (14:20 +0200)
committerDongsun Lee <ds73.lee@samsung.com>
Thu, 20 Jul 2023 23:58:29 +0000 (08:58 +0900)
Change-Id: I5cd90b8754b7aa89371e515ffac79cd35c9b5004

src/manager/crypto/tz-backend/internals.cpp
src/manager/crypto/tz-backend/tz-context.cpp
src/manager/crypto/tz-backend/tz-context.h

index d0cc232..5a19cba 100644 (file)
@@ -810,6 +810,8 @@ void deriveKBKDF(const RawBuffer &secretId,
                                 const RawBuffer &keyHash)
 {
        RawBuffer label, context, fixed;
+       size_t length;
+       alg.getParam(ParamName::KDF_LEN, length);
        alg.getParam(ParamName::KBKDF_LABEL, label);
        alg.getParam(ParamName::KBKDF_CONTEXT, context);
        alg.getParam(ParamName::KBKDF_FIXED_INPUT, fixed);
@@ -826,6 +828,7 @@ void deriveKBKDF(const RawBuffer &secretId,
 
        TrustZoneContext::Instance().executeKbkdf(secretId,
                                                                                          secretPwd,
+                                                                                         length,
                                                                                          label,
                                                                                          context,
                                                                                          fixed,
index ad09c65..a457462 100644 (file)
@@ -891,6 +891,7 @@ void TrustZoneContext::executeEcdh(const RawBuffer &prvKeyId,
 
 void TrustZoneContext::executeKbkdf(const RawBuffer& secretId,
                                                                        const Pwd& secretPwd,
+                                                                       size_t length,
                                                                        const RawBuffer& label,
                                                                        const RawBuffer& context,
                                                                        const RawBuffer& fixed,
@@ -910,6 +911,7 @@ void TrustZoneContext::executeKbkdf(const RawBuffer& secretId,
 
        auto sIn = makeSerializer(secretId,
                                                          secretPwd,
+                                                         length,
                                                          label,
                                                          context,
                                                          fixed,
index 015b44b..51f9be1 100644 (file)
@@ -184,6 +184,7 @@ public:
 
        void executeKbkdf(const RawBuffer& secretId,
                                          const Pwd& secretPwd,
+                                         size_t length,
                                          const RawBuffer& label,
                                          const RawBuffer& context,
                                          const RawBuffer& fixed,