Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions wolfcrypt/src/port/nxp/hashcrypt_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,15 @@ static int _hashcrypt_set_key(Aes* aes)
#ifdef HAVE_AES_ECB
int wc_AesEcbEncrypt(Aes* aes, byte* out, const byte* in, word32 sz)
{
int ret = _hashcrypt_set_key(aes);
int ret;

if (aes == NULL || out == NULL || in == NULL)
return BAD_FUNC_ARG;

if (sz == 0)
return 0;

ret = _hashcrypt_set_key(aes);
Comment on lines +219 to +222
if (ret)
return ret;

Expand All @@ -226,8 +233,15 @@ int wc_AesEcbEncrypt(Aes* aes, byte* out, const byte* in, word32 sz)
#ifdef HAVE_AES_DECRYPT
int wc_AesEcbDecrypt(Aes* aes, byte* out, const byte* in, word32 sz)
{
int ret = _hashcrypt_set_key(aes);
int ret;

if (aes == NULL || out == NULL || in == NULL)
return BAD_FUNC_ARG;

if (sz == 0)
return 0;

ret = _hashcrypt_set_key(aes);
if (ret)
return ret;

Expand All @@ -243,8 +257,15 @@ int wc_AesEcbDecrypt(Aes* aes, byte* out, const byte* in, word32 sz)
#ifdef HAVE_AES_CBC
int wc_AesCbcEncrypt(Aes* aes, byte* out, const byte* in, word32 sz)
{
int ret = _hashcrypt_set_key(aes);
int ret;

if (aes == NULL || out == NULL || in == NULL)
return BAD_FUNC_ARG;

if (sz == 0)
return 0;

ret = _hashcrypt_set_key(aes);
if (ret)
return ret;

Expand All @@ -264,6 +285,12 @@ int wc_AesCbcDecrypt(Aes* aes, byte* out, const byte* in, word32 sz)
int ret;
byte tmp_iv[16];

if (aes == NULL || out == NULL || in == NULL)
return BAD_FUNC_ARG;

if (sz == 0)
return 0;

ret = _hashcrypt_set_key(aes);
if (ret)
return ret;
Expand Down
Loading