return -ENODEV;
}
fmp = info->fmp;
-
memset(out, 0, sizeof(*out));
if (!strcmp(alg_name, "cbc(aes-fmp)"))
info->data->ci.algo_mode = EXYNOS_FMP_ALGO_MODE_AES_XTS;
else {
dev_err(fmp->dev, "%s: Invalid mode\n", __func__);
- ret = -EINVAL;
- goto err;
- }
- if (ret) {
- dev_err(fmp->dev, "%s: Fail to init fmp cipher\n", __func__);
- goto err;
+ return -EINVAL;
}
out->blocksize = 16;
ret = fmp_fips_set_key(fmp, info, enckey, twkey, key_len);
if (ret) {
dev_err(fmp->dev, "%s: Fail to set fmp key\n", __func__);
- goto err;
+ return ret;
}
out->init = 1;
-err:
return ret;
}
Pt[k] = kzalloc(nbytes, GFP_KERNEL);
if (!Pt[k]) {
ret = -ENOMEM;
- goto out_err_mem_pt_k;
+ goto out_err_mem_ct;
}
}
Ct[k] = kzalloc(nbytes, GFP_KERNEL);
if (!Ct[k]) {
ret = -ENOMEM;
- goto out_err_mem_ct_k;
+ goto out_err_fail;
}
}
out_err_fail:
for (k = 0; k < 1000; k++)
kzfree(Ct[k]);
-out_err_mem_ct_k:
kzfree(Ct);
out_err_mem_ct:
for (k = 0; k < 1000; k++)
kzfree(Pt[k]);
-out_err_mem_pt_k:
kzfree(Pt);
out_err_mem_pt:
free_page((unsigned long)data);
if (!fmp->test_data) {
dev_err(fmp->dev, "Invalid fips data\n");
- return -EINVAL;
+ ret = -EINVAL;
+ goto error_cipher;
}
/* Set-up crypto transform. */
if (!fmp || !fmp->dev) {
pr_err("%s: Invalid fmp driver\n", __func__);
- ret = -EINVAL;
- goto err;
+ return -EINVAL;
}
dev_info(fmp->dev, "fmp fips driver name : %s\n", dev_name(fmp->dev));
err:
if (info)
fmp_test_exit(info->data);
+ kfree(info);
return ret;
}