Skip to contentSkip to conversation

initramfs: Add recipe for optee based ftpm hook

PATCH In review Su, Bao Cheng 3 participants 5 messages May 24, 2023 – May 29, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 initramfs: Add recipe for optee based ftpm hook

Prepare for initramfs applications replying on TPM, such as clevis or systemd-cryptsetup

---
 .../initramfs-ms-ftpm-hook/files/ms-ftpm.hook | 36 ++++++++++++++++
 .../files/ms-ftpm.script                      | 43 +++++++++++++++++++
 .../initramfs-ms-ftpm-hook_0.1.bb             | 30 +++++++++++++
 3 files changed, 109 insertions(+)
 create mode 100644 recipes-initramfs/initramfs-ms-ftpm-hook/files/ms-ftpm.hook
 create mode 100644 recipes-initramfs/initramfs-ms-ftpm-hook/files/ms-ftpm.script
 create mode 100644 recipes-initramfs/initramfs-ms-ftpm-hook/initramfs-ms-ftpm-hook_0.1.bb
recipes-initramfs/initramfs-ms-ftpm-hook/files/ms-ftpm.hook new file +36 -0
new file mode 100644
index 0000000..998ae62
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2023
+#
+# Authors:
+#  Su Bao Cheng <[email protected]>
+#
+# SPDX-License-Identifier: MIT
+#
+PREREQ=""
+prereqs()
+{
+    echo "$PREREQ"
+}
+case $1 in
+prereqs)
+    prereqs
+    exit 0
+    ;;
+esac
+
+. /usr/share/initramfs-tools/hook-functions
+
+hook_error() {
+    echo "(ERROR): $2" >&2
+    exit 1
+}
+
+# Just in case these modules are not built-in
+manual_add_modules tee
+manual_add_modules optee
+manual_add_modules tpm_ftpm_tee
+
+copy_exec /usr/sbin/tee-supplicant || hook_error "/usr/sbin/tee-supplicant not found"
recipes-initramfs/initramfs-ms-ftpm-hook/files/ms-ftpm.script new file +43 -0

43 lines not on this page · raw message

recipes-initramfs/initramfs-ms-ftpm-hook/initramfs-ms-ftpm-hook_0.1.bb new file +30 -0
new file mode 100644
index 0000000..fece6ff
@@ -0,0 +1,30 @@
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2023
+#
+# Authors:
+#  Su Bao Cheng <[email protected]>
+#
+# SPDX-License-Identifier: MIT
+#
+
+inherit dpkg-raw
+
+SRC_URI += " \
+    file://ms-ftpm.hook \
+    file://ms-ftpm.script \
+    "
+
+DEBIAN_DEPENDS = "initramfs-tools, tee-supplicant"
+
+do_install[cleandirs] += " \
+    ${D}/usr/share/initramfs-tools/hooks \
+    ${D}/usr/share/initramfs-tools/scripts/local-bottom"
+
+do_install() {
+    install -m 0755 "${WORKDIR}/ms-ftpm.hook" \
+        "${D}/usr/share/initramfs-tools/hooks/ms-ftpm"
+    install -m 0755 "${WORKDIR}/ms-ftpm.script" \
+        "${D}/usr/share/initramfs-tools/scripts/local-bottom/ms-ftpm"
+}
#1 lore raw
Quoted 1 line · Bao Cheng

Prepare for initramfs applications replying on TPM, such as clevis or

                                     ^^^^^^^^

I guess it should be relying --------|

Felix

Quoted 48 lines

systemd-cryptsetup

---
 .../initramfs-ms-ftpm-hook/files/ms-ftpm.hook | 36 ++++++++++++++++ .../files/ms-ftpm.script                      | 43
