add debug log and fix a bug 07/282607/1
authorisaac2.lee <isaac2.lee@samsung.com>
Thu, 6 Oct 2022 01:17:12 +0000 (10:17 +0900)
committerisaac2.lee <isaac2.lee@samsung.com>
Thu, 6 Oct 2022 08:00:24 +0000 (17:00 +0900)
Change-Id: I35d284cb29ec3bfe53500f4473994ed5c8217e61

src/manager/crypto/se-backend/internals.cpp
src/manager/service/key-provider.cpp

index 4dae68c..bd155a4 100644 (file)
@@ -118,8 +118,9 @@ RawBuffer encryptWithDbpKey(const unsigned char* key, const uint32_t key_len,
                                                const unsigned char* iv, const uint32_t iv_len)
 {
 
-       unsigned char* output_data;
-       uint32_t output_len;
+       unsigned char* output_data = NULL;
+       uint32_t output_len = 0;
+       LogDebug("DBP Key will be encrypted on SE backend");
 
        int ret = kmsb_failure_retry(std::bind(kmsb_encrypt_with_dbp_key,
                                                                SE_BACKEND_DBP_SCHEME_VERSION,
index c35b775..66a5dae 100644 (file)
@@ -141,7 +141,7 @@ KeyData makePKEK1(const KeyComponentsInfoDKEK& keyInfo, const Password &password
 #if SE_BACKEND_ENABLED
        RawBuffer salt;
        if (keyInfo.backend == (int)CryptoBackend::SecureElement) {
-               RawBuffer salt = Crypto::SE::Internals::encryptWithDbpKey((unsigned char*)keyInfo.salt, MAX_SALT_SIZE,
+               salt = Crypto::SE::Internals::encryptWithDbpKey((unsigned char*)keyInfo.salt, MAX_SALT_SIZE,
                                                                                (unsigned char*)keyInfo.iv, MAX_IV_SIZE);
        } else {
                salt = RawBuffer(keyInfo.salt, keyInfo.salt + MAX_SALT_SIZE);