Commit Graph

477 Commits

Author SHA1 Message Date
Peter Hatina 5526d1d647 Set weak default value for VENDOR_UUID
This fixes the required order of layers.

Signed-off-by: Peter Hatina <peter@hatina.eu>
2022-05-31 13:05:45 +08:00
corey cothrum b4522579c0 (conditionally) add 'tpm' to list of grub built-in modules
If tpm/tpm2 is enabled in DISTRO features, add the grub 'tpm' module to
GRUB_BUILDIN.

This is now required for secureboot to work w/ TPM is also enabled in a
BIOS.
2022-04-12 08:34:09 +08:00
Yi Zhao bbd671ca72 meta-secure-core: Handle bitbake variable renaming
This is the result of automated script conversion:
poky/scripts/contrib/convert-variable-renames.py meta-secure-core

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2022-04-08 09:05:06 +08:00
Yi Zhao 56731a69db recipes: Update LICENSE variable to use SPDX license identifiers
Fix QA warnings:
WARNING: efitools-1.9.2+gitAUTOINC+392836a46c-r0 do_package_qa: QA Issue: Recipe LICENSE includes obsolete licenses GPLv2 [obsolete-license]
WARNING: mokutil-0.3.0+gitAUTOINC+e19adc575c-r0 do_package_qa: QA Issue: Recipe LICENSE includes obsolete licenses GPLv3 [obsolete-license]

This is the result of automated script conversion:
poky/scripts/contrib/convert-spdx-licenses.py meta-secure-core

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2022-04-08 09:05:06 +08:00
Hongxu Jia 5d274050c7 grub-efi: split grub serure builtin option from GRUB_BUILDIN
Use variable GRUB_SECURE_BUILDIN to split grub secure
builtin option from GRUB_BUILDIN, then GRUB_BUILDIN will
not contain secure option for others grub-mkimage to
create no secure grub even though secure boot is enabled

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
2022-03-15 10:02:19 +08:00
Changqing Li c2029ebb5a mtree: update LICENSE variant
Fix warning:
WARNING: QA Issue: mtree: No generic license file exists for: BSD in any provider [license-exists]

Signed-off-by: Changqing Li <changqing.li@windriver.com>
2022-02-20 08:31:00 +08:00
richard 4f0cadf438 added newline 2021-11-19 21:25:00 +08:00
richard ca4ead2536 changed init file from the secure-core-image-initramfs to not load an unencrypted rootfs when using full disk encryption. 2021-11-19 21:25:00 +08:00
Yi Zhao 2bd48852e2 meta-secure-core: fix wrong operator combination
Operations like XXX:append += "YYY" are almost always wrong and this
is a common mistake made in the metadata. Improve them to use the
standard format.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-11-18 13:58:20 +08:00
Yi Zhao fea6a37625 recipes: update SRC_URI branch and protocols
Update SRC_URIs using git to include branch=master if no branch is set
and also to use protocol=https for github urls.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-11-15 09:56:02 +08:00
Changqing Li c14c00f483 rpm-native: disable audit plugin
enable this plugin will cause undeterministic build. whether to build
audit plugin depends on whether libaudit exists on the host