+++++++++++++++++++
 .../initramfs-ms-ftpm-hook_0.1.bb             | 30 +++++++++++++

 3 files changed, 109 insertions(+)

 create mode 100644 recipes-initramfs/initramfs-ms-ftpm- hook/files/ms-ftpm.hook
 create mode 100644 recipes-initramfs/initramfs-ms-ftpm- hook/files/ms-ftpm.script
 create mode 100644 recipes-initramfs/initramfs-ms-ftpm- hook/initramfs-ms-ftpm-hook_0.1.bb

(quoted diff) +0 -0

ftpm.hook b/recipes-initramfs/initramfs-ms-ftpm-hook/files/ms- ftpm.hook
new file mode 100644
index 0000000..998ae62

recipes-initramfs/initramfs-ms-ftpm-hook/files/ms-ftpm.hook new file +24 -0
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2023
+#
+# Authors:
+#  Su Bao Cheng <[email protected]>
+#
+# SPDX-License-Identifier: MIT
+#
+PREREQ=""
+prereqs()
+{
+    echo "$PREREQ"
+}
+case $1 in
+prereqs)
+    prereqs
+    exit 0
+    ;;
+esac
+
+. /usr/share/initramfs-tools/hook-functions

recipes-initramfs/initramfs-ms-ftpm-hook/files/ms-ftpm.hook line 34

Quoted 10 lines
recipes-initramfs/initramfs-ms-ftpm-hook/files/ms-ftpm.hook new file +10 -0
+
+hook_error() {
+    echo "(ERROR): $2" >&2
+    exit 1
+}
+
+# Just in case these modules are not built-in
+manual_add_modules tee
+manual_add_modules optee
+manual_add_modules tpm_ftpm_tee

Are these modules available in a stock Debian kernel as well?

Quoted 62 lines
recipes-initramfs/initramfs-ms-ftpm-hook/files/ms-ftpm.hook new file +2 -0
+
+copy_exec /usr/sbin/tee-supplicant || hook_error "/usr/sbin/tee-

supplicant not found"

(quoted diff) +0 -0

ftpm.script b/recipes-initramfs/initramfs-ms-ftpm-hook/files/ms- ftpm.script
new file mode 100644
index 0000000..c6ee2dd

recipes-initramfs/initramfs-ms-ftpm-hook/files/ms-ftpm.script new file +33 -0
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2023
+#
+# Authors:
+#  Su Bao Cheng <[email protected]>
+#
+# SPDX-License-Identifier: MIT
+#
+PREREQ=""
+
+prereqs()
+{
+       echo "$PREREQ"
+}
+
+case $1 in
+# get pre-requisites
+prereqs)
+       prereqs
+       exit 0
+       ;;
+esac
+
+FTPM_DEV=/dev/tpmrm0
+
+. /scripts/functions
+
+/usr/sbin/tee-supplicant -d
+
+# The fTPM TA would take some time to be discovered as well as the

tee-supplicant

recipes-initramfs/initramfs-ms-ftpm-hook/files/ms-ftpm.script new file +10 -0
+# 10 seconds should be enough
+wait_sec=10
+until test $wait_sec -eq 0 || test -c "${FTPM_DEV}" ; do
+       wait_sec=$((wait_sec-1))
+       sleep 1
+done
+
+if ! test -c "${FTPM_DEV}"; then
+    panic "Can't discover the fTPM device ${FTPM_DEV}!"
+fi
(quoted diff) +0 -0

ftpm-hook_0.1.bb b/recipes-initramfs/initramfs-ms-ftpm- hook/initramfs-ms-ftpm-hook_0.1.bb
new file mode 100644
index 0000000..fece6ff

recipes-initramfs/initramfs-ms-ftpm-hook/initramfs-ms-ftpm- new file +0 -0
Quoted 1 line

hook_0.1

Where is this package actually used? I can't see that it is added to the initramfs recipe.

Felix

Quoted 34 lines

.bb

