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

Add support for GnuPG2 #454

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
df4438a
Preliminary support for GnuPG2
druimalban Jan 5, 2018
d740fe4
Merge branch 'gnupg2' of https://github.com/duncanguthrie/heads into …
osresearch Sep 18, 2018
df8462a
copy gpg2 executables and pass in the libusb include path
osresearch Sep 18, 2018
aa2d3cd
switch to gpg2 for qemu targets
osresearch Sep 18, 2018
533f18a
use full version names on output libraries
osresearch Sep 18, 2018
921010f
enable Unix Domain sockets for gpg-agent
osresearch Sep 19, 2018
cb418ca
gpg2 library fixes
tlaurion Sep 19, 2018
cc062bd
gpg2 pinentry program is required for passwords or PINs
osresearch Sep 19, 2018
8fbe910
typo on pinentry
osresearch Sep 19, 2018
87c85ca
required changes to apply on top of osresearch/gpg2 for gpg2 to actua…
tlaurion Oct 5, 2018
d9220f5
use /bin for libexecdir and disable curses pinentry
osresearch Oct 17, 2018
0978cb4
Merge branch 'gpg2_patch' of https://github.com/tlaurion/heads into gpg2
osresearch Oct 17, 2018
42a13bc
gpg2 pubring extension change from gpg to kbx
tlaurion Nov 15, 2018
91886bb
pinentry-tty path needs to be known from gpg-agent
tlaurion Nov 15, 2018
cc89d68
gpg needs to be called with --no-tty at that point, since pintentry-t…
tlaurion Nov 15, 2018
6623374
GPG_TTY is forced to /dev/console under init. Ash console is never ca…
tlaurion Nov 15, 2018
a2e9e4c
instruct gpg to use gpg-agent.
tlaurion Nov 15, 2018
5d3ac09
Port gpg1 patch to gpg2 to force crosscompiling and output to stderr.
tlaurion Nov 15, 2018
478af24
Merge branch 'gpg2-clean-working_atop-osresearch_gpg2' of https://git…
osresearch Nov 23, 2018
186d211
Set GPG_TTY before calling gpg in key-init
jandryuk Dec 1, 2018
765bdbc
Removed --no-tty as it disables the card admin PIN pinentry
itay-grudev Jan 3, 2019
979dc68
Enabled GPG2 in the Librem board config
itay-grudev Jan 4, 2019
2b7c3b8
Disabled libsecret support in the pinentry module
itay-grudev Jan 4, 2019
142d601
Code style fix
itay-grudev Jan 7, 2019
5eeb78b
Merge pull request #491 from tlaurion/gpg2_dynamic_tty
tlaurion Jan 26, 2019
1699771
Merge pull request #505 from itay-grudev/gpg2-fix
tlaurion Jan 26, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ bin_modules-$(CONFIG_PCIUTILS) += pciutils
bin_modules-$(CONFIG_FLASHROM) += flashrom
bin_modules-$(CONFIG_CRYPTSETUP) += cryptsetup
bin_modules-$(CONFIG_GPG) += gpg
bin_modules-$(CONFIG_GPG2) += gpg2
bin_modules-$(CONFIG_PINENTRY) += pinentry
bin_modules-$(CONFIG_LVM2) += lvm2
bin_modules-$(CONFIG_DROPBEAR) += dropbear
bin_modules-$(CONFIG_FLASHTOOLS) += flashtools
Expand Down
1 change: 1 addition & 0 deletions boards/librem13v2/librem13v2.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ CONFIG_CRYPTSETUP=y
CONFIG_FLASHROM=y
CONFIG_FLASHTOOLS=y
CONFIG_GPG=y
CONFIG_GPG2=y
CONFIG_KEXEC=y
CONFIG_UTIL_LINUX=y
CONFIG_LVM2=y
Expand Down
1 change: 1 addition & 0 deletions boards/librem15v3/librem15v3.config
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ CONFIG_CRYPTSETUP=y
CONFIG_FLASHROM=y
CONFIG_FLASHTOOLS=y
CONFIG_GPG=y
CONFIG_GPG2=y
CONFIG_KEXEC=y
CONFIG_UTIL_LINUX=y
CONFIG_LVM2=y
Expand Down
2 changes: 1 addition & 1 deletion boards/qemu-coreboot/qemu-coreboot.config
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ CONFIG_FLASHROM=y
CONFIG_PCIUTILS=y
CONFIG_UTIL_LINUX=y
CONFIG_CRYPTSETUP=y
CONFIG_GPG=y
CONFIG_GPG2=y
CONFIG_LVM2=y
CONFIG_MBEDTLS=y
CONFIG_DROPBEAR=y
Expand Down
2 changes: 1 addition & 1 deletion boards/qemu-linuxboot/qemu-linuxboot.config
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ endif

