pcr-extend: add new package
PATCH 1/4 pcr-extend: add new package
Signed-off-by Armin Kuster <[email protected]>
--- meta-tpm/recipes-tpm/pcr-extend/pcr-extend_git.bb | 25 +++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 meta-tpm/recipes-tpm/pcr-extend/pcr-extend_git.bb
meta-tpm/recipes-tpm/pcr-extend/pcr-extend_git.bb new file +25 -0
@@ -0,0 +1,25 @@ +SUMMARY = "Command line utility to extend hash of arbitrary data into a TPMs PCR." +HOMEPAGE = "https://github.com/flihp/pcr-extend" +SECTION = "security/tpm" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" + +DEPENDS = "libtspi" + +PV = "0.1+git${SRCPV}" +SRCREV = "c02ad8f628b3d99f6d4c087b402fe31a40ee6316" + +SRC_URI = "git://github.com/flihp/pcr-extend.git " + +inherit autotools + +S = "${WORKDIR}/git" + +do_compile() { + oe_runmake -C ${S}/src +} + +do_install() { + install -d ${D}${bindir} + oe_runmake -C ${S}/src DESTDIR="${D}" install +}
Signature · 1 line
2.7.4
PATCH 2/4 tpm-quote-tools: Add package
Signed-off-by Armin Kuster <[email protected]>
--- .../tpm-quote-tools/tpm-quote-tools_1.0.4.bb | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 meta-tpm/recipes-tpm/tpm-quote-tools/tpm-quote-tools_1.0.4.bb
meta-tpm/recipes-tpm/tpm-quote-tools/tpm-quote-tools_1.0.4.bb new file +23 -0
@@ -0,0 +1,23 @@ +SUMMARY = "The TPM Quote Tools is a collection of programs that provide support \ + for TPM based attestation using the TPM quote mechanism. \ + " +DESCRIPTION = "The TPM Quote Tools is a collection of programs that provide support \ + for TPM based attestation using the TPM quote mechanism. The manual \ + page for tpm_quote_tools provides a usage overview. \ + \ + TPM Quote Tools has been tested with TrouSerS on Linux and NTRU on \ + Windows XP. It was ported to Windows using MinGW and MSYS. \ + " +HOMEPAGE = "https://sourceforge.net/projects/tpmquotetools/" +SECTION = "security/tpm" +LICENSE = "BSD-3-Clause" +LIC_FILES_CHKSUM = "file://COPYING;md5=8ec30b01163d242ecf07d9cd84e3611f" + +DEPENDS = "libtspi tpm-tools" + +SRC_URI = "${SOURCEFORGE_MIRROR}/tpmquotetools/${PV}/${BP}.tar.gz" + +SRC_URI[md5sum] = "6e194f5bc534301bbaef53dc6d22c233" +SRC_URI[sha256sum] = "10dc4eade02635557a9496b388360844cd18e7864e2eb882f5e45ab2fa405ae2" + +inherit autotools
Signature · 1 line
2.7.4
PATCH 3/4 tpm2-abrmd: add package
In reply to Armin KusterSigned-off-by Armin Kuster <[email protected]>
--- .../tpm2-abrmd/files/tpm2-abrmd-init.sh | 65 ++++++++++++++++++++++ .../tpm2-abrmd/files/tpm2-abrmd.default | 1 + .../recipes-tpm/tpm2-abrmd/tpm2-abrmd_1.1.1.bb | 54 ++++++++++++++++++ 3 files changed, 120 insertions(+) create mode 100644 meta-tpm/recipes-tpm/tpm2-abrmd/files/tpm2-abrmd-init.sh create mode 100644 meta-tpm/recipes-tpm/tpm2-abrmd/files/tpm2-abrmd.default create mode 100644 meta-tpm/recipes-tpm/tpm2-abrmd/tpm2-abrmd_1.1.1.bb
meta-tpm/recipes-tpm/tpm2-abrmd/files/tpm2-abrmd-init.sh new file +65 -0
@@ -0,0 +1,65 @@ +#!/bin/sh + +### BEGIN INIT INFO +# Provides: tpm2-abrmd +# Required-Start: $local_fs $remote_fs $network +# Required-Stop: $local_fs $remote_fs $network +# Should-Start: +# Should-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: starts tpm2-abrmd +# Description: tpm2-abrmd implements the TCG resource manager +### END INIT INFO + +PATH=/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/sbin/tpm2-abrmd +NAME=tpm2-abrmd +DESC="TCG TSS2 Access Broker and Resource Management daemon" +USER="tss" + +test -x "${DAEMON}" || exit 0 + +# Read configuration variable file if it is present +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +case "${1}" in + start) + echo -n "Starting $DESC: " + + if [ ! -e /dev/tpm* ] + then + echo "device driver not loaded, skipping." + exit 0 + fi + + start-stop-daemon --start --quiet --oknodo --background --pidfile /var/run/${NAME}.pid --user ${USER} --chuid ${USER} --exec ${DAEMON} -- ${DAEMON_OPTS} + RETVAL="$?" + echo "$NAME." + [ "$RETVAL" = 0 ] && pidof $DAEMON > /var/run/${NAME}.pid + exit $RETVAL + ;; + + stop) + echo -n "Stopping $DESC: " + + start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/${NAME}.pid --user ${USER} --exec ${DAEMON} + RETVAL="$?" + echo "$NAME." + rm -f /var/run/${NAME}.pid + exit $RETVAL + ;; + + restart|force-reload) + "${0}" stop + sleep 1 + "${0}" start + exit $? + ;; + *) + echo "Usage: ${NAME} {start|stop|restart|force-reload|status}" >&2 + exit 3 + ;; +esac + +exit 0
meta-tpm/recipes-tpm/tpm2-abrmd/files/tpm2-abrmd.default new file +1 -0
@@ -0,0 +1 @@ +DAEMON_OPTS="--tcti=device --logger=syslog --max-connections=20 --max-transient-objects=20 --fail-on-loaded-trans"
meta-tpm/recipes-tpm/tpm2-abrmd/tpm2-abrmd_1.1.1.bb new file +54 -0
54 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 4/4 openssl-tpm-engine: add package
In reply to Armin KusterSigned-off-by Armin Kuster <[email protected]>
--- ...ate-tpm-key-support-well-known-key-option.patch | 99 ++++++++ .../files/0002-libtpm-support-env-TPM_SRK_PW.patch | 80 +++++++ .../files/0003-Fix-not-building-libtpm.la.patch | 25 ++ ...-tpm-engine-parse-an-encrypted-tpm-SRK-pa.patch | 254 +++++++++++++++++++++ ...-tpm-engine-change-variable-c-type-from-c.patch | 34 +++ .../openssl-tpm-engine/openssl-tpm-engine_0.4.2.bb | 78 +++++++ 6 files changed, 570 insertions(+) create mode 100644 meta-tpm/recipes-tpm/openssl-tpm-engine/files/0001-create-tpm-key-support-well-known-key-option.patch create mode 100644 meta-tpm/recipes-tpm/openssl-tpm-engine/files/0002-libtpm-support-env-TPM_SRK_PW.patch create mode 100644 meta-tpm/recipes-tpm/openssl-tpm-engine/files/0003-Fix-not-building-libtpm.la.patch create mode 100644 meta-tpm/recipes-tpm/openssl-tpm-engine/files/0003-tpm-openssl-tpm-engine-parse-an-encrypted-tpm-SRK-pa.patch create mode 100644 meta-tpm/recipes-tpm/openssl-tpm-engine/files/0004-tpm-openssl-tpm-engine-change-variable-c-type-from-c.patch create mode 100644 meta-tpm/recipes-tpm/openssl-tpm-engine/openssl-tpm-engine_0.4.2.bb
meta-tpm/recipes-tpm/openssl-tpm-engine/files/0001-create-tpm-key-support-well-known-key-option.patch new file +99 -0
@@ -0,0 +1,99 @@ +commit 16dac0cb7b73b8a7088300e45b98ac20819b03ed +Author: Junxian.Xiao <[email protected]> +Date: Wed Jun 19 18:57:13 2013 +0800 + +support well-known password in openssl-tpm-engine. + +Add "-z" option to select well known password in create_tpm_key tool. + +Signed-off-by: Junxian.Xiao <[email protected]> + +diff --git a/create_tpm_key.c b/create_tpm_key.c +index fee917f..7b94d62 100644 +--- a/create_tpm_key.c ++++ b/create_tpm_key.c +@@ -46,6 +46,8 @@ + #include <trousers/tss.h> + #include <trousers/trousers.h> + ++#define TPM_WELL_KNOWN_KEY_LEN 20 /*well know key length is 20 bytes zero*/ ++ + #define print_error(a,b) \ + fprintf(stderr, "%s:%d %s result: 0x%x (%s)\n", __FILE__, __LINE__, \ + a, b, Trspi_Error_String(b)) +@@ -70,6 +72,7 @@ usage(char *argv0) + "\t\t-e|--enc-scheme encryption scheme to use [PKCSV15] or OAEP\n" + "\t\t-q|--sig-scheme signature scheme to use [DER] or SHA1\n" + "\t\t-s|--key-size key size in bits [2048]\n" ++ "\t\t-z|--zerokey use well known 20 bytes zero as SRK password.\n" + "\t\t-a|--auth require a password for the key [NO]\n" + "\t\t-p|--popup use TSS GUI popup dialogs to get the password " + "for the\n\t\t\t\t key [NO] (implies --auth)\n" +@@ -147,6 +150,7 @@ int main(int argc, char **argv) + int asn1_len; + char *filename, c, *openssl_key = NULL; + int option_index, auth = 0, popup = 0, wrap = 0; ++ int wellknownkey = 0; + UINT32 enc_scheme = TSS_ES_RSAESPKCSV15; + UINT32 sig_scheme = TSS_SS_RSASSAPKCS1V15_DER; + UINT32 key_size = 2048; +@@ -154,12 +158,15 @@ int main(int argc, char **argv) + + while (1) { + option_index = 0; +- c = getopt_long(argc, argv, "pe:q:s:ahw:", ++ c = getopt_long(argc, argv, "pe:q:s:zahw:", + long_options, &option_index); + if (c == -1) + break; + + switch (c) { ++ case 'z': ++ wellknownkey = 1; ++ break; + case 'a': + initFlags |= TSS_KEY_AUTHORIZATION; + auth = 1; +@@ -293,6 +300,8 @@ int main(int argc, char **argv) + + if (srk_authusage) { + char *authdata = calloc(1, 128); ++ TSS_FLAG secretMode = TSS_SECRET_MODE_PLAIN; ++ int authlen = 0; + + if (!authdata) { + fprintf(stderr, "malloc failed.\n"); +@@ -309,17 +318,26 @@ int main(int argc, char **argv) + exit(result); + } + +- if (EVP_read_pw_string(authdata, 128, "SRK Password: ", 0)) { +- Tspi_Context_CloseObject(hContext, hKey); +- Tspi_Context_Close(hContext); +- free(authdata); +- exit(result); ++ if (wellknownkey) { ++ memset(authdata, 0, TPM_WELL_KNOWN_KEY_LEN); ++ secretMode = TSS_SECRET_MODE_SHA1; ++ authlen = TPM_WELL_KNOWN_KEY_LEN; ++ } ++ else { ++ if (EVP_read_pw_string(authdata, 128, "SRK Password: ", 0)) { ++ Tspi_Context_CloseObject(hContext, hKey); ++ Tspi_Context_Close(hContext); ++ free(authdata); ++ exit(result); ++ } ++ secretMode = TSS_SECRET_MODE_PLAIN; ++ authlen = strlen(authdata); + } + + //Set Secret + if ((result = Tspi_Policy_SetSecret(srkUsagePolicy, +- TSS_SECRET_MODE_PLAIN, +- strlen(authdata), ++ secretMode, ++ authlen, + (BYTE *)authdata))) { + print_error("Tspi_Policy_SetSecret", result); + free(authdata);
meta-tpm/recipes-tpm/openssl-tpm-engine/files/0002-libtpm-support-env-TPM_SRK_PW.patch new file +80 -0
80 lines not on this page · raw message
meta-tpm/recipes-tpm/openssl-tpm-engine/files/0003-Fix-not-building-libtpm.la.patch new file +25 -0
@@ -0,0 +1,25 @@ +From 7848445a1f4c750ef73bf96f5e89d402f87a1756 Mon Sep 17 00:00:00 2001 +From: Lans Zhang <[email protected]> +Date: Mon, 19 Jun 2017 14:54:28 +0800 +Subject: [PATCH] Fix not building libtpm.la + +Signed-off-by: Lans Zhang <[email protected]> +--- + Makefile.am | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/Makefile.am b/Makefile.am +index 6695656..634a7e6 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -10,4 +10,6 @@ libtpm_la_LIBADD=-lcrypto -lc -ltspi + libtpm_la_SOURCES=e_tpm.c e_tpm.h e_tpm_err.c + + create_tpm_key_SOURCES=create_tpm_key.c +-create_tpm_key_LDADD=-ltspi ++create_tpm_key_LDFLAGS=-ltspi ++ ++LDADD=libtpm.la +-- +2.7.5 +
meta-tpm/recipes-tpm/openssl-tpm-engine/files/0003-tpm-openssl-tpm-engine-parse-an-encrypted-tpm-SRK-pa.patch new file +254 -0
254 lines not on this page · raw message
meta-tpm/recipes-tpm/openssl-tpm-engine/files/0004-tpm-openssl-tpm-engine-change-variable-c-type-from-c.patch new file +34 -0
@@ -0,0 +1,34 @@ +From fb44e2814fd819c086f9a4c925427f89c0e8cec6 Mon Sep 17 00:00:00 2001 +From: Limeng <[email protected]> +Date: Fri, 21 Jul 2017 16:32:02 +0800 +Subject: [PATCH] tpm:openssl-tpm-engine: change variable c type from char + into int + +refer to getopt_long() function definition, its return value type is +int. So, change variable c type from char into int. +On arm platform, when getopt_long() calling fails, if we define c as +char type, its value will be 255, not -1. This will cause code enter +wrong case. + +Signed-off-by: Meng Li <[email protected]> +--- + create_tpm_key.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/create_tpm_key.c b/create_tpm_key.c +index 7b94d62..f30af90 100644 +--- a/create_tpm_key.c ++++ b/create_tpm_key.c +@@ -148,7 +148,8 @@ int main(int argc, char **argv) + ASN1_OCTET_STRING *blob_str; + unsigned char *blob_asn1 = NULL; + int asn1_len; +- char *filename, c, *openssl_key = NULL; ++ char *filename, *openssl_key = NULL; ++ int c; + int option_index, auth = 0, popup = 0, wrap = 0; + int wellknownkey = 0; + UINT32 enc_scheme = TSS_ES_RSAESPKCSV15; +-- +1.7.9.5 +
meta-tpm/recipes-tpm/openssl-tpm-engine/openssl-tpm-engine_0.4.2.bb new file +78 -0
78 lines not on this page · raw message
Signature · 1 line
2.7.4