Remove unused code 70/190670/4
authorBartlomiej Grzelewski <b.grzelewski@samsung.com>
Tue, 2 Oct 2018 13:20:57 +0000 (15:20 +0200)
committerBartlomiej Grzelewski <b.grzelewski@samsung.com>
Fri, 5 Oct 2018 16:01:28 +0000 (18:01 +0200)
Change-Id: Ied2d1e0987bdf964c1c1b128fbe07e8eac18ab8b

ta/include/cmd_exec.h
ta/include/km_ta_defines.h
ta/src/cmd_exec.c
ta/src/km_ta.c

index 31028b1677e72a72bc7ad9c60b16fa3512717047..abb5672a13d871b8100d563b0ac41d40bb1f9e1f 100644 (file)
@@ -28,8 +28,6 @@ TEE_Result KM_ExecCmdGenerateKey(TEE_Param param[4]);
 
 TEE_Result KM_ExecCmdGenerateKeyPwd(TEE_Param param[4]);
 
-TEE_Result KM_ExecCmdImportKey(TEE_Param param[4]);
-
 TEE_Result KM_ExecCmdSymmetric(uint32_t commandID, TEE_Param param[4]);
 
 TEE_Result KM_ExecCmdAuth(uint32_t commandID, TEE_Param param[4]);
index 180001069c5cb0d56945aef6b002b9cc7a06ebb0..23202c6dfd6c79e8eb8ad2adf3799cd22112b85f 100644 (file)
@@ -41,19 +41,6 @@ typedef enum {
                             ///<    [1].memref  - reference to serialized buffer:
                             ///<        KM_ParamsSerializeOutData with key id
 
-       CMD_IMPORT_KEY,         ///< Key Manager TA import key from normal world
-                            ///< TA will encrypt key with password if provided
-                            ///< Parameters:
-                            ///<    [0].value.a - algorithm type (tz_algo_type)
-                            ///<    [0].value.b - key size in bits
-                            ///<    [1].memref  - reference to serialized buffer:
-                            ///<        KM_ParamsSerializeInputData with key
-                            ///<        KM_ParamsSerializePwdData with password (optional)
-                            ///< Output:
-                            ///<    [0].value.a - return code
-                            ///<    [2].memref  - reference to serialized buffer:
-                            ///<        KM_ParamsSerializeOutData with key id
-
        CMD_IMPORT_ENCRYPTED_KEY,   ///< Key Manager TA import encrypted key from
                                 ///< normal world. Not implemented
 
index 08f3ffd099171c494853f05f246ae3c6272b539b..29c75f6bc52a19edcf4aede9c4026dca2b6aa2c3 100644 (file)
@@ -347,97 +347,6 @@ clean:
        return ret;
 }
 
-TEE_Result KM_ExecCmdImportKey(TEE_Param param[4])
-{
-       TEE_Result ret = TEE_SUCCESS;
-       TEE_ObjectHandle key = TEE_HANDLE_NULL;
-       TEE_ObjectHandle oldKey = TEE_HANDLE_NULL;
-       KM_SymmetricInput *input = NULL;
-       KM_SymmetricInput *output = NULL;
-       KM_InputData *input_data = NULL;
-       KM_PwdData *pwd_data = NULL;
-
-       uint32_t type = KM_AlgoType2TeeType(param[0].value.a);
-       uint32_t key_bits_size = param[0].value.b;
-       uint32_t tag_size = 0;
-       void *tag = NULL;
-       uint32_t objId_size = KM_KEY_ID_SIZE;
-       uint32_t *objId = (uint32_t*)malloc(objId_size);
-       if (objId == NULL) {
-               LOG("Failed to allocate object ID buffer");
-               ret = TEE_ERROR_OUT_OF_MEMORY;
-               goto clean;
-       }
-
-       if (!KM_CheckAlgoKeySize(type, key_bits_size)) {
-               LOG("Unsupported key size provided: %u", key_bits_size);
-               ret = TEE_ERROR_BAD_PARAMETERS;
-               goto clean;
-       }
-
-       ret = KM_DeserializeInput(param[1].memref.buffer, param[1].memref.size,
-                                                       &input, &input_data, &pwd_data, NULL, NULL, NULL, NULL);
-       if (ret != TEE_SUCCESS) {
-               LOG("Failed to deserialize data from input buffer");
-               ret = TEE_ERROR_BAD_PARAMETERS;
-               goto clean;
-       }
-
-       ret = KM_CreateKey(type, key_bits_size, input_data->data, &key);
-       if (ret != TEE_SUCCESS) {
-               LOG("Failed to create key");
-               goto clean;
-       }
-
-       if (pwd_data != NULL) {
-               oldKey = key;
-
-               tag_size = pwd_data->tag_len_bits / 8;
-               tag = malloc(tag_size);
-               if (tag == NULL) {
-                       LOG("Failed to allocate memory for key's tag");
-                       ret = TEE_ERROR_OUT_OF_MEMORY;
-                       goto clean;
-               }
-
-               ret = KM_EncryptKey(key, pwd_data, &key, tag, &tag_size);
-               if (TEE_SUCCESS != ret) {
-                       LOG("Failed to encrypt new key");
-                       goto clean;
-               }
-       }
-
-       TEE_GenerateRandom(objId, objId_size);
-
-       if (KM_ParamsSerializationInit(param[2].memref.buffer, param[2].memref.size, &output) != 0 ||
-               KM_ParamsSerializeOutData(output, objId, objId_size) != 0) {
-               LOG("Failed to serialize key to output buffer");
-               ret = TEE_ERROR_BAD_PARAMETERS;
-               goto clean;
-       }
-
-       if (tag != NULL) {
-               if (KM_ParamsSerializeTagData(output, tag, tag_size) != 0) {
-                       LOG("Failed to serialize key's tag to output buffer");
-                       ret = TEE_ERROR_BAD_PARAMETERS;
-                       goto clean;
-               }
-       }
-
-       ret = KM_SaveKey(NULL, 0, key, objId, objId_size);
-       if (TEE_SUCCESS != ret) {
-               LOG("Failed to save generated key");
-               goto clean;
-       }
-
-clean:
-       TEE_CloseObject(oldKey);
-       TEE_CloseObject(key);
-       free(objId);
-       free(tag);
-       return ret;
-}
-
 TEE_Result KM_ExecCmdSymmetric(uint32_t commandID, TEE_Param param[4])
 {
        TEE_Result ret = TEE_SUCCESS;
index 64759a0464085ac8d5c8b30481f3225b7c78c569..426db1a29519e48d98ca3ac246e16cde6971a276 100644 (file)
@@ -86,12 +86,6 @@ TEE_Result TA_InvokeCommandEntryPoint(
                ret = KM_ExecCmdGenerateKeyPwd(param);
                break;
        }
-       case CMD_IMPORT_KEY: {
-               LOGD("!!! Import key !!!");
-               LOGD("Alg: %x", param[0].value.a);
-               ret = KM_ExecCmdImportKey(param);
-               break;
-       }
        case CMD_ENCRYPT:
        case CMD_DECRYPT: {
                LOGD("!!! %scrypt !!!", (commandID == CMD_ENCRYPT) ? "En" : "De");