495 Commits

Author SHA1 Message Date
Jia Zhang
59ae6f8d39 Depreciate this project
The maintenance work of this project is formally transferred to
https://github.com/Wind-River/meta-secure-core.

Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com>
2023-02-07 11:04:55 +08:00
Archana Polampalli
d218a980af shim: fix CVE-2022-28737
shim: Buffer overflow when loading crafted EFI images.

Reference:
https://nvd.nist.gov/vuln/detail/CVE-2022-2873

Upstream-Status: Backport [e99bdbb827,
159151b664]

CVE: CVE-2022-28737

Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com>
2023-01-19 11:16:39 +08:00
Yi Zhao
d5ce74c955 meta-integrity/conf/layer.conf: rename BBFILE_COLLECTIONS
There is already a BBFILE_COLLECTIONS named integrity in
meta-security/meta-integrity layer, which will casue conflicts.
Rename BBFILE_COLLECTIONS to integrity-layer.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2023-01-19 11:16:32 +08:00
He Zhe
37874f8a19 meta-integrity: Fix failure to find linux-yocto-integrity.inc
linux-yocto-integrity.inc is shared among linux-yocto linux-yocto-rt and
linux-yocto-dev and cannot be found with ${BPN} in the latter two.

ERROR: ParseError at layers/meta-secure-core/meta-integrity/recipes-kernel/linux/linux-yocto-dev.bbappend:1:
Could not include required file linux-yocto-dev-integrity.inc
ERROR: ParseError at layers/meta-secure-core/meta-integrity/recipes-kernel/linux/linux-yocto-rt_5.%.bbappend:1:
Could not include required file linux-yocto-rt-integrity.inc

Signed-off-by: He Zhe <zhe.he@windriver.com>
2023-01-19 11:16:16 +08:00
Mikko Rapeli
215174b60c linux-yocto*: fix require of include file
There exists only linux-yocto-tpm2.inc. BPN will resolve to
linux-yocto-rt and linux-yocto-dev which don't have a recipe specific
include files.

Fixes bitbake recipe parsing errors like:

ERROR: ParseError at
/home/builder/src/build/../meta-secure-core/meta-tpm2/recipes-kernel/linux/linux-yocto-rt_5.%.bbappend:1:
Could not include required file linux-yocto-rt-tpm2.inc
ERROR: Parsing halted due to errors, see error messages above

Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
2023-01-19 11:15:58 +08:00
Xiangyu Chen
551802f96f grub-efi: refresh patches for grub with fix of CVE-2022-28736
CVE-2022-28736 has 3 patches as below was conflicted with some meta-secure-boot layers patches.
loader-efi-chainloader-Simplify-the-loader-state.patch
commands-boot-Add-API-to-pass-context-to-loader.patch
CVE-2022-28736-loader-efi-chainloader-Use-grub_loader_set_ex.patch

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
2023-01-19 11:15:47 +08:00
Peter Hatina
6838a54f13 Sign initramfs image
Signed-off-by: Peter Hatina <peter@hatina.eu>
2022-12-06 09:16:31 +08:00
Mingli Yu
0198c6f482 meta-encrypted-storage: check luks DISTRO_FEATURES
Fix the yocto compliance issue:
  INFO: test_signatures (common.CommonCheckLayer)
  INFO:  ... FAIL

  Stdout:
  Loaded 2790 entries from dependency cache.
  INFO: Traceback (most recent call last):
  File "/build/layers/oe-core/scripts/lib/checklayer/cases/common.py", line 81, in test_signatures
    self.fail('Adding layer %s changed signatures.\n%s' % (self.tc.layer['name'], msg))
