Skip to content

Commit

Permalink
Switch download verification from hash to signature
Browse files Browse the repository at this point in the history
Similar to the Linux kernel, the signature is over uncompressed file, so
uncompress it first (via DispVM if possible).
  • Loading branch information
marmarek committed Nov 13, 2024
1 parent fd648ac commit b6275f4
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
*.swp
*.tar.xz
*.tar
*.tar.sign
*.tar.xz.UNTRUSTED
*.bin
/pkgs/
5 changes: 4 additions & 1 deletion .qubesbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ host:
source:
files:
- url: https://www.kernel.org/pub/linux/kernel/firmware/linux-firmware-@[email protected]
sha512: linux-firmware-@[email protected]
signature: https://www.kernel.org/pub/linux/kernel/firmware/linux-firmware-@[email protected]
uncompress: true
pubkeys:
- firmware-1-key.asc
29 changes: 23 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ VERSION := $(shell cat version)

FEDORA_SOURCES := https://src.fedoraproject.org/rpms/linux-firmware/raw/f$(subst fc,,$(DIST))/f/sources
SRC_FILE := linux-firmware-$(VERSION).tar.xz
SRC_TARFILE := linux-firmware-$(VERSION).tar
SIGN_FILE := $(SRC_TARFILE).sign

BUILDER_DIR ?= ../..
SRC_DIR ?= qubes-src
Expand All @@ -21,13 +23,28 @@ ifeq ($(FETCH_CMD),)
$(error "You can not run this Makefile without having FETCH_CMD defined")
endif

%: %.sha512
@$(FETCH_CMD) $@$(UNTRUSTED_SUFF) -- $(DISTFILES_MIRROR)$@
@sha512sum --status -c <(printf "$$(cat $<) -\n") <$@$(UNTRUSTED_SUFF) || \
{ echo "Wrong SHA512 checksum on $@$(UNTRUSTED_SUFF)!"; exit 1; }
@mv $@$(UNTRUSTED_SUFF) $@
.INTERMEDIATE: firmware-keyring.gpg
firmware-keyring.gpg: firmware-1-key.asc
cat $^ | gpg --dearmor >$@

get-sources: $(SRC_FILE)
.INTERMEDIATE: $(SRC_TARFILE)$(UNTRUSTED_SUFF)
%.tar$(UNTRUSTED_SUFF): %.tar.xz$(UNTRUSTED_SUFF)
if [ -f /usr/bin/qvm-run-vm ]; \
then qvm-run-vm --no-gui --dispvm 2>/dev/null xzcat <$< > $@; \
else xzcat <$< > $@; fi

$(SRC_TARFILE): $(SRC_TARFILE)$(UNTRUSTED_SUFF) $(SIGN_FILE) firmware-keyring.gpg
gpgv --keyring ./$(word 3,$^) $(word 2,$^) $(word 1,$^) || \
{ echo "Wrong signature on $@$(UNTRUSTED_SUFF)!"; exit 1; }
mv $@$(UNTRUSTED_SUFF) $@

$(SRC_FILE)$(UNTRUSTED_SUFF):
@$(FETCH_CMD) $@ -- $(DISTFILES_MIRROR)$(SRC_FILE)

$(SIGN_FILE):
@$(FETCH_CMD) $(SIGN_FILE) -- $(DISTFILES_MIRROR)$@

get-sources: $(SRC_TARFILE)
@true

verify-sources:
Expand Down
101 changes: 101 additions & 0 deletions firmware-1-key.asc
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----

mQINBE6HwcoBEADEsPaBiaRbGU2GLvWupHRLz7weXiVk21bFrh7lno2YPtvOqDR9
TP4BIzk2+53AhWadF0dhzKI1NeG2od8fofEHMMbI467/7gzEB78Rv4+3Srwz1Zu0
bMFJPcdtAvBaJvHB6wP6mCl0eGCFIX9dN2ktr3GW6Z+mxxCeD+7Sm43Lt7PXU6Ff
W9sMmwxgV/ytXGEsZjM0MIcxUpTKX1WAEAK6Sjlv5No7tphHGR6B4eWWRXTB+CUE
gYsVRfx0LI1cHiZCWYb5P65iy29IxSzy/8/jcTVuFKUyVMxNolfzF9HonL7iRCel
oGDRGcCSPhftuCVC6dfBT1/XDHC9LuYVVfJQ1lT/yooBDkWmFoT3HWW2OjCECCVe
wsTS0C42xGpNab6iytaG2L6AWZh27XMi4V9rGGjaskmbpa4Inu3/SIClxXqc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uzawh7lxv3Sgg
2/K8xfUybfDHXnPox76X6QYN90mLhRQaCvuVuUPC6Jt5RlQujHCFff1hbKNdqEXH
roxoWaYNUrNnt4HB3xe/tUxjT2d9VWb3YAGe4dcEidDcx3dwsqslvECynA/BHX3f
SQirvYs7JYGY4wERkYgtsc3s8DJTJWEbRA3FQeRwg1nnK9nYjMDur7ndwQ+0wMxP
1k++aWiNO9xsQtlGhFp/GnQmppklSbU3szbqEESq5hjVrzg1AxWktipJpTcCvJtZ
7QePzFWrIXHJQTL4F53Mx5Pwnk4erTesZpjKwrBYNrzUvL2qV49aC1Pnp/USu9Dw
Ss4LTzVuhd9bGxoOmigewI4HFS3cTLVyZX7a9p9/KRqWsR526oJP+els4fusIOlZ
PIxNs825zBUFBXmh8Z3Z/ejWCz5eXyBbpFgoaiqN+mud7awQUSQtf6SLGbEYWD8=
=mmSu
-----END PGP PUBLIC KEY BLOCK-----
1 change: 0 additions & 1 deletion linux-firmware-20240811.tar.xz.sha512

This file was deleted.

2 changes: 1 addition & 1 deletion linux-firmware.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ URL: http://www.kernel.org/
BuildArch: noarch
Epoch: 1

Source0: https://www.kernel.org/pub/linux/kernel/firmware/%{name}-%{version}.tar.xz
Source0: %{name}-%{version}.tar

BuildRequires: make
BuildRequires: git-core
Expand Down

0 comments on commit b6275f4

Please sign in to comment.