Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update GnuPG and friends to 2.4.0 #1350

Closed
wants to merge 9 commits into from

Conversation

saper
Copy link
Contributor

@saper saper commented Mar 24, 2023

gnupg 2.2.21 -> 2.4.0
libgcrypt 1.8.6 -> 1.10.1
libassuan 2.5.3 -> 2.5.5
libksba 1.4.0 -> 1.6.3
libgpg-error 1.46

@saper saper marked this pull request as draft March 24, 2023 03:26
@tlaurion
Copy link
Collaborator

@saper: took your PR and pushed it on my github to be built by CircleCI at https://app.circleci.com/pipelines/github/tlaurion/heads/1561/workflows/933c2b4e-c532-4166-bec5-2be8ca9166f2 (CircleCI error).

@tlaurion
Copy link
Collaborator

tlaurion commented Mar 24, 2023

GPGRT_CONFIG is not found in libgcrypt configure script...
Related but not related https://dev.gnupg.org/T5365

@saper
Copy link
Contributor Author

saper commented Mar 24, 2023

afaik gpgrt-config is not strictly necessary. Looks like CI runs with a different compilation flags (-Werror ?), since I got the linker warning but everything works. We are actively removing rpath from binaries so it kind of does not wonder me. But probably this can be solved nicely.

@tlaurion
Copy link
Collaborator

tlaurion commented Mar 24, 2023

@saper This is the issue where solution is not working
https://dev.gnupg.org/T6257

