Skip to content

Commit fb67943

Browse files
committed
adding libtpms
1 parent 791e1c3 commit fb67943

File tree

10 files changed

+140
-0
lines changed

10 files changed

+140
-0
lines changed

build/libtpms/build.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/bash
2+
#
3+
# {{{ CDDL HEADER
4+
#
5+
# This file and its contents are supplied under the terms of the
6+
# Common Development and Distribution License ("CDDL"), version 1.0.
7+
# You may only use this file in accordance with the terms of version
8+
# 1.0 of the CDDL.
9+
#
10+
# A full copy of the text of the CDDL should have accompanied this
11+
# source. A copy of the CDDL is also available via the Internet at
12+
# http://www.illumos.org/license/CDDL.
13+
# }}}
14+
15+
# Copyright 2024 OmniOS Community Edition (OmniOSce) Association.
16+
17+
. ../../lib/build.sh
18+
19+
PROG=libtpms
20+
VER=0.10.0
21+
PKG=ooce/library/libtpms
22+
SUMMARY="$PROG"
23+
DESC="$PROG - library that targets the integration of TPM functionality "
24+
DESC+="into hypervisors"
25+
26+
set_clangver
27+
28+
export MAKE
29+
30+
CONFIGURE_OPTS="
31+
--disable-static
32+
"
33+
34+
init
35+
download_source $PROG v$VER
36+
patch_source
37+
prep_build autoconf -autoreconf
38+
build
39+
make_package
40+
clean_up
41+
42+
# Vim hints
43+
# vim:ts=4:sw=4:et:fdm=marker

build/libtpms/files/ctf.ignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
ACTCommands.c
2+
DebugHelpers.c
3+
tpm_error.c
4+
tpm_maint.c
5+
TpmMath_Debug.c
6+
TpmSizeChecks.c
7+
Unique.c
8+
Vendor_TCG_Test.c

build/libtpms/local.mog

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#
2+
# This file and its contents are supplied under the terms of the
3+
# Common Development and Distribution License ("CDDL"), version 1.0.
4+
# You may only use this file in accordance with the terms of version
5+
# 1.0 of the CDDL.
6+
#
7+
# A full copy of the text of the CDDL should have accompanied this
8+
# source. A copy of the CDDL is also available via the Internet at
9+
# http://www.illumos.org/license/CDDL.
10+
11+
# Copyright 2024 OmniOS Community Edition (OmniOSce) Association.
12+
13+
license LICENSE license=modified-BSD
14+
15+
<transform path=.*\.la$ -> drop>
16+

