Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions .wolfssl_known_macro_extras
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,15 @@ WOLFSSL_NO_TICKET_EXPIRE
WOLFSSL_NO_TRUSTED_CERTS_VERIFY
WOLFSSL_NO_WORD64_OPS
WOLFSSL_NO_XOR_OPS
WOLFSSL_NXP_LPC55S6X
WOLFSSL_NXP_CASPER
WOLFSSL_NXP_CASPER_ECC_MULMOD
WOLFSSL_NXP_CASPER_ECC_MUL2ADD
WOLFSSL_NXP_CASPER_RSA_PUB_EXPTMOD
WOLFSSL_NXP_HASHCRYPT
WOLFSSL_NXP_HASHCRYPT_AES
WOLFSSL_NXP_HASHCRYPT_SHA
WOLFSSL_NXP_RNG_1
WOLFSSL_NRF51_AES
WOLFSSL_OLDTLS_AEAD_CIPHERSUITES
WOLFSSL_OLD_SET_CURVES_LIST
Expand Down
29 changes: 26 additions & 3 deletions wolfcrypt/src/aes.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ block cipher mechanism that uses n-bit binary string parameter key with 128-bits
#include <wolfssl/wolfcrypt/cryptocb.h>
#endif

#ifdef WOLFSSL_NXP_HASHCRYPT_AES
#include <wolfssl/wolfcrypt/port/nxp/hashcrypt_port.h>
#endif

#ifdef WOLFSSL_SECO_CAAM
#include <wolfssl/wolfcrypt/port/caam/wolfcaam.h>
#endif
Expand Down Expand Up @@ -5102,7 +5106,8 @@ static void AesSetKey_C(Aes* aes, const byte* key, word32 keySz, int dir)

#if defined(WOLF_CRYPTO_CB) || (defined(WOLFSSL_DEVCRYPTO) && \
(defined(WOLFSSL_DEVCRYPTO_AES) || defined(WOLFSSL_DEVCRYPTO_CBC))) || \
(defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_AES))
(defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_AES)) || \
defined(WOLFSSL_NXP_HASHCRYPT_AES)
#ifdef WOLF_CRYPTO_CB
if (aes->devId != INVALID_DEVID)
#endif
Expand Down Expand Up @@ -6476,6 +6481,9 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
#elif defined(WOLFSSL_DEVCRYPTO_CBC)
/* implemented in wolfcrypt/src/port/devcrypt/devcrypto_aes.c */

#elif defined(WOLFSSL_NXP_HASHCRYPT_AES)
/* implemented in wolfcrypt/src/port/nxp/hashcrypt_port.c */

#elif defined(WOLFSSL_SILABS_SE_ACCEL)
/* implemented in wolfcrypt/src/port/silabs/silabs_aes.c */

Expand Down Expand Up @@ -7143,7 +7151,11 @@ int wc_AesCbcEncrypt(Aes* aes, byte* out, const byte* in, word32 sz)
#define NEED_AES_CTR_SOFT

#elif defined(WOLFSSL_HAVE_PSA) && !defined(WOLFSSL_PSA_NO_AES)
/* implemented in wolfcrypt/src/port/psa/psa_aes.c */
/* implemented in wolfcrypt/src/port/psa/psa_aes.c */

#elif defined(WOLFSSL_NXP_HASHCRYPT_AES)
/* implemented in wolfcrypt/src/port/nxp/hashcrypt_port.c */

#else

/* Use software based AES counter */
Expand Down Expand Up @@ -13938,6 +13950,9 @@ int wc_AesGetKeySize(Aes* aes, word32* keySize)
#elif defined(WOLFSSL_RISCV_ASM)
/* implemented in wolfcrypt/src/port/riscv/riscv-64-aes.c */

#elif defined(WOLFSSL_NXP_HASHCRYPT_AES)
/* implemented in wolfcrypt/src/port/nxp/hashcrypt_port.c */

#elif defined(WOLFSSL_SILABS_SE_ACCEL)
/* implemented in wolfcrypt/src/port/silabs/silabs_aes.c */

Expand Down Expand Up @@ -14233,7 +14248,10 @@ int wc_AesEcbDecrypt(Aes* aes, byte* out, const byte* in, word32 sz)

#if defined(WOLFSSL_AES_CFB)

