- Added fips option.
- Fixed a cross compile bug when enable fips.

Signed-off-by: Lei Maohui <leimao...@fujitsu.com>
---
 ...r-cross-compile-when-enable-fips.Usi.patch | 28 +++++++++++++++++++
 meta/recipes-support/gnutls/gnutls_3.7.4.bb   | 18 ++++++++++++
 2 files changed, 46 insertions(+)
 create mode 100644 
meta/recipes-support/gnutls/gnutls/0001-Fix-build-bug-for-cross-compile-when-enable-fips.Usi.patch

diff --git 
a/meta/recipes-support/gnutls/gnutls/0001-Fix-build-bug-for-cross-compile-when-enable-fips.Usi.patch
 
b/meta/recipes-support/gnutls/gnutls/0001-Fix-build-bug-for-cross-compile-when-enable-fips.Usi.patch
new file mode 100644
index 0000000000..0eeebb9b5e
--- /dev/null
+++ 
b/meta/recipes-support/gnutls/gnutls/0001-Fix-build-bug-for-cross-compile-when-enable-fips.Usi.patch
@@ -0,0 +1,28 @@
+From 755494234d71063ef1db6470d780a558ddfd1c56 Mon Sep 17 00:00:00 2001
+From: Lei Maohui <leimao...@fujitsu.com>
+Date: Fri, 6 May 2022 10:51:39 +0900
+Subject: [PATCH] Fix build bug for cross-compile when enable fips.Using binary
+ from gnutls-native instead of target.
+
+Upstream-Status: Inappropriate [embedded specific]
+Signed-off-by: Lei Maohui <leimao...@fujitsu.com>
+---
+ lib/Makefile.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/Makefile.am b/lib/Makefile.am
+index c3d7b6e..0f099f4 100644
+--- a/lib/Makefile.am
++++ b/lib/Makefile.am
+@@ -207,7 +207,7 @@ hmac_files = .libs/.$(gnutls_so).hmac
+ all-local: $(hmac_files)
+ 
+ .libs/.$(gnutls_so).hmac: libgnutls.la fipshmac
+-      $(AM_V_GEN) $(builddir)/fipshmac .libs/$(gnutls_so) > $@-t && mv $@-t $@
++      $(AM_V_GEN) fipshmac .libs/$(gnutls_so) > $@-t && mv $@-t $@
+ 
+ CLEANFILES = $(hmac_files)
+ endif
+-- 
+2.25.1
+
diff --git a/meta/recipes-support/gnutls/gnutls_3.7.4.bb 
b/meta/recipes-support/gnutls/gnutls_3.7.4.bb
index b34eb7f5f0..5882e980e7 100644
--- a/meta/recipes-support/gnutls/gnutls_3.7.4.bb
+++ b/meta/recipes-support/gnutls/gnutls_3.7.4.bb
@@ -15,6 +15,8 @@ LIC_FILES_CHKSUM = 
"file://LICENSE;md5=71391c8e0c1cfe68077e7fce3b586283 \
                     
file://doc/COPYING.LESSER;md5=a6f89e2100d9b6cdffcea4f398e37343"
 
 DEPENDS = "nettle gmp virtual/libiconv libunistring"
+DEPENDS:append:class-target = " gnutls-native"
+DEPENDS:append:class-nativesdk = " gnutls-native"
 DEPENDS:append:libc-musl = " argp-standalone"
 
 SHRT_VER = "${@d.getVar('PV').split('.')[0]}.${@d.getVar('PV').split('.')[1]}"
@@ -22,6 +24,12 @@ SHRT_VER = 
"${@d.getVar('PV').split('.')[0]}.${@d.getVar('PV').split('.')[1]}"
 SRC_URI = 
"https://www.gnupg.org/ftp/gcrypt/gnutls/v${SHRT_VER}/gnutls-${PV}.tar.xz \
            file://arm_eabi.patch \
            "
+SRC_URI:append:class-target = "\
+           
file://0001-Fix-build-bug-for-cross-compile-when-enable-fips.Usi.patch \
+           "
+SRC_URI:append:class-nativesdk = "\
+           
file://0001-Fix-build-bug-for-cross-compile-when-enable-fips.Usi.patch \
+           "
 
 SRC_URI[sha256sum] = 
"e6adbebcfbc95867de01060d93c789938cf89cc1d1f6ef9ef661890f6217451f"
 
@@ -36,6 +44,7 @@ PACKAGECONFIG[libidn] = "--with-idn,--without-idn,libidn2"
 PACKAGECONFIG[libtasn1] = 
"--with-included-libtasn1=no,--with-included-libtasn1,libtasn1"
 PACKAGECONFIG[p11-kit] = "--with-p11-kit,--without-p11-kit,p11-kit"
 PACKAGECONFIG[tpm] = "--with-tpm,--without-tpm,trousers"
+PACKAGECONFIG[fips] = "--enable-fips140-mode 
--with-libdl-prefix=${STAGING_BASELIBDIR},--disable-fips140-mode"
 
 EXTRA_OECONF = " \
     --enable-doc \
@@ -59,6 +68,15 @@ do_configure:prepend() {
        done
 }
 
+do_install:append:class-native() {
+        if ${@bb.utils.contains('PACKAGECONFIG', 'fips', 'true', 'false', d)}; 
then
+          install -d ${D}${base_prefix}/bin
+          install -d ${D}${base_prefix}/bin/.libs
+          install -m 0755 ${B}/lib/fipshmac ${D}${base_prefix}/bin/
+          install -m 0755 ${B}/lib/.libs/fipshmac 
${D}/${base_prefix}/bin/.libs/
+        fi
+}
+
 PACKAGES =+ "${PN}-openssl ${PN}-xx"
 
 FILES:${PN}-dev += "${bindir}/gnutls-cli-debug"
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#165316): 
https://lists.openembedded.org/g/openembedded-core/message/165316
Mute This Topic: https://lists.openembedded.org/mt/90926966/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to