AssertionError: Adding layer meta-encrypted-storage changed signatures.
208 signatures changed, initial differences (first hash before, second after):
    cryptsetup:do_package: f0fa7d14534fb27c9caf639036338bbfa270ac29524b30d699f8f8ea0ec8cb02 -> 35d3ffd44373fc052d5bf7c0b1e649b585e49638ddc21109651e9602786aa87b
      bitbake-diffsigs --task cryptsetup do_package --signature f0fa7d14534fb27c9caf639036338bbfa270ac29524b30d699f8f8ea0ec8cb02 35d3ffd44373fc052d5bf7c0b1e649b585e49638ddc21109651e9602786aa87b
      NOTE: Starting bitbake server...
      basehash changed from 69f1e7096d59cdc20c48b2c7591a3d5c5abbdcf4452c2a2dbdd84ed352054477 to e8cb4b995a71a2b37597a4cdd37b91fe2904895db51922664d2ac2ae1702aecc
      Variable RDEPENDS:cryptsetup value changed:
      "     libdevmapper  {+lvm2+} udev lvm2-udevrules"
      Variable RRECOMMENDS:cryptsetup value changed:
      "     kernel-module-aes-generic     kernel-module-dm-crypt     kernel-module-md5     kernel-module-cbc     kernel-module-sha256-generic     kernel-module-xts  {+lvm2-udevrules+}"

Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
2022-12-06 09:16:14 +08:00
Mingli Yu
70441485bc meta-integrity: check ima DISTRO_FEATURES
Fix the below yocto compliance issue:
  INFO: FAIL: test_signatures (common.CommonCheckLayer)
  INFO: ----------------------------------------------------------------------
  INFO: Traceback (most recent call last):
    File "/build/layers/oe-core/scripts/lib/checklayer/cases/common.py", line 81, in test_signatures
    self.fail('Adding layer %s changed signatures.\n%s' % (self.tc.layer['name'], msg))
AssertionError: Adding layer meta-integrity changed signatures.
153 signatures changed, initial differences (first hash before, second after):
    linux-yocto:do_fetch: c57d21fe3def6c9959bbfd487420c6845d4c720d7e72aa5cf1e11af324ba5d45 -> fb0ce7b4d54bea3c53c86b2633de923c70d63a5e10d9a2d283c5bf88ea788c37

Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
2022-12-06 09:16:14 +08:00
Mingli Yu
5a8d5924a2 meta-efi-secure-boot: check efi-secure-boot DISTRO_FEATURES
Fix the below yocto compliance issue:
  INFO: ======================================================================
  INFO: FAIL: test_signatures (common.CommonCheckLayer)
  INFO: ----------------------------------------------------------------------
  INFO: Traceback (most recent call last):
   File "/build/layers/oe-core/scripts/lib/checklayer/cases/common.py", line 81, in test_signatures
    self.fail('Adding layer %s changed signatures.\n%s' % (self.tc.layer['name'], msg))
AssertionError: Adding layer meta-efi-secure-boot changed signatures.
17 signatures changed, initial differences (first hash before, second after):
   ovmf-native:do_configure: 98621d634860b524863c76c61a3b48d7aa4080bbe87b02a848ae6574ca349b5e -> 51b7ed0cd68914fe2a74e7db489ee0251fde1feab3ff4826e6df8a8be6f710bc
      bitbake-diffsigs --task ovmf-native do_configure --signature 98621d634860b524863c76c61a3b48d7aa4080bbe87b02a848ae6574ca349b5e 51b7ed0cd68914fe2a74e7db489ee0251fde1feab3ff4826e6df8a8be6f710bc
      NOTE: Starting bitbake server...
      basehash changed from 8b274e0d376c63104cbbcc0004a3758f2673d9e7f959854a0ffaa82ea04a9653 to d53127a75e96264ab92cffc956f93864435d48d1a0bf22899b35f78f1daf3bb3
      Variable PACKAGECONFIG value changed:
      @@ -1,3 +1,3 @@
      - ${@bb.utils.contains('MACHINE_FEATURES', 'tpm', 'tpm', '', d)} ${@bb.utils.contains('MACHINE_FEATURES', 'tpm2', 'tpm', '', d)}
      + ${@bb.utils.contains('MACHINE_FEATURES', 'tpm', 'tpm', '', d)} ${@bb.utils.contains('MACHINE_FEATURES', 'tpm2', 'tpm', '', d)} secureboot
       MACHINE_FEATURES{tpm} = Unset
       MACHINE_FEATURES{tpm2} = Unset

Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
2022-12-06 09:16:14 +08:00
Mingli Yu
f0b4bfd65d meta-tpm2: check the tpm2 DISTRO_FEATURES
Fix the below yocto compliance issue:
  INFO: test_signatures (common.CommonCheckLayer)
  INFO:  ... FAIL

  Stdout:
  Loading cache...done.
  Loaded 1645 entries from dependency cache.
  INFO: Traceback (most recent call last):
   File "/build/layers/oe-core/scripts/lib/checklayer/cases/common.py", line 81, in test_signatures
    self.fail('Adding layer %s changed signatures.\n%s' % (self.tc.layer['name'], msg))