recipes-initramfs/initramfs-ms-ftpm-hook/initramfs-ms-ftpm- new file +29 -0
@@ -0,0 +1,30 @@
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2023
+#
+# Authors:
+#  Su Bao Cheng <[email protected]>
+#
+# SPDX-License-Identifier: MIT
+#
+
+inherit dpkg-raw
+
+SRC_URI += " \
+    file://ms-ftpm.hook \
+    file://ms-ftpm.script \
+    "
+
+DEBIAN_DEPENDS = "initramfs-tools, tee-supplicant"
+
+do_install[cleandirs] += " \
+    ${D}/usr/share/initramfs-tools/hooks \
+    ${D}/usr/share/initramfs-tools/scripts/local-bottom"
+
+do_install() {
+    install -m 0755 "${WORKDIR}/ms-ftpm.hook" \
+        "${D}/usr/share/initramfs-tools/hooks/ms-ftpm"
+    install -m 0755 "${WORKDIR}/ms-ftpm.script" \
+        "${D}/usr/share/initramfs-tools/scripts/local-bottom/ms-

ftpm"
+}

#2 lore raw
Quoted 5 lines · Felix (T CED INW-CN)
Quoted 2 lines · Bao Cheng

Prepare for initramfs applications replying on TPM, such as clevis or

                                     ^^^^^^^^
I guess it should be relying --------|

Yep, :)

Quoted 56 lines

Felix

Quoted 53 lines

systemd-cryptsetup

---
 .../initramfs-ms-ftpm-hook/files/ms-ftpm.hook | 36
++++++++++++++++
 .../files/ms-ftpm.script                      | 43
+++++++++++++++++++
 .../initramfs-ms-ftpm-hook_0.1.bb             | 30 +++++++++++++

 3 files changed, 109 insertions(+)

 create mode 100644 recipes-initramfs/initramfs-ms-ftpm- hook/files/ms-ftpm.hook
 create mode 100644 recipes-initramfs/initramfs-ms-ftpm- hook/files/ms-ftpm.script
 create mode 100644 recipes-initramfs/initramfs-ms-ftpm- hook/initramfs-ms-ftpm-hook_0.1.bb

(quoted diff) +0 -0

ftpm.hook b/recipes-initramfs/initramfs-ms-ftpm-hook/files/ms- ftpm.hook
new file mode 100644
index 0000000..998ae62

recipes-initramfs/initramfs-ms-ftpm-hook/files/ms-ftpm.hook new file +28 -0
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2023
+#
+# Authors:
+#  Su Bao Cheng <[email protected]>
+#
+# SPDX-License-Identifier: MIT
+#
+PREREQ=""
+prereqs()
+{
+    echo "$PREREQ"
+}
+case $1 in
+prereqs)
+    prereqs
+    exit 0
+    ;;
+esac
+
+. /usr/share/initramfs-tools/hook-functions
+
+hook_error() {
+    echo "(ERROR): $2" >&2
+    exit 1
Quoted 8 lines

recipes-initramfs/initramfs-ms-ftpm-hook/files/ms-ftpm.hook line 34

Quoted 6 lines
recipes-initramfs/initramfs-ms-ftpm-hook/files/ms-ftpm.hook new file +6 -0
+}
+
+# Just in case these modules are not built-in
+manual_add_modules tee
+manual_add_modules optee
+manual_add_modules tpm_ftpm_tee

Are these modules available in a stock Debian kernel as well?

Are you referring to the official arm64 kernel of Debian? Haven't checked it yet. For amd64, however, I don't expect the optee & tpm_ftpm_tee in the stock debian kernel.

AMD also provides a TEE, so tpm_ftpm_tee may be possible on amd64.

Quoted 59 lines
Quoted 59 lines
recipes-initramfs/initramfs-ms-ftpm-hook/files/ms-ftpm.hook new file +2 -0
+
+copy_exec /usr/sbin/tee-supplicant || hook_error "/usr/sbin/tee-

supplicant not found"

(quoted diff) +0 -0

