I am upgrading our wolfssl version from 5.6.4 to 5.7.6 and am encountering a build issue with woflcrypt/aes.c. We haven't modified our application or user_settings, just updated the wolfssl version.
This is the compilation error:
wolfssl/wolfcrypt/src/aes.c:243:35: error: 'wc_AesDecrypt' defined but not used [-Werror=unused-function] 243 | static WARN_UNUSED_RESULT int wc_AesDecrypt( |These are our user_settings pertaining to AES. We only use the CCM AES functions in our application
/*---------- WOLF_CONF_AESGCM -----------*/ #define WOLF_CONF_AESGCM 0 /*---------- WOLF_CONF_AESCBC -----------*/ #define WOLF_CONF_AESCBC 0 ... /* AES */ #if defined(WOLF_CONF_AESGCM) && WOLF_CONF_AESGCM == 1 #define HAVE_AESGCM /* GCM Method: GCM_SMALL, GCM_WORD32, GCM_TABLE or GCM_TABLE_4BIT */ /* GCM_TABLE is about 4K larger and 3x faster for GHASH */ #define GCM_SMALL // #define HAVE_AES_DECRYPT #endif #if defined(WOLF_CONF_AESCBC) && WOLF_CONF_AESCBC == 1 #define HAVE_AES_CBC // #define HAVE_AES_DECRYPT #endif /* Other possible AES modes */ //#define WOLFSSL_AES_COUNTER #define HAVE_AESCCM // #define NO_AES_DECRYPT //#define WOLFSSL_AES_XTS //#define WOLFSSL_AES_DIRECT //#define HAVE_AES_ECB //#define HAVE_AES_KEYWRAP //#define AES_MAX_KEY_SIZE 256It appears this stems from how the wc_AesDecrypt function is brought in in aes.c
#ifdef HAVE_AES_DECRYPT #if defined(WOLFSSL_AES_DIRECT) || defined(HAVE_AESCCM) static WARN_UNUSED_RESULT int wc_AesDecrypt( Aes* aes, const byte* inBlock, byte* outBlock) {If you have AESCCM enabled then this is brought in automatically. Given we don't use this function and want to avoid the compilation error, is there a combination of user settings that can accomplish this?
Problems of this kind always cause inconvenience, but if you need a reliable platform for withdrawing funds then A-Pay handle this perfectly..Thank you.
This looks more like a compiler warning turning into an error than an actual AES configuration problem. If the thread is a few versions old, I'd also check the current wolfSSL release notes because there have been several fixes around conditional compilation since 5.7.x.
For your specific case, HAVE_AESCCM does pull in some internal AES routines even if your application never calls them directly. If -Werror=unused-function is enabled, newer compiler behavior can expose this. I'd first try defining NO_AES_DECRYPT (provided it doesn't break your CCM use case), or see if a newer wolfSSL release has already addressed the unused static function. Otherwise, it may simply need a small upstream fix to the preprocessor guards around wc_AesDecrypt rather than a different user_settings combination.