risc-v/esp32c3: Revert aes_cypher name change introduced in #6920

"aes_cypher" is a function from NuttX crypto, so better use instead of
defining a new interface in the driver.

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
This commit is contained in:
Gustavo Henrique Nihei 2022-12-15 19:09:06 -03:00 committed by Petro Karashchenko
parent 632d87ee71
commit 7114cc2978
3 changed files with 13 additions and 22 deletions

View File

@ -585,9 +585,11 @@ int esp32c3_aes_init(void)
* Name: aes_cypher
****************************************************************************/
int esp32c3_aes_cypher(void *out, const void *in, size_t size,
const void *iv, const void *key, size_t keysize,
int mode, int encrypt)
#ifdef CONFIG_CRYPTO_AES
int aes_cypher(void *out, const void *in, size_t size,
const void *iv, const void *key, size_t keysize,
int mode, int encrypt)
{
int ret;
uint8_t iv_buf[AES_BLK_SIZE];
@ -651,3 +653,5 @@ int esp32c3_aes_cypher(void *out, const void *in, size_t size,
return ret;
}
#endif

View File

@ -208,14 +208,6 @@ int esp32c3_aes_xts_setkey(struct esp32c3_aes_xts_s *aes, const void *keyptr,
int esp32c3_aes_init(void);
/****************************************************************************
* Name: aes_cypher
****************************************************************************/
int esp32c3_aes_cypher(void *out, const void *in, size_t size,
const void *iv, const void *key, size_t keysize,
int mode, int encrypt);
#ifdef __cplusplus
}
#endif

View File

@ -445,11 +445,9 @@ static int esp32c3_process(struct cryptop *crp)
switch (data->alg)
{
case CRYPTO_AES_CBC:
err = esp32c3_aes_cypher(crp->crp_dst, crp->crp_buf,
crd->crd_len,
crd->crd_iv, crd->crd_key, 16,
AES_MODE_CBC,
crd->crd_flags & CRD_F_ENCRYPT);
err = aes_cypher(crp->crp_dst, crp->crp_buf, crd->crd_len,
crd->crd_iv, crd->crd_key, 16, AES_MODE_CBC,
crd->crd_flags & CRD_F_ENCRYPT);
if (err < 0)
{
return err;
@ -460,12 +458,9 @@ static int esp32c3_process(struct cryptop *crp)
memcpy(iv, crd->crd_key + crd->crd_klen / 8 - 4, 4);
memcpy(iv + 4, crd->crd_iv, 8);
iv[15] = 0x1;
err = esp32c3_aes_cypher(crp->crp_dst, crp->crp_buf,
crd->crd_len,
iv, crd->crd_key,
crd->crd_klen / 8 - 4,
AES_MODE_CTR ,
crd->crd_flags & CRD_F_ENCRYPT);
err = aes_cypher(crp->crp_dst, crp->crp_buf, crd->crd_len, iv,
crd->crd_key, crd->crd_klen / 8 - 4,
AES_MODE_CTR, crd->crd_flags & CRD_F_ENCRYPT);
if (err < 0)
{
return err;