AssertionError: Adding layer meta-tpm2 changed signatures.
107 signatures changed, initial differences (first hash before, second after):
   linux-yocto:do_fetch: c57d21fe3def6c9959bbfd487420c6845d4c720d7e72aa5cf1e11af324ba5d45 -> 3b1f37d37a491287fa36bc0f1e3d65d6ff2af899d173f684600a8fbff643b695
      bitbake-diffsigs --task linux-yocto do_fetch --signature c57d21fe3def6c9959bbfd487420c6845d4c720d7e72aa5cf1e11af324ba5d45 3b1f37d37a491287fa36bc0f1e3d65d6ff2af899d173f684600a8fbff643b695
      NOTE: Starting bitbake server...
      basehash changed from 847e3bff305906a9ad386dc76de2fc2dfdaf7bc2b7dfb15bb2cd17dd9ba1f8bd to a522d659617359c730eac2f149a171ddd030959af67d1d3c3606cc9adba7db08
      Variable SRC_URI value changed:
      @@ -1 +1,2 @@
      -git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRANCH};            git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.15;destsuffix=${KMETA}
      +git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRANCH};            git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.15;destsuffix=${KMETA}     ${@bb.utils.contains('DISTRO_FEATURES', 'tpm2',                          'file://tpm2.scc file://tpm2.cfg', '', d)}
      +DISTRO_FEATURES{tpm2} = Unset

Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
2022-12-06 09:16:14 +08:00
Mingli Yu
39a46d6b15 meta-secure-core: update the README
Fix the below yocto compliance issue:
  INFO: test_readme (common.CommonCheckLayer)
  INFO:  ... FAIL
  INFO: Traceback (most recent call last):
    File "/build/layers/oe-core/scripts/lib/checklayer/cases/common.py", line 34, in test_readme
      self.assertIn('maintainer', data.lower())
    AssertionError: 'maintainer' not found

Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
2022-12-06 09:16:14 +08:00
Yi Zhao
fa438247c3 grub-efi: remove build host references from modinfo.sh
Fix buildpaths warning:
WARNING: grub-efi-2.06-r0 do_package_qa: QA Issue: File
/boot/efi/EFI/BOOT/x86_64-efi/modinfo.sh in package grub-efi contains
reference to TMPDIR [buildpaths]

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2022-11-03 09:48:02 +08:00
Yi Zhao
225076287f layer.conf: add langdale to LAYERSERIES_COMPAT
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2022-11-03 09:47:47 +08:00
Kai Kang
1a74be5b36 cryptfs-tpm2: fix ld warnings with binutils 2.39
Add ld option '-z noexecstack' for cryptfs-tpm2 to fix link warnings:

  ld: warning: secret_area.o: missing .note.GNU-stack section implies executable stack
  ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker

Signed-off-by: Kai Kang <kai.kang@windriver.com>
2022-08-24 21:22:50 +08:00
He Zhe
def57bd5e0 ima: Remove disabling CONFIG_IMA_TEMPLATE
CONFIG_IMA_TEMPLATE has been removed from kernel since v5.15.46
http://lxgit.wrs.com/cgit/linux-yocto.git/commit/?h=v5.15/standard/base&id=3892794a18136452101fc86cebc5c6d69ac93683

Remove it here to avoid
[INFO]: the following symbols were not found in the active configuration:
	- CONFIG_IMA_TEMPLATE

Signed-off-by: He Zhe <zhe.he@windriver.com>
2022-08-14 17:15:37 +08:00
Yi Zhao
d0a0285971 kernel-initramfs: fix typo for ALTERNATIVE
ALTERNATIVES_${PN} -> ALTERNATIVE:${PN}

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2022-07-02 17:45:13 +08:00
Jia Zhang
2ccf4aa4e3 meta-secure-core: support kirkstone
Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com>
2022-06-05 14:51:31 +08:00
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:
73d25d6834
362fda1daa
e5bb5fb9f0

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