Add crypto callback AES CCM test case.

This commit is contained in:
David Garske
2021-11-15 16:22:10 -08:00
parent 82c106be80
commit 1559e92dca

View File

@ -38022,6 +38022,48 @@ static int myCryptoDevCb(int devIdArg, wc_CryptoInfo* info, void* ctx)
} }
} }
#endif /* HAVE_AES_CBC */ #endif /* HAVE_AES_CBC */
#if defined(HAVE_AESCCM) && defined(WOLFSSL_AES_128)
if (info->cipher.type == WC_CIPHER_AES_CCM) {
if (info->cipher.enc) {
/* set devId to invalid, so software is used */
info->cipher.aesccm_enc.aes->devId = INVALID_DEVID;
ret = wc_AesCcmEncrypt(
info->cipher.aesccm_enc.aes,
info->cipher.aesccm_enc.out,
info->cipher.aesccm_enc.in,
info->cipher.aesccm_enc.sz,
info->cipher.aesccm_enc.nonce,
info->cipher.aesccm_enc.nonceSz,
info->cipher.aesccm_enc.authTag,
info->cipher.aesccm_enc.authTagSz,
info->cipher.aesccm_enc.authIn,
info->cipher.aesccm_enc.authInSz);
/* reset devId */
info->cipher.aesccm_enc.aes->devId = devIdArg;
}
else {
/* set devId to invalid, so software is used */
info->cipher.aesccm_dec.aes->devId = INVALID_DEVID;
ret = wc_AesCcmDecrypt(
info->cipher.aesccm_dec.aes,
info->cipher.aesccm_dec.out,
info->cipher.aesccm_dec.in,
info->cipher.aesccm_dec.sz,
info->cipher.aesccm_dec.nonce,
info->cipher.aesccm_dec.nonceSz,
info->cipher.aesccm_dec.authTag,
info->cipher.aesccm_dec.authTagSz,
info->cipher.aesccm_dec.authIn,
info->cipher.aesccm_dec.authInSz);
/* reset devId */
info->cipher.aesccm_dec.aes->devId = devIdArg;
}
}
#endif
#ifndef NO_DES3 #ifndef NO_DES3
if (info->cipher.type == WC_CIPHER_DES3) { if (info->cipher.type == WC_CIPHER_DES3) {
if (info->cipher.enc) { if (info->cipher.enc) {
@ -38245,6 +38287,10 @@ WOLFSSL_TEST_SUBROUTINE int cryptocb_test(void)
if (ret == 0) if (ret == 0)
ret = aes_test(); ret = aes_test();
#endif #endif
#if defined(HAVE_AESCCM) && defined(WOLFSSL_AES_128)
if (ret == 0)
ret = aesccm_test();
#endif
#endif /* !NO_AES */ #endif /* !NO_AES */
#ifndef NO_DES3 #ifndef NO_DES3
if (ret == 0) if (ret == 0)