From 52bececebc33beaaacbf602ba5034f2978d5684b Mon Sep 17 00:00:00 2001 From: Javier Viguera Date: Thu, 1 Sep 2022 19:10:06 +0200 Subject: [PATCH] wolfcrypttest: fix for FIPS enabled wolfSSL library FIPS does not support MD5 https://onedigi.atlassian.net/browse/DEL-8036 Signed-off-by: Javier Viguera --- .../wolfcrypt/wolfcrypttest.bbappend | 4 +++ ...fix-for-FIPS-enabled-wolfSSL-library.patch | 31 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 meta-digi-arm/dynamic-layers/wolfssl/recipes-examples/wolfcrypt/wolfcrypttest/0001-wolfcrypttest-fix-for-FIPS-enabled-wolfSSL-library.patch diff --git a/meta-digi-arm/dynamic-layers/wolfssl/recipes-examples/wolfcrypt/wolfcrypttest.bbappend b/meta-digi-arm/dynamic-layers/wolfssl/recipes-examples/wolfcrypt/wolfcrypttest.bbappend index f8205e6b0..5f1bcbe26 100644 --- a/meta-digi-arm/dynamic-layers/wolfssl/recipes-examples/wolfcrypt/wolfcrypttest.bbappend +++ b/meta-digi-arm/dynamic-layers/wolfssl/recipes-examples/wolfcrypt/wolfcrypttest.bbappend @@ -1,4 +1,8 @@ # Copyright (C) 2022 Digi International +FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" + +SRC_URI:append = " file://0001-wolfcrypttest-fix-for-FIPS-enabled-wolfSSL-library.patch" + CFLAGS:append:arm = " -DSIZEOF_LONG=4 -DSIZEOF_LONG_LONG=8" CFLAGS:append:aarch64 = " -DSIZEOF_LONG=8 -DSIZEOF_LONG_LONG=8" diff --git a/meta-digi-arm/dynamic-layers/wolfssl/recipes-examples/wolfcrypt/wolfcrypttest/0001-wolfcrypttest-fix-for-FIPS-enabled-wolfSSL-library.patch b/meta-digi-arm/dynamic-layers/wolfssl/recipes-examples/wolfcrypt/wolfcrypttest/0001-wolfcrypttest-fix-for-FIPS-enabled-wolfSSL-library.patch new file mode 100644 index 000000000..9415656bf --- /dev/null +++ b/meta-digi-arm/dynamic-layers/wolfssl/recipes-examples/wolfcrypt/wolfcrypttest/0001-wolfcrypttest-fix-for-FIPS-enabled-wolfSSL-library.patch @@ -0,0 +1,31 @@ +From: Javier Viguera +Date: Thu, 1 Sep 2022 18:58:13 +0200 +Subject: [PATCH] wolfcrypttest: fix for FIPS enabled wolfSSL library + +FIPS does not support MD5 + +Signed-off-by: Javier Viguera +--- + test.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/test.c b/test.c +index 8ad937a8bacb..00d8ba0d2503 100644 +--- a/test.c ++++ b/test.c +@@ -18370,9 +18370,15 @@ WOLFSSL_TEST_SUBROUTINE int openssl_test(void) + c.inLen = XSTRLEN(c.input); + c.outLen = WC_MD5_DIGEST_SIZE; + ++#if defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2) ++ /* Expect failure with MD5 + HMAC when using FIPS 140-3. */ ++ if (HMAC(EVP_md5(), "JefeJefeJefeJefe", 16, (byte*)c.input, (int)c.inLen, ++ hash, 0) != NULL) ++#else + if (HMAC(EVP_md5(), "JefeJefeJefeJefe", 16, (byte*)c.input, (int)c.inLen, + hash, 0) == NULL || + XMEMCMP(hash, c.output, WC_MD5_DIGEST_SIZE) != 0) ++#endif + { + return -8612; + }