Skip to content

Commit 38ea470

Browse files
authored
Merge pull request #175 from ejohnstown/fips-openssh
2 parents 232f6b7 + 21101a5 commit 38ea470

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/we_internal.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121

2222
#include <wolfengine/we_internal.h>
2323
#include <wolfengine/we_wolfengine.h>
24+
#if defined(HAVE_FIPS_VERSION) && HAVE_FIPS_VERSION == 5
25+
#include <wolfssl/wolfcrypt/fips_test.h>
26+
#endif
2427

2528
#ifdef WE_NO_OPENSSL_MALLOC
2629
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
@@ -798,6 +801,23 @@ static int wolfengine_init(ENGINE *e)
798801
wc_SetSeed_Cb(wc_GenerateSeed);
799802
#endif
800803
ret = we_init_random();
804+
#if defined(HAVE_FIPS_VERSION) && HAVE_FIPS_VERSION == 5 && \
805+
defined(WE_HAVE_ECC)
806+
#if defined(WE_HAVE_ECDH)
807+
if (ret == 1) {
808+
if (wc_RunCast_fips(FIPS_CAST_ECC_PRIMITIVE_Z) != 0) {
809+
ret = 0;
810+
}
811+
}
812+
#endif /* WE_HAVE_ECDH */
813+
#if defined(WE_HAVE_ECDSA)
814+
if (ret == 1) {
815+
if (wc_RunCast_fips(FIPS_CAST_ECDSA) != 0) {
816+
ret = 0;
817+
}
818+
}
819+
#endif /* WE_HAVE_ECDSA */
820+
#endif /* HAVE_FIPS_VERSION && WE_HAVE_ECC */
801821
#endif
802822
#ifdef WE_HAVE_SHA1
803823
if (ret == 1) {

0 commit comments

Comments
 (0)