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,7 +585,9 @@ int esp32c3_aes_init(void)
* Name: aes_cypher * Name: aes_cypher
****************************************************************************/ ****************************************************************************/
int esp32c3_aes_cypher(void *out, const void *in, size_t size, #ifdef CONFIG_CRYPTO_AES
int aes_cypher(void *out, const void *in, size_t size,
const void *iv, const void *key, size_t keysize, const void *iv, const void *key, size_t keysize,
int mode, int encrypt) int mode, int encrypt)
{ {
@ -651,3 +653,5 @@ int esp32c3_aes_cypher(void *out, const void *in, size_t size,
return ret; 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); 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 #ifdef __cplusplus
} }
#endif #endif

View File

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