#if defined(WOLFSSL_PSOC6_CRYPTO)
#if defined(WOLFSSL_NXP_HASHCRYPT_AES)
/* implemented in wolfcrypt/src/port/nxp/hashcrypt_port.c */

#elif defined(WOLFSSL_PSOC6_CRYPTO)

int wc_AesCfbEncrypt(Aes* aes, byte* out, const byte* in, word32 sz)
{
Expand Down Expand Up @@ -14682,6 +14700,10 @@ int wc_AesCfb8Decrypt(Aes* aes, byte* out, const byte* in, word32 sz)
#endif /* WOLFSSL_AES_CFB */

#ifdef WOLFSSL_AES_OFB
#ifdef WOLFSSL_NXP_HASHCRYPT_AES
/* implemented in wolfcrypt/src/port/nxp/hashcrypt_port.c */

#else /* software */
/* OFB AES mode
*
* aes structure holding key to use for encryption
Expand Down Expand Up @@ -14784,6 +14806,7 @@ int wc_AesOfbDecrypt(Aes* aes, byte* out, const byte* in, word32 sz)
return AesOfbCrypt_C(aes, out, in, sz);
}
#endif /* HAVE_AES_DECRYPT */
#endif /* software */
#endif /* WOLFSSL_AES_OFB */


Expand Down
2 changes: 2 additions & 0 deletions wolfcrypt/src/include.am
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ EXTRA_DIST += wolfcrypt/src/port/ti/ti-aes.c \
wolfcrypt/src/port/nxp/dcp_port.c \
wolfcrypt/src/port/nxp/se050_port.c \
wolfcrypt/src/port/nxp/README.md \
wolfcrypt/src/port/nxp/casper_port.c \
wolfcrypt/src/port/nxp/hashcrypt_port.c \
wolfcrypt/src/port/atmel/README.md \
wolfcrypt/src/port/xilinx/xil-sha3.c \
wolfcrypt/src/port/xilinx/xil-aesgcm.c \
Expand Down
44 changes: 43 additions & 1 deletion wolfcrypt/src/port/nxp/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,47 @@
# wolfSSL NXP Hardware Acceleration Ports

wolfSSL supports hardware acceleration on NXP DCP, LTC (KSDK), and SE050.
wolfSSL supports hardware acceleration on NXP DCP, LTC (KSDK), LPC55S69, and SE050.

## NXP LPC55S69

The LPC55S69 is a general purpose edge computing device, with dual ARM
Cortex-M33 cores running up to 150 MHz, 640/320 KB internal flash/ram,
TrustZone-M, a DSP accelerator, and extensive cryptographic acceleration.

wolfSSL supports the following hardware acceleration on the LPC55S69:
- TRNG
- HashCrypt (Hash/AES Crypto Engine)
- AES (128, 192, 256) encrypt/decrypt
- AES-CBC, AES-ECB, AES-CTR, AES-OFB, AES-CFB
- SHA-1, SHA-256
- CASPER (Asymmetric Crypto Accelerator)
- RSA verify/encrypt/decrypt (up to 4096-bit, public key only)

### LPC55S69 Hardware Acceleration Caveats

The following caveats should be noted about the LPC55S69 hardware acceleration:
- AES-CTR mode fails when the counter wraps from all FF's to 0. User should
ensure this never happens, by properly managing the iv/counter in use.
- AES-CFB and AES-OFB only support full 16-byte blocks and multiples thereof.
Encrypt/Decrypt requests of other sizes will fail.
- RSA acceleration is only supported for public keys. Private key operations
will use a fully software implementation.
- When the HashCrypt engine is in use for SHA-1 or SHA-256, it must not be
interrupted with another hash request or an AES request. The hash must be
completed before another operation is requested.

### wolfSSL LPC55S69 Hardware Acceleration Enable

To enable only the TRNG, define the following symbol:

**`WOLFSSL_NXP_RNG_1`**

To enable all LPC55S69 hardware acceleration, including the TRNG,
define the following symbol:

**`WOLFSSL_NXP_LPC55S6X`**

NOTE: Both can be defined with no problem.

## NXP SE050

Expand All @@ -10,3 +51,4 @@ see [README_SE050.md](./README_SE050.md).
## Support

For questions please email support@wolfssl.com

Loading
Loading