ftpm.script b/recipes-initramfs/initramfs-ms-ftpm-hook/files/ms- ftpm.script
new file mode 100644
index 0000000..c6ee2dd

recipes-initramfs/initramfs-ms-ftpm-hook/files/ms-ftpm.script new file +33 -0
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2023
+#
+# Authors:
+#  Su Bao Cheng <[email protected]>
+#
+# SPDX-License-Identifier: MIT
+#
+PREREQ=""
+
+prereqs()
+{
+       echo "$PREREQ"
+}
+
+case $1 in
+# get pre-requisites
+prereqs)
+       prereqs
+       exit 0
+       ;;
+esac
+
+FTPM_DEV=/dev/tpmrm0
+
+. /scripts/functions
+
+/usr/sbin/tee-supplicant -d
+
+# The fTPM TA would take some time to be discovered as well as the

tee-supplicant

recipes-initramfs/initramfs-ms-ftpm-hook/files/ms-ftpm.script new file +10 -0
+# 10 seconds should be enough
+wait_sec=10
+until test $wait_sec -eq 0 || test -c "${FTPM_DEV}" ; do
+       wait_sec=$((wait_sec-1))
+       sleep 1
+done
+
+if ! test -c "${FTPM_DEV}"; then
+    panic "Can't discover the fTPM device ${FTPM_DEV}!"
+fi
(quoted diff) +0 -0

ftpm-hook_0.1.bb b/recipes-initramfs/initramfs-ms-ftpm- hook/initramfs-ms-ftpm-hook_0.1.bb

Quoted 9 lines
Quoted 5 lines

new file mode 100644
index 0000000..fece6ff

recipes-initramfs/initramfs-ms-ftpm-hook/initramfs-ms-ftpm- new file +0 -0

hook_0.1

Where is this package actually used? I can't see that it is added to the initramfs recipe.

It would be used in the downstream meta-iot2050, see
https://github.com/siemens/meta-iot2050/pull/442.

- Baocheng

Quoted 37 lines

Felix

Quoted 34 lines

.bb

recipes-initramfs/initramfs-ms-ftpm-hook/initramfs-ms-ftpm- new file +29 -0
@@ -0,0 +1,30 @@
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2023
+#
+# Authors:
+#  Su Bao Cheng <[email protected]>
+#
+# SPDX-License-Identifier: MIT
+#
+
+inherit dpkg-raw
+
+SRC_URI += " \
+    file://ms-ftpm.hook \
+    file://ms-ftpm.script \
+    "
+
+DEBIAN_DEPENDS = "initramfs-tools, tee-supplicant"
+
+do_install[cleandirs] += " \
+    ${D}/usr/share/initramfs-tools/hooks \
+    ${D}/usr/share/initramfs-tools/scripts/local-bottom"
+
+do_install() {
+    install -m 0755 "${WORKDIR}/ms-ftpm.hook" \
+        "${D}/usr/share/initramfs-tools/hooks/ms-ftpm"
+    install -m 0755 "${WORKDIR}/ms-ftpm.script" \
+        "${D}/usr/share/initramfs-tools/scripts/local-bottom/ms-

ftpm"
+}

#3 lore raw
Quoted 76 lines · On Mon, 2023-05-29 at 16:03 +0800, Su, Bao Cheng (DI FA CTR IPC CN PRC4) wrote:
Quoted 6 lines · Felix (T CED INW-CN)
Quoted 3 lines · Bao Cheng

Prepare for initramfs applications replying on TPM, such as clevis
or

                                     ^^^^^^^^
I guess it should be relying --------|

Yep, :)

Quoted 56 lines

Felix

Quoted 53 lines

systemd-cryptsetup

---
 .../initramfs-ms-ftpm-hook/files/ms-ftpm.hook | 36
++++++++++++++++
 .../files/ms-ftpm.script                      | 43
