Skip to content

Commit da4fc49

Browse files
committed
tests/api/test_ed25519.c: in test_wc_Ed25519PublicKeyToDer(), on old FIPS, tolerate old error code from wc_Ed25519PublicKeyToDer().
1 parent cd88a8a commit da4fc49

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/api/test_ed25519.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,16 @@ int test_wc_Ed25519PublicKeyToDer(void)
489489
ExpectIntEQ(wc_Ed25519PublicKeyToDer(NULL, NULL, 0, 0),
490490
WC_NO_ERR_TRACE(BAD_FUNC_ARG));
491491
ExpectIntEQ(wc_ed25519_init(&key), 0);
492+
#if defined(HAVE_FIPS) && FIPS_VERSION3_LT(7,0,0)
493+
if (EXPECT_SUCCESS()) {
494+
int ret = wc_Ed25519PublicKeyToDer(&key, derBuf, 0, 0);
495+
ExpectTrue((ret == WC_NO_ERR_TRACE(BUFFER_E)) ||
496+
(ret == WC_NO_ERR_TRACE(PUBLIC_KEY_E)));
497+
}
498+
#else
492499
ExpectIntEQ(wc_Ed25519PublicKeyToDer(&key, derBuf, 0, 0),
493500
WC_NO_ERR_TRACE(PUBLIC_KEY_E));
501+
#endif
494502
wc_ed25519_free(&key);
495503

496504
/* Test good args */

0 commit comments

Comments
 (0)