CONFIG_FLASHROM=y
CONFIG_FLASHTOOLS=y
CONFIG_GPG=y
CONFIG_GPG2=y
CONFIG_KEXEC=y
CONFIG_UTIL_LINUX=y
CONFIG_DROPBEAR=y
Expand Down
2 changes: 1 addition & 1 deletion boards/x230/x230.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CONFIG_LINUX_CONFIG=config/linux-x230.config
CONFIG_CRYPTSETUP=y
CONFIG_FLASHROM=y
CONFIG_FLASHTOOLS=y
CONFIG_GPG=y
CONFIG_GPG2=y
CONFIG_KEXEC=y
CONFIG_UTIL_LINUX=y
CONFIG_LVM2=y
Expand Down
1 change: 1 addition & 0 deletions config/linux-kgpe-d16.config
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ CONFIG_PCI_PRI=y
# CONFIG_COREDUMP is not set
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_SYN_COOKIES=y
# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
Expand Down
1 change: 1 addition & 0 deletions config/linux-librem13v2.config
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ CONFIG_PCI_PRI=y
# CONFIG_COREDUMP is not set
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_SYN_COOKIES=y
# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
Expand Down
1 change: 1 addition & 0 deletions config/linux-linuxboot.config
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ CONFIG_PCI_PRI=y
CONFIG_IA32_EMULATION=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_SYN_COOKIES=y
# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
Expand Down
1 change: 1 addition & 0 deletions config/linux-qemu.config
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ CONFIG_PCI_PRI=y
CONFIG_IA32_EMULATION=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_SYN_COOKIES=y
# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
Expand Down
1 change: 1 addition & 0 deletions config/linux-x230.config
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ CONFIG_PCI_PRI=y
# CONFIG_COREDUMP is not set
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_SYN_COOKIES=y
# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
Expand Down
3 changes: 3 additions & 0 deletions initrd/.gnupg/gpg-agent.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
scdaemon-program /bin/scdaemon
pinentry-program /bin/pinentry-tty
daemon
1 change: 1 addition & 0 deletions initrd/.gnupg/gpg.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use-agent
12 changes: 6 additions & 6 deletions initrd/bin/flash-gui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,10 @@ while true; do

cat $PUBKEY | gpg --import
cp $ROM /tmp/gpg-gui.rom
if (cbfs -o /tmp/gpg-gui.rom -l | grep -q "heads/initrd/.gnupg/pubring.gpg") then
cbfs -o /tmp/gpg-gui.rom -d "heads/initrd/.gnupg/pubring.gpg"
if (cbfs -o /tmp/gpg-gui.rom -l | grep -q "heads/initrd/.gnupg/pubring.kbx") then
cbfs -o /tmp/gpg-gui.rom -d "heads/initrd/.gnupg/pubring.kbx"
fi
cbfs -o /tmp/gpg-gui.rom -a "heads/initrd/.gnupg/pubring.gpg" -f /.gnupg/pubring.gpg
cbfs -o /tmp/gpg-gui.rom -a "heads/initrd/.gnupg/pubring.kbx" -f /.gnupg/pubring.kbx

if (cbfs -o /tmp/gpg-gui.rom -l | grep -q "heads/initrd/.gnupg/trustdb.gpg") then
cbfs -o /tmp/gpg-gui.rom -d "heads/initrd/.gnupg/trustdb.gpg"
Expand Down Expand Up @@ -180,10 +180,10 @@ while true; do
fi

cat $PUBKEY | gpg --import
if (cbfs -o /tmp/gpg-gui.rom -l | grep -q "heads/initrd/.gnupg/pubring.gpg") then
cbfs -o /tmp/gpg-gui.rom -d "heads/initrd/.gnupg/pubring.gpg"
if (cbfs -o /tmp/gpg-gui.rom -l | grep -q "heads/initrd/.gnupg/pubring.kbx") then
cbfs -o /tmp/gpg-gui.rom -d "heads/initrd/.gnupg/pubring.kbx"
fi
cbfs -o /tmp/gpg-gui.rom -a "heads/initrd/.gnupg/pubring.gpg" -f /.gnupg/pubring.gpg
cbfs -o /tmp/gpg-gui.rom -a "heads/initrd/.gnupg/pubring.kbx" -f /.gnupg/pubring.kbx

if (cbfs -o /tmp/gpg-gui.rom -l | grep -q "heads/initrd/.gnupg/trustdb.gpg") then
cbfs -o /tmp/gpg-gui.rom -d "heads/initrd/.gnupg/trustdb.gpg"
Expand Down
4 changes: 4 additions & 0 deletions initrd/init
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ fi
if [ "$CONFIG_LINUXBOOT" = "y" ]; then
/bin/uefi-init
fi

