crypto: fix bug in the asymmetric encryption process

(1)uninitialized memory cause release failure
(2)wrong release timing
Signed-off-by: makejian <makejian@xiaomi.com>
This commit is contained in:
makejian 2023-05-16 10:35:59 +08:00 committed by Xiang Xiao
parent e0fa78f8f3
commit a5dc00f941

View File

@ -632,7 +632,7 @@ int cryptodev_key(FAR struct crypt_kop *kop)
return -EINVAL;
}
krp = kmm_malloc(sizeof *krp);
krp = kmm_zalloc(sizeof *krp);
krp->krp_op = kop->crk_op;
krp->krp_status = kop->crk_status;
krp->krp_iparams = kop->crk_iparams;
@ -665,10 +665,6 @@ int cryptodev_key(FAR struct crypt_kop *kop)
}
memcpy(krp->krp_param[i].crp_p, kop->crk_param[i].crp_p, size);
if (error)
{
goto fail;
}
}
error = crypto_kinvoke(krp);