@@ -1268,9 +1268,13 @@ static void myFipsCb(int ok, int err, const char* hash)
12681268}
12691269#endif /* HAVE_FIPS && !WOLFSSL_KERNEL_MODE */
12701270
1271- #if defined(HAVE_FIPS) && FIPS_VERSION3_LT(6,0,0) && !defined(WC_NO_CONSTRUCTORS)
1271+ /* Polyfill for old FIPS modules whose headers don't declare the
1272+ * constructor/destructor helpers. Skip when the current headers
1273+ * already provide them (WC_AES_NEW_API_AVAILABLE / WC_RSA_NEW_API_AVAILABLE). */
1274+ #if defined(HAVE_FIPS) && FIPS_VERSION3_LT(6,0,0) && \
1275+ !defined(WC_NO_CONSTRUCTORS)
12721276
1273- #if !defined(NO_AES)
1277+ #if !defined(NO_AES) && !defined(WC_AES_NEW_API_AVAILABLE)
12741278static WC_MAYBE_UNUSED Aes* wc_AesNew(void* heap, int thisDevId, int *result_code)
12751279{
12761280 int ret;
@@ -1328,9 +1332,9 @@ static WC_MAYBE_UNUSED Aes* wc_AesNew_Id(unsigned char* id, int len,
13281332}
13291333#endif /* WOLF_PRIVATE_KEY_ID */
13301334
1331- #endif /* !NO_AES */
1335+ #endif /* !NO_AES && !WC_AES_NEW_API_AVAILABLE */
13321336
1333- #if !defined(NO_RSA)
1337+ #if !defined(NO_RSA) && !defined(WC_RSA_NEW_API_AVAILABLE)
13341338static WC_MAYBE_UNUSED RsaKey* wc_NewRsaKey(void* heap, int thisDevId, int *result_code)
13351339{
13361340 int ret;
@@ -1386,9 +1390,9 @@ static WC_MAYBE_UNUSED RsaKey* wc_NewRsaKey_Id(unsigned char* id, int len,
13861390 return key;
13871391}
13881392#endif /* WOLF_PRIVATE_KEY_ID */
1389- #endif /* !NO_RSA */
1393+ #endif /* !NO_RSA && !WC_RSA_NEW_API_AVAILABLE */
13901394
1391- #endif /* FIPS_VERSION3_LT(6,0,0) && !WC_NO_CONSTRUCTORS */
1395+ #endif /* HAVE_FIPS && FIPS_VERSION3_LT(6,0,0) && !WC_NO_CONSTRUCTORS */
13921396
13931397/* AES/RSA New helpers -- placed after the FIPS polyfill block so wc_AesNew /
13941398 * wc_NewRsaKey are visible from either the library or the polyfill above.
0 commit comments