# Set GPG_TTY before calling gpg in key-init
export GPG_TTY=$(tty)

/bin/key-init

# Setup recovery serial shell
Expand Down
60 changes: 60 additions & 0 deletions modules/gpg2
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
modules-$(CONFIG_GPG2) += gpg2

gpg2_version := 2.2.10
gpg2_dir := gnupg-$(gpg2_version)
gpg2_tar := gnupg-$(gpg2_version).tar.bz2
gpg2_url := https://www.gnupg.org/ftp/gcrypt/gnupg/$(gpg2_tar)
gpg2_hash := 799dd37a86a1448732e339bd20440f4f5ee6e69755f6fd7a73ee8af30840c915

# For reproducibility reasons we have to override the exec_prefix
# and datarootdir on the configure line so that the Makefiles will
# be generated with the correct paths, but then re-write them when
# we use the install target so that they will be copied to the correct
# location.
gpg2_configure := ./configure \
$(CROSS_TOOLS) \
CPPFLAGS="-I$(INSTALL)/include/libusb-1.0" \
--host x86_64-linux-musl \
--with-libusb="$(INSTALL)" \
--with-libgpg-error-prefix="$(INSTALL)" \
--with-libgcrypt-prefix="$(INSTALL)" \
--with-libassuan-prefix="$(INSTALL)" \
--with-ksba-prefix="$(INSTALL)" \
--with-npth-prefix="$(INSTALL)" \
--prefix "/" \
--libexecdir "/bin" \
--enable-scdaemon \
--enable-ccid-driver \
--disable-tofu \
--disable-rpath \
--disable-regex \
--disable-doc \
--disable-bzip2 \
--disable-asm \
--disable-exec \
--disable-photo-viewers \
--disable-keyserver-helpers \
--disable-ldap \
--disable-hkp \
--disable-finger \
--disable-dns-srv \
--disable-dns-cert \
--disable-regex \
--disable-nls \
--disable-all-tests \
--disable-wks-server \
--disable-wks-tools \
--disable-gnutls \
--disable-dirmngr \

# Run one build to generate the executables with the pre-defined
# exec_prefix and datarootdir, then a second make to install the binaries
# into our actual target location
gpg2_target := $(MAKE_JOBS) \
&& $(MAKE) -C $(build)/$(gpg2_dir) \
DESTDIR="$(INSTALL)" \
install

gpg2_output := g10/gpg agent/gpg-agent scd/scdaemon

gpg2_depends := libgpg-error libgcrypt libksba libassuan npth libusb-compat $(musl_dep)
24 changes: 24 additions & 0 deletions modules/libassuan
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
modules-$(CONFIG_GPG2) += libassuan
libassuan_version := 2.5.1
libassuan_dir := libassuan-$(libassuan_version)
libassuan_tar := libassuan-$(libassuan_version).tar.bz2
libassuan_url := https://gnupg.org/ftp/gcrypt/libassuan/$(libassuan_tar)
libassuan_hash := 47f96c37b4f2aac289f0bc1bacfa8bd8b4b209a488d3d15e2229cb6cc9b26449

libassuan_configure := ./configure \
$(CROSS_TOOLS) \
--host x86_64-linux-musl \
--prefix "/" \
--disable-static \
--disable-nls \
--with-libgpg-error-prefix="$(INSTALL)" \
--disable-asm \

libassuan_target := $(MAKE_JOBS) \
DESTDIR="$(INSTALL)" \
$(CROSS_TOOLS) \
install \

libassuan_libraries := src/.libs/libassuan.so.0

libassuan_depends := libgpg-error $(musl_dep)
24 changes: 24 additions & 0 deletions modules/libgcrypt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
modules-$(CONFIG_GPG2) += libgcrypt
libgcrypt_version := 1.8.3
libgcrypt_dir := libgcrypt-$(libgcrypt_version)
libgcrypt_tar := libgcrypt-$(libgcrypt_version).tar.bz2
libgcrypt_url := https://gnupg.org/ftp/gcrypt/libgcrypt/$(libgcrypt_tar)
libgcrypt_hash := 66ec90be036747602f2b48f98312361a9180c97c68a690a5f376fa0f67d0af7c

libgcrypt_configure := ./configure \
$(CROSS_TOOLS) \
--host=x86_64-linux-musl \
--prefix "/" \
--disable-static \
--with-libgpg-error-prefix="$(INSTALL)" \
--disable-asm \
--disable-nls \

libgcrypt_target := $(MAKE_JOBS) \
DESTDIR="$(INSTALL)" \
$(CROSS_TOOLS) \
install \

libgcrypt_libraries := src/.libs/libgcrypt.so.20