+++++++++++++++++++
 .../initramfs-ms-ftpm-hook_0.1.bb             | 30 +++++++++++++

 3 files changed, 109 insertions(+)

 create mode 100644 recipes-initramfs/initramfs-ms-ftpm- hook/files/ms-ftpm.hook
 create mode 100644 recipes-initramfs/initramfs-ms-ftpm- hook/files/ms-ftpm.script
 create mode 100644 recipes-initramfs/initramfs-ms-ftpm- hook/initramfs-ms-ftpm-hook_0.1.bb

(quoted diff) +0 -0

ftpm.hook b/recipes-initramfs/initramfs-ms-ftpm-hook/files/ms- ftpm.hook
new file mode 100644
index 0000000..998ae62

recipes-initramfs/initramfs-ms-ftpm-hook/files/ms-ftpm.hook new file +28 -0
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2023
+#
+# Authors:
+#  Su Bao Cheng <[email protected]>
+#
+# SPDX-License-Identifier: MIT
+#
+PREREQ=""
+prereqs()
+{
+    echo "$PREREQ"
+}
+case $1 in
+prereqs)
+    prereqs
+    exit 0
+    ;;
+esac
+
+. /usr/share/initramfs-tools/hook-functions
+
+hook_error() {
+    echo "(ERROR): $2" >&2
+    exit 1
Quoted 8 lines

recipes-initramfs/initramfs-ms-ftpm-hook/files/ms-ftpm.hook line 34

Quoted 6 lines
recipes-initramfs/initramfs-ms-ftpm-hook/files/ms-ftpm.hook new file +6 -0
+}
+
+# Just in case these modules are not built-in
+manual_add_modules tee
+manual_add_modules optee
+manual_add_modules tpm_ftpm_tee

Are these modules available in a stock Debian kernel as well?

Quoted 3 lines

Are you referring to the official arm64 kernel of Debian? Haven't checked it yet. For amd64, however, I don't expect the optee & tpm_ftpm_tee in the stock debian kernel.

Yes, I was referring to the stock debian kernels for arm64. If not, that should not be a problem here, but we should at least document it. I hope the CIP kernel provides these modules.

Quoted 76 lines

AMD also provides a TEE, so tpm_ftpm_tee may be possible on amd64.

Quoted 63 lines
Quoted 63 lines
recipes-initramfs/initramfs-ms-ftpm-hook/files/ms-ftpm.hook new file +2 -0
+
+copy_exec /usr/sbin/tee-supplicant || hook_error "/usr/sbin/tee-

supplicant not found"

(quoted diff) +0 -0

ftpm.script b/recipes-initramfs/initramfs-ms-ftpm-hook/files/ms- ftpm.script
new file mode 100644
index 0000000..c6ee2dd

recipes-initramfs/initramfs-ms-ftpm-hook/files/ms- new file +0 -0

ftpm.script

recipes-initramfs/initramfs-ms-ftpm-hook/files/ms- new file +33 -0
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2023
+#
+# Authors:
+#  Su Bao Cheng <[email protected]>
+#
+# SPDX-License-Identifier: MIT
+#
+PREREQ=""
+
+prereqs()
+{
+       echo "$PREREQ"
+}
+
+case $1 in
+# get pre-requisites
+prereqs)
+       prereqs
+       exit 0
+       ;;
+esac
+
+FTPM_DEV=/dev/tpmrm0
+
+. /scripts/functions
+
+/usr/sbin/tee-supplicant -d
+
+# The fTPM TA would take some time to be discovered as well as

the
tee-supplicant

recipes-initramfs/initramfs-ms-ftpm-hook/files/ms- new file +10 -0
+# 10 seconds should be enough
+wait_sec=10
+until test $wait_sec -eq 0 || test -c "${FTPM_DEV}" ; do
+       wait_sec=$((wait_sec-1))
+       sleep 1
+done
+
+if ! test -c "${FTPM_DEV}"; then
+    panic "Can't discover the fTPM device ${FTPM_DEV}!"
+fi
(quoted diff) +0 -0

