Add compiler flags for build warnings 83/297483/2
authorDongsun Lee <ds73.lee@samsung.com>
Mon, 21 Aug 2023 00:30:22 +0000 (09:30 +0900)
committerDong Sun Lee <ds73.lee@samsung.com>
Mon, 4 Sep 2023 23:44:28 +0000 (23:44 +0000)
- Additionally, remove unused variables.

Change-Id: I7913fe13381151b24e1d3e6ecfbcd175bcd2c1a9

CMakeLists.txt
ta/src/cmd_exec.c

index 46b3b66535c1518e3f41178f54d43fc59eacfa2d..94b851a829d5e1f4a74d50de5a239a65b7919c99 100644 (file)
@@ -31,6 +31,10 @@ IF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
     ADD_DEFINITIONS("-DBUILD_TYPE_DEBUG")
 ENDIF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
 
+# Set compiler warning flags
+ADD_DEFINITIONS("-Werror")                      # Make all warnings into errors.
+ADD_DEFINITIONS("-Wall")                        # Generate all warnings
+ADD_DEFINITIONS("-Wextra")                      # Generate even more extra warnings
 
 INCLUDE_DIRECTORIES(
     ${KEY_MANAGER_TA_PATH}/include
index 5f96f85da7e9222c93df9074cd5d49b04462f790..bb0847154268125052357f1e7e00fad1368fadd1 100644 (file)
@@ -1313,7 +1313,6 @@ static TEE_Result KM_DoCipherWrappedKeyWithAesGcm(TEE_ObjectHandle wkey,
        void *out = NULL;
        uint32_t out_buff_size = 0; // output + tag
        uint32_t out_size = 0;
-       uint32_t tmp_size = 0;
 
        ret = KM_CreateOperation(wkey, tee_algo, tee_enc_mode, &operation);
        if (TEE_SUCCESS != ret) {
@@ -1382,7 +1381,6 @@ clean:
 static TEE_Result KM_DoCipherWrappedKeyWithAes(TEE_ObjectHandle wkey,
                                                                                uint32_t algo, uint32_t tee_enc_mode,
                                                                                KM_BinaryData *iv,
-                                                                               uint32_t ctr_len,
                                                                                KM_BinaryData *input,
                                                                                KM_BinaryData *output)
 {
@@ -1580,7 +1578,7 @@ TEE_Result KM_ExecCmdImportWrappedKey(TEE_Param param[4])
        } else if (algo == ALGO_AES_GCM) {
                ret = KM_DoCipherWrappedKeyWithAesGcm(wkey, algo, tee_enc_mode, &iv, &aad, ctr_len_or_tag_size_bits, &enc_key, &ekey_data);
        } else {
-               ret = KM_DoCipherWrappedKeyWithAes(wkey, algo, tee_enc_mode, &iv, ctr_len_or_tag_size_bits, &enc_key, &ekey_data);
+               ret = KM_DoCipherWrappedKeyWithAes(wkey, algo, tee_enc_mode, &iv, &enc_key, &ekey_data);
        }
        if (TEE_SUCCESS != ret) {
                LOG("Failed to decrypt a key for unwrapping. ret=%x", ret);
@@ -1721,7 +1719,7 @@ TEE_Result KM_ExecCmdExportWrappedKey(TEE_Param param[4])
        } else if (algo == ALGO_AES_GCM) {
                ret = KM_DoCipherWrappedKeyWithAesGcm(wkey, algo, tee_enc_mode, &iv, &aad, ctr_len_or_tag_size_bits, &ktw_data, &wrapped_key);
        } else {
-               ret = KM_DoCipherWrappedKeyWithAes(wkey, algo, tee_enc_mode, &iv, ctr_len_or_tag_size_bits, &ktw_data, &wrapped_key);
+               ret = KM_DoCipherWrappedKeyWithAes(wkey, algo, tee_enc_mode, &iv, &ktw_data, &wrapped_key);
        }
        if (TEE_SUCCESS != ret) {
                LOG("Failed to encrypt a key for wrapping. ret=%x", ret);