Signed-off-by: Changqing Li <changqing.li@windriver.com>
2021-11-12 16:53:12 +08:00
Yi Zhao 4ddcbda60d cryptfs-tpm2: upgrade to latest git rev
Drop backported patches.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-11-12 16:52:32 +08:00
Yi Zhao 8226df83a6 tpm2-tools: upgrade 4.1.3 -> 4.3.2
* Drop backported CVE patch.
* License-Update: Add Copyrights and move it to doc directory.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-11-12 16:52:32 +08:00
Yi Zhao 1d1bd5934b tpm2-abrmd: upgrade 2.3.2 -> 2.3.3
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-11-12 16:52:32 +08:00
Yi Zhao d3a025a3d5 tpm2-tss: backport fixes for openssl 3.0
Backport 3 patches from master branch for openssl 3.0:
https://github.com/tpm2-software/tpm2-tss/commit/73d25d6834ad362f9a9a907cb78452deaa336ec0
https://github.com/tpm2-software/tpm2-tss/commit/362fda1daa398da2944e76013c215500761d46a5
https://github.com/tpm2-software/tpm2-tss/commit/e5bb5fb9f070c619415160f8889c372b769431b8

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-11-12 16:52:32 +08:00
Yi Zhao 59a7c40fe7 tpm2-tss: upgrade 2.3.3 -> 2.4.6
Add PACKAGECONFIG[fapi] to enable/disable FAPI.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-11-12 16:52:32 +08:00
Peter Hatina 5fcb2f0e67 grub-efi: Remove $cmdpath from configuration for for grub-mkimage
Signed-off-by: Peter Hatina <peter@hatina.eu>
2021-10-29 15:37:21 +08:00
Yi Zhao 3fa3fc6dcb efitools: fix openssl.cnf path for openssl 3.0
Fix openssl.cnf path for openssl 3.0 to make sure openssl command can
find it.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-10-21 15:57:54 +08:00
Yi Zhao 4caca5b780 tpm2-tools: fix build with openssl 3.0
Backport a patch to disable '-Werror' to fix build error until upstream
addresses openssl 3.0 compatibility issue.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-10-21 15:57:54 +08:00
Yi Zhao b308dc89ac sbsigntool: fix openssl-3.0 issue involving ASN1_ITEM TYPE_it
Use ASN1_ITEM_rptr() instead of taking the address of IDC_PEID_it.

Openssl-3.0 changed the type of TYPE_it from `const ASN1_ITEM TYPE_it`
to `const ASN1_ITEM *TYPE_it(void)`. This was previously hidden behind
OPENSSL_EXPORT_VAR_AS_FUNCTION but in 3.0 only the function version is
available. This change should have been transparent to the application,
but only if the `ASN1_ITEM_rptr()` macro is used.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-10-21 15:57:54 +08:00
Yi Zhao 4dc1be23d9 sbsigntool: fix build with openssl 3.0
Disable '-Werror' to prevent openssl 3.0 deprecation warnings turning
into errors until upstream addresses openssl 3.0 compatibility issue.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-10-21 15:57:54 +08:00
Yi Zhao cb56933902 sbsigntool: fix commented-out override syntax
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-08-26 18:35:42 +08:00
Mathieu Dubois-Briand 5a3129c901 trousers: fix init script with multi-tpm systems
Signed-off-by: Mathieu Dubois-Briand <mbriand@witekio.com>
2021-08-21 16:50:40 +08:00
Yi Zhao b988150cf3 cryptfs-tpm2: fix encrypt_secret.py for python3
Fixes:
encrypt_secret.py -i "H31i05" > "primary_key.secret" || exit 1
ERROR: Unable to encrypt the secret

