mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 06:42:32 +08:00
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:
+1
-5
@@ -632,7 +632,7 @@ int cryptodev_key(FAR struct crypt_kop *kop)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
krp = kmm_malloc(sizeof *krp);
|
krp = kmm_zalloc(sizeof *krp);
|
||||||
krp->krp_op = kop->crk_op;
|
krp->krp_op = kop->crk_op;
|
||||||
krp->krp_status = kop->crk_status;
|
krp->krp_status = kop->crk_status;
|
||||||
krp->krp_iparams = kop->crk_iparams;
|
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);
|
memcpy(krp->krp_param[i].crp_p, kop->crk_param[i].crp_p, size);
|
||||||
if (error)
|
|
||||||
{
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
error = crypto_kinvoke(krp);
|
error = crypto_kinvoke(krp);
|
||||||
|
|||||||
Reference in New Issue
Block a user