gnutls: Added fips support option.
PATCH 1/1 gnutls: Added fips support option.
--- meta/recipes-support/gnutls/gnutls_3.7.4.bb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
meta/recipes-support/gnutls/gnutls_3.7.4.bb +17 -0
@@ -15,6 +15,7 @@ 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:libc-musl = " argp-standalone" SHRT_VER = "${@d.getVar('PV').split('.')[0]}.${@d.getVar('PV').split('.')[1]}"
@@ -36,6 +37,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,--disable-fips140-mode" EXTRA_OECONF = " \ --enable-doc \
@@ -59,6 +61,21 @@ do_configure:prepend() { done } +do_compile:prepend:class-target () { + if ${@bb.utils.contains('PACKAGECONFIG', 'fips', 'true', 'false', d)}; then + sed -i -e "s#\$(builddir)/fipshmac#${STAGING_DIR_NATIVE}${libdir}/fipshmac#g" ${B}/lib/Makefile + fi +} + +do_install:append:class-native() { + if ${@bb.utils.contains('PACKAGECONFIG', 'fips', 'true', 'false', d)}; then + install -d ${D}${libdir} + install -d ${D}${libdir}/.libs + install -m 0755 ${B}/lib/fipshmac ${D}${libdir}/ + install -m 0755 ${B}/lib/.libs/fipshmac ${D}${libdir}/.libs/ + fi +} + PACKAGES =+ "${PN}-openssl ${PN}-xx" FILES:${PN}-dev += "${bindir}/gnutls-cli-debug"
Signature · 1 line
1.8.3.1
What do those do_compile/do_install tweaks do, and why are they necessary? Please explain, it seems like there might be a better way to do this.
Alex
Quoted 60 lines · leimaohui
Signed-off-by Lei Maohui <[email protected]>--- meta/recipes-support/gnutls/gnutls_3.7.4.bb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)meta/recipes-support/gnutls/gnutls_3.7.4.bb +17
-1@@ -15,6 +15,7 @@ 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:libc-musl = " argp-standalone" SHRT_VER = "${@d.getVar('PV').split('.')[0]}.${@d.getVar('PV').split('.')[1]}"@@ -36,6 +37,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,--disable-fips140-mode" EXTRA_OECONF = " \ --enable-doc \@@ -59,6 +61,21 @@ do_configure:prepend() { done } +do_compile:prepend:class-target () { + if ${@bb.utils.contains('PACKAGECONFIG', 'fips', 'true', 'false', d)}; then + sed -i -e "s#\$(builddir)/fipshmac#${STAGING_DIR_NATIVE}${libdir}/fipshmac#g" ${B}/lib/Makefile + fi +} + +do_install:append:class-native() { + if ${@bb.utils.contains('PACKAGECONFIG', 'fips', 'true', 'false', d)}; then + install -d ${D}${libdir} + install -d ${D}${libdir}/.libs + install -m 0755 ${B}/lib/fipshmac ${D}${libdir}/ + install -m 0755 ${B}/lib/.libs/fipshmac ${D}${libdir}/.libs/ + fi +} + PACKAGES =+ "${PN}-openssl ${PN}-xx" FILES:${PN}-dev += "${bindir}/gnutls-cli-debug" --1.8.3.1
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#164933): https://lists.openembedded.org/g/openembedded-core/message/164933
Mute This Topic: https://lists.openembedded.org/mt/90748530/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Hi, Alex
Quoted 2 lines
What do those do_compile/do_install tweaks do, and why are they necessary? Please explain, it seems like there might be a better way to do this.
Sorry, It seems that I should add an explain in commit message.
I found that if enable fips, a binary build for target will be executed in do_compile task. The log(MACHINE ?= "qemuarm64") is as the following:
------------------------------------------------------
| ./fipshmac .libs/libgnutls.so.30 > .libs/.libgnutls.so.30.hmac-t && mv .libs/.libgnutls.so.30.hmac-t .libs/.libgnutls.so.30.hmac | libtool: link: (cd ".libs" && rm -f "libgnutlsxx.so.30" && ln -s "libgnutlsxx.so.30.0.0" "libgnutlsxx.so.30") | libtool: link: (cd ".libs" && rm -f "libgnutlsxx.so" && ln -s "libgnutlsxx.so.30.0.0" "libgnutlsxx.so") | /lib/ld-linux-aarch64.so.1: No such file or directory
So, I tweaked do_compile/do_install to use fipshmac from native instead of target. If there is better way, please tell me. And if there are no questions, I'll send a v2 patch with an issue fixed for multilib.
Best regards
Lei Maohui
Quoted 84 lines
-----Original Message-----
From: Alexander Kanavin <[email protected]>
Sent: Thursday, April 28, 2022 4:12 PM
To: Lei, Maohui <[email protected]>
Cc: OE-core <[email protected]>
Subject: Re: [OE-core] [PATCH] gnutls: Added fips support option.What do those do_compile/do_install tweaks do, and why are they necessary? Please explain, it seems like there might be a better way to do this.
Alex
meta/recipes-support/gnutls/gnutls_3.7.4.bb LIC_FILES_CHKSUM =
Quoted 12 lines · leimaohui
Signed-off-by Lei Maohui <[email protected]>--- meta/recipes-support/gnutls/gnutls_3.7.4.bb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)meta/recipes-support/gnutls/gnutls_3.7.4.bb +0
-0@@ -15,6 +15,7 @@ LIC_FILES_CHKSUM ="file://LICENSE;md5=71391c8e0c1cfe68077e7fce3b586283 \
Quoted 1 line
file://doc/COPYING.LESSER;md5=a6f89e2100d9b6cdffcea4f398e37343"
meta/recipes-support/gnutls/gnutls_3.7.4.bb PACKAGECONFIG[libidn] =
Quoted 7 lines
DEPENDS = "nettle gmp virtual/libiconv libunistring"
meta/recipes-support/gnutls/gnutls_3.7.4.bb +1
-0+DEPENDS:append:class-target = " gnutls-native" DEPENDS:append:libc-musl = " argp-standalone" SHRT_VER = "${@d.getVar('PV').split('.')[0]}.${@d.getVar('PV').split('.')[1]}"@@ -36,6 +37,7 @@ PACKAGECONFIG[libidn] ="--with-idn,--without-idn,libidn2"
meta/recipes-support/gnutls/gnutls_3.7.4.bb PACKAGECONFIG[libidn] = · line 37
Quoted 1 line
meta/recipes-support/gnutls/gnutls_3.7.4.bb +0
-0PACKAGECONFIG[libtasn1] ="--with-included-libtasn1=no,--with-included-libtasn1,libtasn1"
meta/recipes-support/gnutls/gnutls_3.7.4.bb do_configure:prepend() { · line 65
Quoted 12 lines
meta/recipes-support/gnutls/gnutls_3.7.4.bb +3
-0PACKAGECONFIG[p11-kit] = "--with-p11-kit,--without-p11-kit,p11-kit" PACKAGECONFIG[tpm] = "--with-tpm,--without-tpm,trousers" +PACKAGECONFIG[fips] = "--enable-fips140-mode,--disable-fips140-mode" EXTRA_OECONF = " \ --enable-doc \@@ -59,6 +61,21 @@ do_configure:prepend() { done } +do_compile:prepend:class-target () { + if ${@bb.utils.contains('PACKAGECONFIG', 'fips', 'true', 'false', d)};then
meta/recipes-support/gnutls/gnutls_3.7.4.bb do_configure:prepend() { · line 66
Quoted 1 line
meta/recipes-support/gnutls/gnutls_3.7.4.bb +1
-0+ sed -i -e"s#\$(builddir)/fipshmac#${STAGING_DIR_NATIVE}${libdir}/fipshmac#g" ${B}/lib/Makefile
meta/recipes-support/gnutls/gnutls_3.7.4.bb do_configure:prepend() {
Quoted 5 lines
meta/recipes-support/gnutls/gnutls_3.7.4.bb +5
-0+ fi +} + +do_install:append:class-native() { + if ${@bb.utils.contains('PACKAGECONFIG', 'fips', 'true', 'false', d)};then
Quoted 24 lines
meta/recipes-support/gnutls/gnutls_3.7.4.bb +7
-1+ install -d ${D}${libdir} + install -d ${D}${libdir}/.libs + install -m 0755 ${B}/lib/fipshmac ${D}${libdir}/ + install -m 0755 ${B}/lib/.libs/fipshmac ${D}${libdir}/.libs/ + fi +} + PACKAGES =+ "${PN}-openssl ${PN}-xx" FILES:${PN}-dev += "${bindir}/gnutls-cli-debug" --1.8.3.1
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#164933):
https://lists.openembedded.org/g/openembedded-core/message/164933
Mute This Topic: https://lists.openembedded.org/mt/90748530/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 10 lines · On Fri, 29 Apr 2022 at 06:51, [email protected] <[email protected]>…
Sorry, It seems that I should add an explain in commit message.
I found that if enable fips, a binary build for target will be executed indo_compiletask. Thelog(MACHINE ?= "qemuarm64")is as the following:
------------------------------------------------------| ./fipshmac .libs/libgnutls.so.30 > .libs/.libgnutls.so.30.hmac-t && mv .libs/.libgnutls.so.30.hmac-t .libs/.libgnutls.so.30.hmac | libtool: link: (cd ".libs" && rm -f "libgnutlsxx.so.30" && ln -s "libgnutlsxx.so.30.0.0" "libgnutlsxx.so.30") | libtool: link: (cd ".libs" && rm -f "libgnutlsxx.so" && ln -s "libgnutlsxx.so.30.0.0" "libgnutlsxx.so") | /lib/ld-linux-aarch64.so.1: No such file or directorySo, I tweaked do_compile/do_install to use fipshmac from native instead of target. If there is better way, please tell me. And if there are no questions, I'll send a v2 patch with an issue fixed for multilib.
Can you please show the fragment in the Makefile where the target binary is executed? It is better to make a real patch that changes it to run a native binary, instead of changing it with sed. (sed patching is problematic because it's not clear from the recipe what is being done exactly, and how the original and the changed code looks like).
Alex
Hi, Alex
Sorry for the late reply because my holiday.
Quoted 5 lines
Can you please show the fragment in the
Makefilewhere the target binary is executed? It is better to make a real patch that changes it to run a native binary, instead of changing it with sed. (sed patching is problematic because it's not clear from the recipe what is being done exactly, and how the original and the changed code looks like).
Yes, At first I wanted to fix this issue by a patch, but I had no idea. The binary is just a file exists in the build directory and it can't be found in "PATH". So I had to install it into ${D} of native, then specify an absolute path of native by sed command for target and nativesdk.
The following is the part where execute the target/nativesdk(nativesdk also has the issue) binary.
$ cat tmp/work/core2-32-poky-linux/gnutls/3.7.4-r0/build/lib/Makefile
......
.libs/.$(gnutls_so).hmac: libgnutls.la fipshmac
$(AM_V_GEN) $(builddir)/fipshmac .libs/$(gnutls_so) > $@-t && mv $@-t $@
......Best regards
Lei
Quoted 32 lines
-----Original Message-----
From: Alexander Kanavin <[email protected]>
Sent: Friday, April 29, 2022 3:05 PM
To: Lei, Maohui <[email protected]>
Cc: OE-core <[email protected]>
Subject: Re: [OE-core] [PATCH] gnutls: Added fips support option.Quoted 2 lines · On Fri, 29 Apr 2022 at 06:51, [email protected] <[email protected]>…
Sorry, It seems that I should add an explain in commit message. I found that if enable fips, a binary build for target will be executed in
do_compiletask. Thelog(MACHINE ?= "qemuarm64")is as the following:Quoted 10 lines
------------------------------------------------------
| ./fipshmac .libs/libgnutls.so.30 > .libs/.libgnutls.so.30.hmac-t && | mv .libs/.libgnutls.so.30.hmac-t .libs/.libgnutls.so.30.hmac | libtool: link: (cd ".libs" && rm -f "libgnutlsxx.so.30" && ln -s | "libgnutlsxx.so.30.0.0" "libgnutlsxx.so.30") | libtool: link: (cd ".libs" && rm -f "libgnutlsxx.so" && ln -s | "libgnutlsxx.so.30.0.0" "libgnutlsxx.so") | /lib/ld-linux-aarch64.so.1: No such file or directorySo, I tweaked do_compile/do_install to use fipshmac from native instead of
target. If there is better way, please tell me.
Quoted 1 line
And if there are no questions, I'll send a v2 patch with an issue fixed for multilib.
Can you please show the fragment in the
Makefilewhere the target binary is executed? It is better to make a real patch that changes it to run a native binary, instead of changing it with sed. (sed patching is problematic because it's not clear from the recipe what is being done exactly, and how the original and the changed code looks like).Alex
Quoted 2 lines · On Thu, 5 May 2022 at 06:19, [email protected] <[email protected]>…
.libs/.$(gnutls_so).hmac: libgnutls.la fipshmac
$(AM_V_GEN) $(builddir)/fipshmac .libs/$(gnutls_so) > $@-t && mv $@-t $@
If fipshmac from -native is installed into the sysroot-native, then it will be in PATH, and then you can simply drop $(builddir)/ prefix with a simple patch.
Alex