Related patch proposed is to be tested, not merged, upstream (and doesn't fix the issue at stake):
https://dev.gnupg.org/rCe2c0920fd7dea6e254badd12958982c66080b7db
which superseded but is the same as
https://dev.gnupg.org/rE628cb1a786bd5d420be17c2e9ffd407f4fbf517e
Both referred per above issue.

@tlaurion
Copy link
Collaborator

tlaurion commented Mar 24, 2023

We rely on pkg-config to provide proper paths, where as of now, libgpg-error.so is found, but libgpg-error.so.1 is searched in wrong path and fails linking, both locally and under CircleCI (debian-11 based for build reproducibility (not to be confounded with reproducibility of builds. We just want a setup to recommend that works for all, in the meantime of having a build stack that produces same binaries).

I was trying to fix this and point you again to gpg-card binary addition (new from 2.3+) which needs to be explored to hopefully remove the screen scraping, that as you seen, is fragile and does not survive version bumps (and is a maintainership nightmare long term).

@tlaurion
Copy link
Collaborator

Updated #1350 (comment)

@tlaurion
Copy link
Collaborator

tlaurion commented Mar 24, 2023

@saper fails at https://app.circleci.com/pipelines/github/tlaurion/heads/1561/workflows/933c2b4e-c532-4166-bec5-2be8ca9166f2/jobs/19454?invite=true#step-103-1904

@saper if you had a previous version of libgpgerror.so where searched for, that is why it works in your build env but that lucky build cannot be made again anywhere else.

I wiped install/x86, had to rebuild complaining modules (eg: make BOARD=x230-hotp-maximized libgpg-error.clean) to reproduce same thing that CircleCI complains about. Make install statements of modules copy things under install/x86 which are then reused by modules that depend on them.

CircleCI on the other hand builds clean (3 levels of cache) where only coreboot buildstack was reused (musl-cross-make cache + build/x86/coreboot-) since modules/ definition changed, so the biggest cache could not be reused.

Biggest cache is the one containing build/x86/* and install/x86 cache, so basically building "clean" (with muslc-cross cache and coreboot builds cache).

@tlaurion
Copy link
Collaborator

https://app.circleci.com/pipelines/github/tlaurion/heads?branch=gnupg-2.4.0-update
Will try to talk to gniibe

@tlaurion
Copy link
Collaborator

tlaurion commented Mar 25, 2023

Seems like rhe issue are with tests not reusing same toolchain and libraries used for compilation. Getting rid of the faulty tests under libgcrypt might be the solution here

@saper
Copy link
Contributor Author

saper commented Mar 26, 2023

I have disconnected the tests from the libgcrypt build with 924f78f

@saper
Copy link
Contributor Author

saper commented Mar 28, 2023

Force pushed the last commit with a whitespace fix by @tlaurion

@tlaurion
Copy link
Collaborator

Note that ppc64 related patches are gone, will test those in next batch of tests, hopefully I will remember.

@tlaurion
Copy link
Collaborator

Some notes on size changes (produced by playing with initrd.cpio.xz under /tmp dir), comparing output of
xz -d initrd.cpio.xz ; cpio -i < initrd.cpio ; find . -type f -ls | sort -r -n -k7 |grep -v cpio | awk -F " " {'print $NF " " $7'} | sort > output

--- master-hotp-fbwhiptail/output	2023-03-27 14:02:18.647000000 -0400
+++ gpg24-hotp-fbwhiptail/output	2023-03-27 14:05:20.344000000 -0400
@@ -18,9 +18,12 @@
 ./bin/flash.sh 6653
 ./bin/flashtool 18336
 ./bin/generic-init 1345
-./bin/gpg 751456
-./bin/gpg-agent 314584
+./bin/gpg 828136
+./bin/gpg-agent 343984
+./bin/gpg-card 205704
+./bin/gpg-connect-agent 119216
 ./bin/gpg-gui.sh 9056
+./bin/gpgsm 442792
 ./bin/gpgv 150
 ./bin/gui-init 21584
 ./bin/hotp 5912
@@ -53,7 +56,7 @@
 ./bin/qrenc 5904
 ./bin/qubes-measure-luks 597
 ./bin/reboot 375
-./bin/scdaemon 346376
+./bin/scdaemon 450792
 ./bin/scp 22664
 ./bin/seal-hotpkey 3328
 ./bin/seal-totp 1545
@@ -72,7 +75,7 @@
 ./bin/whiptail 35
 ./bin/xx30-flash.init 639
 ./etc/ash_functions 1930
-./etc/config 625
+./etc/config 771
 ./etc/distro/keys/archlinux.key 1725
 ./etc/distro/keys/qubes-4.key 1629
 ./etc/distro/keys/qubes-testing.key 3078
@@ -95,11 +98,11 @@
 ./lib/libcryptsetup.so.12 403152
 ./lib/libc.so 596544
 ./lib/libdevmapper.so.1.02 284184
-./lib/libgcrypt.so.20 1054216
-./lib/libgpg-error.so.0 109520
+./lib/libgcrypt.so.20 776328
+./lib/libgpg-error.so.0 121704
 ./lib/libjson-c.so.5 81024
-./lib/libksba.so.8 199016
-./lib/libmbedcrypto.so.0 288272
+./lib/libksba.so.8 207216
+./lib/libmbedcrypto.so.0 325104
 ./lib/libnpth.so.0 14552
 ./lib/libpci.so.3 52272
 ./lib/libpci.so.3.5.4 52272
@@ -109,15 +112,18 @@
 ./lib/libqrencode.so.3 39232
 ./lib/libtpm.so 314728
 ./lib/libusb-0.1.so.4 18440
-./lib/libusb-1.0.so.0 84584
+./lib/libusb-1.0.so.0 92808
 ./lib/libuuid.so.1 14720
 ./lib/libz.so.1 108832
-./lib/modules/e1000e.ko 304272
-./lib/modules/ehci-hcd.ko 64800
-./lib/modules/ehci-pci.ko 10728
-./lib/modules/usb-storage.ko 132360
-./lib/modules/xhci-hcd.ko 159840
-./lib/modules/xhci-pci.ko 10568
+./lib/modules/e1000.ko 223136
+./lib/modules/ehci-hcd.ko 116912
+./lib/modules/ehci-pci.ko 12312
+./lib/modules/ohci-hcd.ko 73280
+./lib/modules/ohci-pci.ko 13896
+./lib/modules/uhci-hcd.ko 61320
+./lib/modules/usb-storage.ko 140888
+./lib/modules/xhci-hcd.ko 276096
+./lib/modules/xhci-pci.ko 13448
 ./mount-boot 1375
 ./output 0
 ./run/cryptsetup/.placeholder 0

@tlaurion
Copy link
Collaborator

Also note that neither gpg-connect-agent, gpgsm nor gpg-card are needed, but sizes above show respective added space consomption outside of initrd.cpio.xz being compressed (which can be obtained by comparing coreboot stitching output in logs of CircleCI output, and where addition of those 3 breaks builds of legacy boards and t520 board as of now).

I would advise removing gpg-connect-agent as well unless really necessary.
Screen scraping haven't changed that much, where next step on my side will be change functions under oem-factory-reset and separate them to more properly call key-attr changes, define type of key desired etc, where first step and goal on my side is prototype this to be useable to recreate current RSA 3072 keysize without breaking anything and do the same in ram and then key to card, and move from there.

@saper
Copy link
Contributor Author

saper commented Mar 28, 2023

Sure, we can drop gpg-connect-agent and gpgsm for now, if we use them only for testing.

@tlaurion
Copy link
Collaborator

Suppressed things further for gpg under https://github.com/tlaurion/heads/tree/gnupg-2.4.0-update

@tlaurion
Copy link
Collaborator

tlaurion commented Apr 5, 2023

Work in progress, smartcards do not seem to work

@saper what do you mean?

@tlaurion
Copy link
Collaborator

tlaurion commented Apr 5, 2023

@saper

Also note that the following would be needed for the factory reset/reownership wizard to work with 2.4

tlaurion@207c8b5

@@ -130,12 +128,12 @@ gpg_key_reset()
echo ${ADMIN_PIN_DEF}
echo ${USER_PIN_DEF}
echo 0
- echo y
echo ${GPG_USER_NAME}
echo ${GPG_USER_MAIL}
echo ${GPG_USER_COMMENT}
+ echo ${USER_PIN_DEF}

@saper saper marked this pull request as ready for review April 7, 2023 00:14
tlaurion added a commit to tlaurion/heads that referenced this pull request May 6, 2023
…on top of coreboot 4.19 and 5.10.5 test CircleCI build (see which boards won't take it on 5.x kernels)
@tlaurion
Copy link
Collaborator

tlaurion commented May 6, 2023

Note that ppc64 related patches are gone, will test those in next batch of tests, hopefully I will remember.

@saper damnit I forgot.
Any reason why that patch was removed?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically: why this patch has been removed for ppc64 @saper?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason, I probably made a mistake and though this has already been included upstream.

Copy link
Collaborator

@tlaurion tlaurion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have a quick answer on that it would be nice, otherwise will need to test.

saper and others added 9 commits May 7, 2023 18:04
198.15 -> 277.69 kB
676.03 -> 408.95 kB \o/
741.81 -> 502.42 kB
562.01 -> 783.14 kB
830.63 -> 917.89 kB
Tests require libgpg-error library built for the host machine
which we do not nessarily have in the build environment.
tlaurion added a commit to tlaurion/heads that referenced this pull request May 7, 2023
…on top of coreboot 4.19 and 5.10.5 test CircleCI build (see which boards won't take it on 5.x kernels)
@saper saper requested a review from tlaurion June 22, 2023 12:23
@tlaurion
Copy link
Collaborator

To be tested on top of #1381

@saper
Copy link
Contributor Author

saper commented Jun 23, 2023

I wouldn't hold my breath :(

@@ -53,6 +54,6 @@ gpg2_target := $(MAKE_JOBS) \
DESTDIR="$(INSTALL)" \
install

gpg2_output := g10/gpg agent/gpg-agent scd/scdaemon
gpg2_output := g10/gpg agent/gpg-agent scd/scdaemon tools/gpg-connect-agent
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should revert adding tools/gpg-connect-agent

@@ -13,7 +13,6 @@ libassuan_configure := \
--host $(MUSL_ARCH)-linux-musl \
--prefix "/" \
--disable-static \
--disable-debug \
Copy link
Collaborator

@tlaurion tlaurion Jun 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should revert removing --disable-debug?
--disable-doc can be enabled

@@ -41,6 +41,7 @@ gpg2_configure := \
--disable-wks-tools \
--disable-gnutls \
--disable-dirmngr \
--disable-ntbtls \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could add
--disable-libdns

@@ -1,10 +1,10 @@
modules-$(CONFIG_GPG2) += gpg2

gpg2_version := 2.2.21
gpg2_version := 2.4.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2.4.1 fixes issues with copy to card for yubikey.
2.4.2 is out.

@tlaurion
Copy link
Collaborator

tlaurion commented Jul 4, 2023

Merged under #1422 with minor modification

@tlaurion tlaurion closed this Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants