@@ -95,7 +95,7 @@ block cipher mechanism that uses n-bit binary string parameter key with 128-bits
9595 #include <wolfcrypt/src/misc.c>
9696#endif
9797
98- #ifndef WOLFSSL_ARMASM
98+ #if !defined( WOLFSSL_ARMASM ) && !defined( WOLFSSL_RISCV_ASM )
9999
100100#ifdef WOLFSSL_IMX6_CAAM_BLOB
101101 /* case of possibly not using hardware acceleration for AES but using key
@@ -967,6 +967,9 @@ block cipher mechanism that uses n-bit binary string parameter key with 128-bits
967967#elif defined(WOLFSSL_HAVE_PSA ) && !defined(WOLFSSL_PSA_NO_AES )
968968/* implemented in wolfcrypt/src/port/psa/psa_aes.c */
969969
970+ #elif defined(WOLFSSL_RISCV_ASM )
971+ /* implemented in wolfcrypt/src/port/risc-v/riscv-64-aes.c */
972+
970973#else
971974
972975 /* using wolfCrypt software implementation */
@@ -4317,6 +4320,7 @@ static void AesSetKey_C(Aes* aes, const byte* key, word32 keySz, int dir)
43174320
43184321#endif /* NEED_AES_TABLES */
43194322
4323+ #ifndef WOLFSSL_RISCV_ASM
43204324 /* Software AES - SetKey */
43214325 static WARN_UNUSED_RESULT int wc_AesSetKeyLocal (
43224326 Aes * aes , const byte * userKey , word32 keylen , const byte * iv , int dir ,
@@ -4630,6 +4634,7 @@ static void AesSetKey_C(Aes* aes, const byte* key, word32 keySz, int dir)
46304634 return wc_AesSetKeyLocal (aes , userKey , keylen , iv , dir , 1 );
46314635
46324636 } /* wc_AesSetKey() */
4637+ #endif
46334638
46344639 #if defined(WOLFSSL_AES_DIRECT ) || defined(WOLFSSL_AES_COUNTER )
46354640 /* AES-CTR and AES-DIRECT need to use this for key setup */
@@ -6171,7 +6176,7 @@ int wc_AesCbcEncrypt(Aes* aes, byte* out, const byte* in, word32 sz)
61716176 #endif /* NEED_AES_CTR_SOFT */
61726177
61736178#endif /* WOLFSSL_AES_COUNTER */
6174- #endif /* !WOLFSSL_ARMASM */
6179+ #endif /* !WOLFSSL_ARMASM && ! WOLFSSL_RISCV_ASM */
61756180
61766181
61776182/*
@@ -6221,6 +6226,9 @@ static WC_INLINE void IncCtr(byte* ctr, word32 ctrSz)
62216226#ifdef WOLFSSL_ARMASM
62226227 /* implementation is located in wolfcrypt/src/port/arm/armv8-aes.c */
62236228
6229+ #elif defined(WOLFSSL_RISCV_ASM )
6230+ /* implemented in wolfcrypt/src/port/risc-v/riscv-64-aes.c */
6231+
62246232#elif defined(WOLFSSL_AFALG )
62256233 /* implemented in wolfcrypt/src/port/afalg/afalg_aes.c */
62266234
@@ -10478,6 +10486,9 @@ int wc_AesCcmCheckTagSize(int sz)
1047810486#ifdef WOLFSSL_ARMASM
1047910487 /* implementation located in wolfcrypt/src/port/arm/armv8-aes.c */
1048010488
10489+ #elif defined(WOLFSSL_RISCV_ASM )
10490+ /* implementation located in wolfcrypt/src/port/risc-v/riscv-64-aes.c */
10491+
1048110492#elif defined(HAVE_COLDFIRE_SEC )
1048210493 #error "Coldfire SEC doesn't currently support AES-CCM mode"
1048310494
@@ -11375,6 +11386,9 @@ int wc_AesGetKeySize(Aes* aes, word32* keySize)
1137511386#elif defined(WOLFSSL_DEVCRYPTO_AES )
1137611387 /* implemented in wolfcrypt/src/port/devcrypt/devcrypto_aes.c */
1137711388
11389+ #elif defined(WOLFSSL_RISCV_ASM )
11390+ /* implemented in wolfcrypt/src/port/riscv/riscv-64-aes.c */
11391+
1137811392#elif defined(WOLFSSL_SCE ) && !defined(WOLFSSL_SCE_NO_AES )
1137911393
1138011394/* Software AES - ECB */
@@ -12613,12 +12627,21 @@ static WARN_UNUSED_RESULT int _AesXtsHelper(
1261312627 }
1261412628
1261512629 xorbuf (out , in , totalSz );
12630+ #ifndef WOLFSSL_RISCV_ASM
1261612631 if (dir == AES_ENCRYPTION ) {
1261712632 return _AesEcbEncrypt (aes , out , out , totalSz );
1261812633 }
1261912634 else {
1262012635 return _AesEcbDecrypt (aes , out , out , totalSz );
1262112636 }
12637+ #else
12638+ if (dir == AES_ENCRYPTION ) {
12639+ return wc_AesEcbEncrypt (aes , out , out , totalSz );
12640+ }
12641+ else {
12642+ return wc_AesEcbDecrypt (aes , out , out , totalSz );
12643+ }
12644+ #endif
1262212645}
1262312646#endif /* HAVE_AES_ECB */
1262412647
0 commit comments