libgcrypt_depends := libgpg-error $(musl_dep)
26 changes: 26 additions & 0 deletions modules/libgpg-error
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
modules-$(CONFIG_GPG2) += libgpg-error
libgpg-error_version := 1.32
libgpg-error_dir := libgpg-error-$(libgpg-error_version)
libgpg-error_tar := libgpg-error-$(libgpg-error_version).tar.bz2
libgpg-error_url := https://gnupg.org/ftp/gcrypt/libgpg-error/$(libgpg-error_tar)
libgpg-error_hash := c345c5e73cc2332f8d50db84a2280abfb1d8f6d4f1858b9daa30404db44540ca

libgpg-error_configure := ./configure \
$(CROSS_TOOLS) \
--prefix "/" \
--host=x86_64-linux-musl \
--disable-static \
--disable-nls \
--disable-languages \
--disable-doc \
--disable-tests \
--disable-asm \

libgpg-error_target := $(MAKE_JOBS) \
DESTDIR="$(INSTALL)" \
$(CROSS_TOOLS) \
install \

libgpg-error_libraries := src/.libs/libgpg-error.so.0

libgpg-error_depends := $(musl_dep)
24 changes: 24 additions & 0 deletions modules/libksba
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
modules-$(CONFIG_GPG2) += libksba
libksba_version := 1.3.5
libksba_dir := libksba-$(libksba_version)
libksba_tar := libksba-$(libksba_version).tar.bz2
libksba_url := https://gnupg.org/ftp/gcrypt/libksba/$(libksba_tar)
libksba_hash := 41444fd7a6ff73a79ad9728f985e71c9ba8cd3e5e53358e70d5f066d35c1a340

libksba_configure := ./configure \
$(CROSS_TOOLS) \
--host x86_64-linux-musl \
--prefix "/" \
--disable-static \
--disable-nls \
--with-libgpg-error-prefix="$(INSTALL)" \
--disable-asm \

libksba_target := $(MAKE_JOBS) \
DESTDIR="$(INSTALL)" \
$(CROSS_TOOLS) \
install \

libksba_libraries := src/.libs/libksba.so.8

libksba_depends := libgpg-error $(musl_dep)
13 changes: 8 additions & 5 deletions modules/libusb
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
# GPG with Yubikey support requires libusb
modules-$(CONFIG_GPG) += libusb
modules-$(CONFIG_GPG2) += libusb

libusb_version := 1.0.21
libusb_dir := libusb-$(libusb_version)
libusb_tar := libusb-$(libusb_version).tar.bz2
libusb_url := https://downloads.sourceforge.net/project/libusb/libusb-1.0/libusb-$(libusb_version)/$(libusb_tar)
libusb_hash := 7dce9cce9a81194b7065ee912bcd55eeffebab694ea403ffb91b67db66b1824b

libusb_configure := ./configure \
$(CROSS_TOOLS) \
--host i386-elf-linux \
--prefix "/" \
--disable-udev \
libusb_configure := ./configure\
$(CROSS_TOOLS)\
--host i386-elf-linux\
--prefix "/"\
--disable-udev\
--disable-tests\

# Run one build to generate the executables with the pre-defined
# exec_prefix and datarootdir, then a second make to install the binaries
# into our actual target location

libusb_target := $(MAKE_JOBS) \
DESTDIR="$(INSTALL)" \
$(CROSS_TOOLS) \
Expand Down
2 changes: 2 additions & 0 deletions modules/libusb-compat
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# GPG 1.4.21 uses an old version of libusb, which
# is emulated with the compatibility library.
# This is a bit of a hack to set it up.

modules-$(CONFIG_GPG) += libusb-compat
modules-$(CONFIG_GPG2) += libusb-compat

libusb-compat_version := 0.1.5
libusb-compat_dir := libusb-compat-$(libusb-compat_version)
Expand Down
24 changes: 24 additions & 0 deletions modules/npth
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
modules-$(CONFIG_GPG2) += npth
npth_version := 1.6
npth_dir := npth-$(npth_version)
npth_tar := npth-$(npth_version).tar.bz2
npth_url := https://gnupg.org/ftp/gcrypt/npth/$(npth_tar)
npth_hash := 1393abd9adcf0762d34798dc34fdcf4d0d22a8410721e76f1e3afcd1daa4e2d1

npth_configure := ./configure \
$(CROSS_TOOLS) \
--host x86_64-linux-musl \
--prefix "/" \
--disable-static \
--disable-nls \
--with-libgpg-error-prefix="$(INSTALL)" \
--disable-asm \

npth_target := $(MAKE_JOBS) \
DESTDIR="$(INSTALL)" \
$(CROSS_TOOLS) \
install \

npth_libraries := src/.libs/libnpth.so.0

npth_depends := libgpg-error $(musl_dep)
Loading