diff options
author | Armin Kuster <akuster808@gmail.com> | 2017-01-29 08:50:59 -0800 |
---|---|---|
committer | Armin Kuster <akuster808@gmail.com> | 2017-02-18 11:43:20 -0800 |
commit | a764c5972ce4b4d448a8f9a94e1feb5c11fba22d (patch) | |
tree | aa4457ee849f3c3dc57cd899dcdaa7d85f07b5e4 | |
parent | 33f4ac7996612705d1a71264511e7a72a1a3e1d8 (diff) | |
download | meta-security-a764c5972ce4b4d448a8f9a94e1feb5c11fba22d.tar.gz |
swtpm: update to tip
fix signed build issues
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r-- | recipes-tpm/swtpm/files/fix_lib_search_path.patch | 41 | ||||
-rw-r--r-- | recipes-tpm/swtpm/files/fix_signed_issue.patch | 48 | ||||
-rw-r--r-- | recipes-tpm/swtpm/swtpm_1.0.bb | 18 |
3 files changed, 63 insertions, 44 deletions
diff --git a/recipes-tpm/swtpm/files/fix_lib_search_path.patch b/recipes-tpm/swtpm/files/fix_lib_search_path.patch deleted file mode 100644 index 015f418..0000000 --- a/recipes-tpm/swtpm/files/fix_lib_search_path.patch +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | |||
2 | Upstream-Status: Inappropriate [OE config] | ||
3 | |||
4 | Signed-off-by: Armin Kuster <akuster808@gmail.com> | ||
5 | |||
6 | Index: configure.ac | ||
7 | =================================================================== | ||
8 | --- a/configure.ac | ||
9 | +++ b/configure.ac | ||
10 | @@ -349,21 +349,17 @@ CFLAGS="$CFLAGS -Wformat -Wformat-securi | ||
11 | dnl We have to make sure libtpms is using the same crypto library | ||
12 | dnl to avoid problems | ||
13 | AC_MSG_CHECKING([the crypto library libtpms is using]) | ||
14 | -dirs=$($CC $CFLAGS -Xlinker --verbose 2>/dev/null | \ | ||
15 | - sed -n '/SEARCH_DIR/p' | \ | ||
16 | - sed 's/SEARCH_DIR("=\?\(@<:@^"@:>@\+\)"); */\1\n/g') | ||
17 | -for dir in $dirs; do | ||
18 | - if test -r $dir/libtpms.so; then | ||
19 | - if test -n "`ldd $dir/libtpms.so | grep libcrypto.so`"; then | ||
20 | - libtpms_cryptolib="openssl" | ||
21 | - break | ||
22 | - fi | ||
23 | - if test -n "`ldd $dir/libtpms.so | grep libnss3.so`"; then | ||
24 | - libtpms_cryptolib="freebl" | ||
25 | - break | ||
26 | - fi | ||
27 | +dir="$SEARCH_DIR" | ||
28 | +if test -r $dir/libtpms.so; then | ||
29 | + if test -n "`ldd $dir/libtpms.so | grep libcrypto.so`"; then | ||
30 | + libtpms_cryptolib="openssl" | ||
31 | + break | ||
32 | fi | ||
33 | -done | ||
34 | + if test -n "`ldd $dir/libtpms.so | grep libnss3.so`"; then | ||
35 | + libtpms_cryptolib="freebl" | ||
36 | + break | ||
37 | + fi | ||
38 | +fi | ||
39 | |||
40 | if test -z "$libtpms_cryptolib"; then | ||
41 | AC_MSG_ERROR([Could not determine libtpms crypto library.]) | ||
diff --git a/recipes-tpm/swtpm/files/fix_signed_issue.patch b/recipes-tpm/swtpm/files/fix_signed_issue.patch new file mode 100644 index 0000000..427df62 --- /dev/null +++ b/recipes-tpm/swtpm/files/fix_signed_issue.patch | |||
@@ -0,0 +1,48 @@ | |||
1 | Upstream-Status: Pending | ||
2 | Signed-off-by Armin Kuster <akuster808@gmail> | ||
3 | |||
4 | Index: git/src/swtpm/ctrlchannel.c | ||
5 | =================================================================== | ||
6 | --- git.orig/src/swtpm/ctrlchannel.c | ||
7 | +++ git/src/swtpm/ctrlchannel.c | ||
8 | @@ -152,7 +152,8 @@ static int ctrlchannel_receive_state(ptm | ||
9 | uint32_t tpm_number = 0; | ||
10 | unsigned char *blob = NULL; | ||
11 | uint32_t blob_length = be32toh(pss->u.req.length); | ||
12 | - uint32_t remain = blob_length, offset = 0; | ||
13 | + ssize_t remain = (ssize_t) blob_length; | ||
14 | + uint32_t offset = 0; | ||
15 | TPM_RESULT res; | ||
16 | uint32_t flags = be32toh(pss->u.req.state_flags); | ||
17 | TPM_BOOL is_encrypted = (flags & PTM_STATE_FLAG_ENCRYPTED) != 0; | ||
18 | Index: git/src/swtpm_ioctl/tpm_ioctl.c | ||
19 | =================================================================== | ||
20 | --- git.orig/src/swtpm_ioctl/tpm_ioctl.c | ||
21 | +++ git/src/swtpm_ioctl/tpm_ioctl.c | ||
22 | @@ -303,7 +303,7 @@ static int do_save_state_blob(int fd, bo | ||
23 | numbytes = write(file_fd, pgs.u.resp.data, | ||
24 | devtoh32(is_chardev, pgs.u.resp.length)); | ||
25 | |||
26 | - if (numbytes != devtoh32(is_chardev, pgs.u.resp.length)) { | ||
27 | + if (numbytes != (ssize_t) devtoh32(is_chardev, pgs.u.resp.length)) { | ||
28 | fprintf(stderr, | ||
29 | "Could not write to file '%s': %s\n", | ||
30 | filename, strerror(errno)); | ||
31 | @@ -420,7 +420,7 @@ static int do_load_state_blob(int fd, bo | ||
32 | had_error = true; | ||
33 | break; | ||
34 | } | ||
35 | - pss.u.req.length = htodev32(is_chardev, numbytes); | ||
36 | + pss.u.req.length = htodev32(is_chardev, (uint32_t) numbytes); | ||
37 | |||
38 | /* the returnsize is zero on all intermediate packets */ | ||
39 | returnsize = ((size_t)numbytes < sizeof(pss.u.req.data)) | ||
40 | @@ -863,7 +863,7 @@ int main(int argc, char *argv[]) | ||
41 | return EXIT_FAILURE; | ||
42 | } | ||
43 | /* no tpm_result here */ | ||
44 | - printf("ptm capability is 0x%lx\n", (uint64_t)devtoh64(is_chardev, cap)); | ||
45 | + printf("ptm capability is 0x%llx\n", (uint64_t)devtoh64(is_chardev, cap)); | ||
46 | |||
47 | } else if (!strcmp(command, "-i")) { | ||
48 | init.u.req.init_flags = htodev32(is_chardev, PTM_INIT_FLAG_DELETE_VOLATILE); | ||
diff --git a/recipes-tpm/swtpm/swtpm_1.0.bb b/recipes-tpm/swtpm/swtpm_1.0.bb index 04777e1..27b4b8c 100644 --- a/recipes-tpm/swtpm/swtpm_1.0.bb +++ b/recipes-tpm/swtpm/swtpm_1.0.bb | |||
@@ -5,9 +5,11 @@ SECTION = "apps" | |||
5 | 5 | ||
6 | DEPENDS = "libtasn1 fuse expect socat glib-2.0 libtpm libtpm-native" | 6 | DEPENDS = "libtasn1 fuse expect socat glib-2.0 libtpm libtpm-native" |
7 | 7 | ||
8 | SRCREV = "2cd10cee2f74c84bda22081514b6b2cb566fa42d" | 8 | SRCREV = "ca906a02124d0ed8b6194e845d272d23ee394a34" |
9 | SRC_URI = "git://github.com/stefanberger/swtpm.git \ | 9 | SRC_URI = " \ |
10 | file://fix_lib_search_path.patch" | 10 | git://github.com/stefanberger/swtpm.git \ |
11 | file://fix_signed_issue.patch \ | ||
12 | " | ||
11 | 13 | ||
12 | S = "${WORKDIR}/git" | 14 | S = "${WORKDIR}/git" |
13 | 15 | ||
@@ -22,11 +24,21 @@ PACKAGECONFIG += "${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'selinux', | |||
22 | PACKAGECONFIG[openssl] = "--with-openssl, --without-openssl, openssl" | 24 | PACKAGECONFIG[openssl] = "--with-openssl, --without-openssl, openssl" |
23 | PACKAGECONFIG[gnutls] = "--with-gnutls, --without-gnutls, gnutls" | 25 | PACKAGECONFIG[gnutls] = "--with-gnutls, --without-gnutls, gnutls" |
24 | PACKAGECONFIG[selinux] = "--with-selinux, --without-selinux, libselinux" | 26 | PACKAGECONFIG[selinux] = "--with-selinux, --without-selinux, libselinux" |
27 | PACKAGECONFIG[cuse] = "--with-cuse, --without-cuse, libselinux" | ||
25 | 28 | ||
26 | EXTRA_OECONF += "--with-tss-user=${TSS_USER} --with-tss-group=${TSS_GROUP}" | 29 | EXTRA_OECONF += "--with-tss-user=${TSS_USER} --with-tss-group=${TSS_GROUP}" |
27 | 30 | ||
28 | export SEARCH_DIR = "${STAGING_LIBDIR_NATIVE}" | 31 | export SEARCH_DIR = "${STAGING_LIBDIR_NATIVE}" |
29 | 32 | ||
33 | # dup bootstrap | ||
34 | do_configure_prepend () { | ||
35 | libtoolize --force --copy | ||
36 | autoheader | ||
37 | aclocal | ||
38 | automake --add-missing -c | ||
39 | autoconf | ||
40 | } | ||
41 | |||
30 | USERADD_PACKAGES = "${PN}" | 42 | USERADD_PACKAGES = "${PN}" |
31 | GROUPADD_PARAM_${PN} = "--system ${TSS_USER}" | 43 | GROUPADD_PARAM_${PN} = "--system ${TSS_USER}" |
32 | USERADD_PARAM_${PN} = "--system -g ${TSS_GROUP} --home-dir \ | 44 | USERADD_PARAM_${PN} = "--system -g ${TSS_GROUP} --home-dir \ |