Suggested-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-08-20 18:36:08 +08:00
Yi Zhao 62b388cf72 libsign: fix LDFLAGS expansion
When LDFLAGS expands, The -fmacro-prefix-map and -fdebug-prefix-map will
be prefixed with -Wl, which will cause compilation error:
ld: -f may not be used without -shared

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-08-20 15:59:51 +08:00
Yi Zhao dad89db9b9 libsign: fix build reproducibility issue
Fixes:
| selsign.c: In function 'show_banner':
| selsign.c:57:62: error: macro "__DATE__" might prevent reproducible builds [-Werror=date-time]
|    57 |         info_cont("Build Time: " __DATE__ " " __TIME__ "\n\n");
|       |                                                              ^
| selsign.c:57:34: error: macro "__TIME__" might prevent reproducible builds [-Werror=date-time]
|    57 |         info_cont("Build Time: " __DATE__ " " __TIME__ "\n\n");
|       |                                  ^~~~~~~~
| cc1: all warnings being treated as errors

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-08-20 15:59:51 +08:00
Yi Zhao e004d37650 cryptfs-tpm2: fix LDFLAGS expansion
When LDFLAGS expands, The -fmacro-prefix-map and -fdebug-prefix-map will
be prefixed with -Wl, which will cause compilation error:
ld: -f may not be used without -shared

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-08-20 15:59:51 +08:00
Yi Zhao 66a1d0582c README: fix typos
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-08-20 15:59:51 +08:00
Chen Qi 438190a471 layer.conf: add back append to BB_HASHBASE_WHITELIST
Add back the append override, as the '+=' operator will make the
default value of BB_HASHBASE_WHITELIST in oe-core not have any
effect.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
2021-08-16 20:39:40 +08:00
Yi Zhao 626750b839 README: update
The image-prelink feature has been disabled by default in oe-core commit
f9719cc1c3fe9d380336e7af418daf27473b2e8b. We don't need to remove it
explicitly in local.conf.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-08-09 18:51:13 +08:00
Yi Zhao 0e475df858 secure-core-image: pass encrypted password rather than plaintext password to usermod
In oe-core commit 759df7395908f18b3b68f28d043ac9ebd42dd0c8, the
plaintext password setting function was dropped because of the security
issue. So the plaintext password setting method "usermod -P 'password'
user" is not available. Now we should pass the encrypted password to
usermod via -p option.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-08-09 18:51:13 +08:00
Yi Zhao 9f03a89db8 layer.conf: add honister to LAYERSERIES_COMPAT
Drop other releases since they are not compatible anymore.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-08-09 18:51:13 +08:00
Yi Zhao 4042043742 meta-secure-core: Convert to new override syntax
Converting the metadata to use ":" as the override character instead of "_".

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-08-09 18:51:13 +08:00
Yi Zhao 6768abc7d4 cryptfs-tpm2: fix build reproducibility issue
Fixes:
| main.c: In function 'show_banner':
| main.c:43:62: error: macro "__DATE__" might prevent reproducible builds [-Werror=date-time]
|    43 |         info_cont("Build Time: " __DATE__ " " __TIME__ "\n\n");
|       |                                                              ^
| main.c:43:34: error: macro "__TIME__" might prevent reproducible builds [-Werror=date-time]
|    43 |         info_cont("Build Time: " __DATE__ " " __TIME__ "\n\n");
|       |                                  ^~~~~~~~
| cc1: all warnings being treated as errors

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-08-09 18:51:13 +08:00
Mingli Yu b84dc32e1d shim_git: fix the do_fetch warning
Fixes:
WARNING: shim-12+gitAUTOINC+5202f80c32-r0 do_fetch: Failed to fetch URL git://github.com/rhboot/shim.git, attempting MIRRORS if available

Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
2021-07-29 18:44:07 +08:00
Yi Zhao c38e155c36 sbsigntool: update PV
The current latest version is 0.9.4 rather than 0.9.2.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-07-07 14:26:51 +08:00
Yi Zhao 31502fb8f2 sbsigntool: fix compile error when enable DEBUG_BUILD
Fixes the following errors when set DEBUG_BUILD = "1":
fileio.c: In function ‘__fileio_read_file’:
fileio.c:179:12: error: ‘len’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  179 |   *out_len = len;
      |   ~~~~~~~~~^~~~~
fileio.c:178:12: error: ‘buf’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  178 |   *out_buf = buf;
      |   ~~~~~~~~~^~~~~

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-07-07 14:26:51 +08:00
Robert Yang 551137d4eb sbsigntool: Fix for target build
* Remove unnecessary inherit native
This is a target recipe, the "inherit native" is not needed, the
sbsigntool-native is extended by BBCLASSEXTEND which is already present.

Fixed when multilib is enabled:
$ bitbake lib32-sbsigntool
ERROR: Nothing PROVIDES 'lib32-sbsigntool'.

* Add util-linux-libuuid to DEPENDS since it is required by target build

* Add read_write_all.c to common_SOURCES to fix build errors.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
2021-07-07 14:26:51 +08:00
Yi Zhao 0e8603b1ea tpm2-tools: fix CVE-2021-3565
CVE-2021-3565:
A flaw was found in tpm2-tools in versions before 5.1.1 and before
4.3.2. tpm2_import used a fixed AES key for the inner wrapper,
potentially allowing a MITM attacker to unwrap the inner portion and
reveal the key being imported. The highest threat from this
vulnerability is to data confidentiality.

Reference:
https://nvd.nist.gov/vuln/detail/CVE-2021-3565