ms-
ftpm-hook_0.1.bb b/recipes-initramfs/initramfs-ms-ftpm- hook/initramfs-ms-ftpm-hook_0.1.bb
new file mode 100644

Quoted 9 lines
Quoted 4 lines

index 0000000..fece6ff

recipes-initramfs/initramfs-ms-ftpm-hook/initramfs-ms-ftpm- new file +0 -0

hook_0.1

Where is this package actually used? I can't see that it is added to
the initramfs recipe.

Quoted 2 lines

It would be used in the downstream meta-iot2050, see
https://github.com/siemens/meta-iot2050/pull/442.

This is unfortunately not sufficient. We need a user in cip-core as well to make sure the package does not break over time.

Felix

Quoted 41 lines

- Baocheng

Quoted 37 lines

Felix

Quoted 34 lines

.bb

recipes-initramfs/initramfs-ms-ftpm-hook/initramfs-ms-ftpm- new file +29 -0
@@ -0,0 +1,30 @@
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2023
+#
+# Authors:
+#  Su Bao Cheng <[email protected]>
+#
+# SPDX-License-Identifier: MIT
+#
+
+inherit dpkg-raw
+
+SRC_URI += " \
+    file://ms-ftpm.hook \
+    file://ms-ftpm.script \
+    "
+
+DEBIAN_DEPENDS = "initramfs-tools, tee-supplicant"
+
+do_install[cleandirs] += " \
+    ${D}/usr/share/initramfs-tools/hooks \
+    ${D}/usr/share/initramfs-tools/scripts/local-bottom"
+
+do_install() {
+    install -m 0755 "${WORKDIR}/ms-ftpm.hook" \
+        "${D}/usr/share/initramfs-tools/hooks/ms-ftpm"
+    install -m 0755 "${WORKDIR}/ms-ftpm.script" \
+        "${D}/usr/share/initramfs-tools/scripts/local-bottom/ms-

ftpm"
+}

#4 lore raw
Quoted 162 lines · Felix (T CED INW-CN)
Quoted 76 lines · On Mon, 2023-05-29 at 16:03 +0800, Su, Bao Cheng (DI FA CTR IPC CN PRC4) wrote:
Quoted 6 lines · Felix (T CED INW-CN)
Quoted 3 lines · Bao Cheng

Prepare for initramfs applications replying on TPM, such as clevis
or

                                     ^^^^^^^^

I guess it should be relying --------|

Yep, :)

Quoted 56 lines

Felix

Quoted 53 lines

systemd-cryptsetup

---
 .../initramfs-ms-ftpm-hook/files/ms-ftpm.hook | 36
++++++++++++++++
 .../files/ms-ftpm.script                      | 43
+++++++++++++++++++
 .../initramfs-ms-ftpm-hook_0.1.bb             | 30 +++++++++++++
 3 files changed, 109 insertions(+)
 create mode 100644 recipes-initramfs/initramfs-ms-ftpm-
hook/files/ms-ftpm.hook
 create mode 100644 recipes-initramfs/initramfs-ms-ftpm-
hook/files/ms-ftpm.script
 create mode 100644 recipes-initramfs/initramfs-ms-ftpm-

hook/initramfs-ms-ftpm-hook_0.1.bb

(quoted diff) +0 -0

ftpm.hook b/recipes-initramfs/initramfs-ms-ftpm-hook/files/ms- ftpm.hook
new file mode 100644
index 0000000..998ae62