build/libtpms/patches/dprintf.patch

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
see: https://www.illumos.org/issues/16151 and https://www.illumos.org/issues/16505
2+
3+
diff -wpruN --no-dereference '--exclude=*.orig' a~/src/tpm_library.c a/src/tpm_library.c
4+
--- a~/src/tpm_library.c 1970-01-01 00:00:00
5+
+++ a/src/tpm_library.c 1970-01-01 00:00:00
6+
@@ -102,6 +102,36 @@ static struct sized_buffer cached_blobs[
7+
static int tpmvers_choice = 0; /* default is TPM1.2 */
8+
static TPM_BOOL tpmvers_locked = FALSE;
9+
10+
+#ifdef __illumos__
11+
+static int vdprintf(int fd, const char *fmt, va_list ap)
12+
+{
13+
+ FILE *fp;
14+
+ int ret;
15+
+
16+
+ fp = fdopen(fd, "w");
17+
+ if (fp == NULL)
18+
+ return (EOF);
19+
+
20+
+ ret = vfprintf(fp, fmt, ap);
21+
+
22+
+ (void) fclose(fp);
23+
+
24+
+ return (ret);
25+
+}
26+
+
27+
+static int dprintf(int fd, const char *fmt, ...)
28+
+{
29+
+ va_list va;
30+
+ int ret;
31+
+
32+
+ va_start(va, fmt);
33+
+ ret = vdprintf(fd, fmt, va);
34+
+ va_end(va);
35+
+
36+
+ return (ret);
37+
+}
38+
+#endif /* __illumos__ */
39+
+
40+
uint32_t TPMLIB_GetVersion(void)
41+
{
42+
return TPM_LIBRARY_VERSION;

build/libtpms/patches/illumos.patch

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
diff -wpruN --no-dereference '--exclude=*.orig' a~/src/tpm2/RuntimeProfile.c a/src/tpm2/RuntimeProfile.c
2+
--- a~/src/tpm2/RuntimeProfile.c 1970-01-01 00:00:00
3+
+++ a/src/tpm2/RuntimeProfile.c 1970-01-01 00:00:00
4+
@@ -45,6 +45,9 @@
5+
#include <stdio.h>
6+
#include <regex.h>
7+
#include <limits.h>
8+
+#ifdef __illumos__
9+
+#include <strings.h>
10+
+#endif
11+
12+
#include "Tpm.h"
13+
#include "tpm_library_intern.h"
14+
diff -wpruN --no-dereference '--exclude=*.orig' a~/src/tpm2/TpmProfile_Common.h a/src/tpm2/TpmProfile_Common.h
15+
--- a~/src/tpm2/TpmProfile_Common.h 1970-01-01 00:00:00
16+
+++ a/src/tpm2/TpmProfile_Common.h 1970-01-01 00:00:00
17+
@@ -89,7 +89,7 @@
18+
#else
19+
# include <endian.h>
20+
#endif
21+
-#if defined __linux__ || defined __CYGWIN__
22+
+#if defined __linux__ || defined __CYGWIN__ || defined __illumos__
23+
#if __BYTE_ORDER == __LITTLE_ENDIAN
24+
#define BIG_ENDIAN_TPM NO
25+
#endif

build/libtpms/patches/series

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
illumos.patch
2+
dprintf.patch

doc/baseline

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ extra.omnios ooce/library/libpciaccess
160160
extra.omnios ooce/library/libpng
161161
extra.omnios ooce/library/libsodium
162162
extra.omnios ooce/library/libtasn1
163+
extra.omnios ooce/library/libtpms
163164
extra.omnios ooce/library/liburcu
164165
extra.omnios ooce/library/libusb-1
165166
extra.omnios ooce/library/libuv

doc/baseline.aarch64

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ extra.omnios ooce/library/libogg
4343
extra.omnios ooce/library/libpng
4444
extra.omnios ooce/library/libsodium
4545
extra.omnios ooce/library/libtasn1
46+
extra.omnios ooce/library/libtpms
4647
extra.omnios ooce/library/liburcu
4748
extra.omnios ooce/library/libuv
4849
extra.omnios ooce/library/libvncserver

doc/packages.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
| ooce/library/libpng | 1.6.44 | http://www.libpng.org/pub/png/libpng.html | [omniosorg](https://github.com/omniosorg)
132132
| ooce/library/libsodium | 1.0.20 | https://github.com/jedisct1/libsodium/releases | [omniosorg](https://github.com/omniosorg)
133133
| ooce/library/libtasn1 | 4.19.0 | https://ftp.gnu.org/gnu/libtasn1/ | [omniosorg](https://github.com/omniosorg)
134+
| ooce/library/libtpms | 0.10.0 | https://github.com/stefanberger/libtpms/releases | [omniosorg](https://github.com/omniosorg)
134135
| ooce/library/liburcu | 0.14.0 | https://lttng.org/files/urcu/?O=D | [omniosorg](https://github.com/omniosorg)
135136
| ooce/library/libusb-1 | 1.0.27 | https://github.com/libusb/libusb/releases | [omniosorg](https://github.com/omniosorg)
136137
| ooce/library/libuv | 1.48.0 | https://github.com/libuv/libuv/releases | [omniosorg](https://github.com/omniosorg)

doc/pkglist.aarch64

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ ooce/application/tig
8383
ooce/developer/cunit
8484
ooce/library/libtasn1
8585
ooce/library/unistring
86+
ooce/library/libtpms
8687
###############################################################################
8788
.SYSROOT
8889
ooce/audio/flac

0 commit comments

Comments
 (0)