Patch from:
https://github.com/tpm2-software/tpm2-tools/commit/c069e4f179d5e6653a84fb236816c375dca82515

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-07-07 14:26:45 +08:00
Yi Zhao ba04fbba71 create-user-key-store.sh: use grub2-mkpasswd-pbkdf2 rather than grub-mkpasswd-pbkdf2 on RHEL/CentOS/Fedora
On RHEL/CentOS/Fedora, there is no grub-mkpasswd-pbkdf2 command but
grub2-mkpasswd-pbkdf2. Update the script to locate the appropriate
command.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-06-11 15:43:47 +08:00
jbouchard b9f183a416 prevent contamining the cache with embeded cfg 2021-05-01 09:29:19 +08:00
Yi Zhao 6cbe3df2a2 layer.conf: add hardknott to LAYERSERIES_COMPAT
Remove other releases since they are not compatible anymore.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-04-21 12:57:22 +08:00
Yi Zhao bc84821aa4 grub: disable inside lockdown and shim_lock verifiers
The lockdown support[1] and secure boot detection[2] have been added to
grub 2.06. These verifiers are registered when UEFI Secure Boot is
enabled. Unfortunately, they conflict with the current MOK2 Verify
mechanism. So disable them.

Fixes grub error:
error: failed to verify kernel /bzImage

[1] http://git.savannah.gnu.org/cgit/grub.git/commit/?id=578c95298bcc46e0296f4c786db64c2ff26ce2cc
[2] http://git.savannah.gnu.org/cgit/grub.git/commit/?id=d7e54b2e5feee95d2f83058ed30d883c450d1473

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-04-21 12:57:22 +08:00
Liwei Song 9880c3ab33 Revert "user-key-store.bbclass: Kill gpg agent daemon after gpg sign"
This reverts commit fc8969af8a.

In parallel build this will led sign error because the gpg-agent
in using maybe killed in another task.

Signed-off-by: Liwei Song <liwei.song@windriver.com>
2021-04-21 12:57:22 +08:00
Kai Kang f6963bf84b linux-yocto-efi-secure-boot.inc: fix rerun failure
Task do_sign of linux-yocto depends on variable GPG_PATH. When GPG_PATH
changes, it fails to rerun the task:

| Exception: FileExistsError: [Errno 17] File exists:
| 'bzImage-5.2.24-yocto-standard.p7b' -> '/path/to/tmp-glibc/work/intel_x86_64-wrs-linux/linux-yocto/5.2.x+gitAUTOINC+bbe834c1d2_370ab92a1e-r0/image/boot/bzImage.p7b'

Remove the link file before create it if exists already.

Signed-off-by: Kai Kang <kai.kang@windriver.com>
2021-04-21 12:57:22 +08:00
Mark Hatle b8040ed6cc meta-signing-key user-key-store.bbclass: don't req tools from efi-secure-boot
If efi-secure-boot distro flag has not been set, then do not require the
sbsigntool, libsign and efitools.

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
2021-04-21 12:57:22 +08:00
Ovidiu Panait 596c6c76ae grub-efi: enable secure-boot support only for target builds
grub-efi-native does not benefit from the extra code/modules that get built for
secure-boot support, it just increases the build time of the package.
Therefore, mark all secure-boot related procedures in the recipe for
class-target only.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
2021-04-04 22:39:35 +08:00
Alexandru Avadanii f7ae553e6c grub: Drop useless insmod verify from cfg
- the 'verify' grub module has been renamed to 'pgp' in grub 2.04;
- the 'pgp' grub module is already built-in if GRUB_SIGN_VERIFY is set,
  so there's no need to call insmod;

While at it, remove some unnecessary code duplication.

Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
2021-03-29 21:01:36 +08:00
Alexandru Avadanii ab13b08e43 kernel-initramfs: Fix leftover p7b reference
p7b was replaced by the ${SB_FILE_EXT} variable, but one reference
was omitted during the rework.

Fixes: 31d2105b

Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
2021-03-26 14:13:04 +08:00
Yi Zhao 4e1cc676dc grub-efi: refresh patches for grub 2.06
Rebase patch:
0001-grub-verify-Add-strict_security-variable.patch
Grub-get-and-set-efi-variables.patch
mok2verify-support-to-verify-non-PE-file-with-PKCS-7.patch

Drop 0001-fs-ext2-fix-the-file-not-found-error-when-symlink-fi.patch
since it has been merged upstream.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2021-03-24 18:11:20 +08:00