recipes-initramfs/initramfs-ms-ftpm-hook/files/ms-ftpm.hook new file +28 -0
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2023
+#
+# Authors:
+#  Su Bao Cheng <[email protected]>
+#
+# SPDX-License-Identifier: MIT
+#
+PREREQ=""
+prereqs()
+{
+    echo "$PREREQ"
+}
+case $1 in
+prereqs)
+    prereqs
+    exit 0
+    ;;
+esac
+
+. /usr/share/initramfs-tools/hook-functions
+
+hook_error() {
+    echo "(ERROR): $2" >&2
+    exit 1
Quoted 8 lines

recipes-initramfs/initramfs-ms-ftpm-hook/files/ms-ftpm.hook line 34

Quoted 6 lines
recipes-initramfs/initramfs-ms-ftpm-hook/files/ms-ftpm.hook new file +6 -0
+}
+
+# Just in case these modules are not built-in
+manual_add_modules tee
+manual_add_modules optee
+manual_add_modules tpm_ftpm_tee

Are these modules available in a stock Debian kernel as well?

Quoted 3 lines

Are you referring to the official arm64 kernel of Debian? Haven't checked it yet. For amd64, however, I don't expect the optee & tpm_ftpm_tee in the stock debian kernel.

Yes, I was referring to the stock debian kernels for arm64. If not, that should not be a problem here, but we should at least document it. I hope the CIP kernel provides these modules.

Quoted 76 lines

AMD also provides a TEE, so tpm_ftpm_tee may be possible on amd64.

Quoted 72 lines
Quoted 66 lines
recipes-initramfs/initramfs-ms-ftpm-hook/files/ms-ftpm.hook new file +2 -0
+
+copy_exec /usr/sbin/tee-supplicant || hook_error "/usr/sbin/tee-

supplicant not found"

(quoted diff) +0 -0

ftpm.script b/recipes-initramfs/initramfs-ms-ftpm-hook/files/ms- ftpm.script
new file mode 100644
index 0000000..c6ee2dd

recipes-initramfs/initramfs-ms-ftpm-hook/files/ms- new file +0 -0

ftpm.script

recipes-initramfs/initramfs-ms-ftpm-hook/files/ms- new file +33 -0
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2023
+#
+# Authors:
+#  Su Bao Cheng <[email protected]>
+#
+# SPDX-License-Identifier: MIT
+#
+PREREQ=""
+
+prereqs()
+{
+       echo "$PREREQ"
+}
+
+case $1 in
+# get pre-requisites
+prereqs)
+       prereqs
+       exit 0
+       ;;
+esac
+
+FTPM_DEV=/dev/tpmrm0
+
+. /scripts/functions
+
+/usr/sbin/tee-supplicant -d
+
+# The fTPM TA would take some time to be discovered as well as

the
tee-supplicant

recipes-initramfs/initramfs-ms-ftpm-hook/files/ms- new file +10 -0
+# 10 seconds should be enough
+wait_sec=10
+until test $wait_sec -eq 0 || test -c "${FTPM_DEV}" ; do
+       wait_sec=$((wait_sec-1))
+       sleep 1
+done
+
+if ! test -c "${FTPM_DEV}"; then
+    panic "Can't discover the fTPM device ${FTPM_DEV}!"
+fi
(quoted diff) +0 -0

ms-
ftpm-hook_0.1.bb b/recipes-initramfs/initramfs-ms-ftpm- hook/initramfs-ms-ftpm-hook_0.1.bb
new file mode 100644
index 0000000..fece6ff

recipes-initramfs/initramfs-ms-ftpm-hook/initramfs-ms-ftpm- new file +0 -0
Quoted 1 line

hook_0.1

Where is this package actually used? I can't see that it is added to
the initramfs recipe.

Quoted 5 lines
Quoted 2 lines

It would be used in the downstream meta-iot2050, see
https://github.com/siemens/meta-iot2050/pull/442.

This is unfortunately not sufficient. We need a user in cip-core as well to make sure the package does not break over time.

You are invited to either add qemu support for RPMB or suggest a physical reference target that is both upstream supported and comes with eMMC/RPMB ;). Right now we have none of them unfortunately. Therefore, we already merged edk2-standalonemm-rpmb without in-tree user.

Jan

Signature · 2 lines
Siemens AG, Technology
Competence Center Embedded Linux