if (output_cert)
ckmc_cert_free(output_cert);
- if (err != EMAIL_ERROR_NONE) {
+ if (err != EMAIL_ERROR_NONE)
EM_SAFE_FREE(p_cert_data);
- }
EM_DEBUG_FUNC_END();
return err;
FINISH_OFF:
- if (email_key != NULL) {
+ if (email_key != NULL)
ckmc_key_free(email_key);
- }
-
EM_SAFE_FREE(alias);
INTERNAL_FUNC int emcore_encryption_data_in_key_manager(const char *data_name, char *input_data, int input_length, unsigned char **output_data, int *output_length)
{
EM_DEBUG_FUNC_BEGIN();
+ char *alias = NULL;
int err = EMAIL_ERROR_NONE;
int ckmc_ret = CKMC_ERROR_NONE;
ckmc_ret = ckmc_generate_new_params(CKMC_ALGO_AES_CBC, ¶ms);
if (ckmc_ret != CKMC_ERROR_NONE) {
-
EM_DEBUG_LOG("ckmc_generate_new_params failed");
err = EMAIL_ERROR_KEY_MANAGER_FAILURE;
return err;
-
}
ckmc_ret = ckmc_param_list_set_buffer(params, CKMC_PARAM_ED_IV, &iv_buffer);
if (ckmc_ret != CKMC_ERROR_NONE) {
-
EM_DEBUG_LOG("ckmc_param_list_set_buffer failed");
err = EMAIL_ERROR_KEY_MANAGER_FAILURE;
- EM_SAFE_FREE(params);
- return err;
-
+ goto FINISH_OFF;
}
- char *alias = __get_key_manager_alias(data_name);
+ alias = __get_key_manager_alias(data_name);
ckmc_ret = ckmc_encrypt_data(params, alias, NULL, plaintext, &encrypted);
if (ckmc_ret != CKMC_ERROR_NONE) {
-
EM_DEBUG_LOG("ckmc_encrypt_data failed");
err = EMAIL_ERROR_KEY_MANAGER_FAILURE;
goto FINISH_OFF;
-
}
*output_data = encrypted->data;
if (encrypted->data != NULL)
encrypted->data = NULL;
-
-
-
-
FINISH_OFF:
if (encrypted != NULL)
if (params != NULL)
ckmc_param_list_free(params);
-
-
EM_SAFE_FREE(alias);
EM_DEBUG_FUNC_END();
return err;