Commit graph

7 commits

Author SHA1 Message Date
Fabrice Fontaine 4f315bb7ec package/ibm-sw-tpm2: fix build with gcc 10
Fixes:
 - http://autobuild.buildroot.org/results/8533d202fb29bf2a1677de37fc71f1a0fbd54722

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2020-09-01 09:19:44 +02:00
Thomas Petazzoni dac45969b6 package/ibm-sw-tpm2: re-fix build with uClibc-ng and older glibcs
In commit 26e37cef16, we started using
__WORDSIZE to get the size of longs on the given architecture, in
order to support all CPU architectures.

Unfortunately, __WORDSIZE is not enabled in musl, so in
19bd089004, we switched to using
LONG_BIT instead of __WORDSIZE.

However, LONG_BIT is not readily available on glibc, you need
_XOPEN_SOURCE to be defined, which was done in
a34e7f88f6.

However, in a34e7f88f6, _XOPEN_SOURCE
was just defined, with no specific value. This caused the build to
break again on uClibc-ng and older glibcs, because clock_gettime() and
CLOCK_MONOTONIC were no longer defined. In both uClibc-ng and glibc,
CLOCK_MONOTONIC is only defined if __USE_POSIX199309 is defined. It
turns out that simply defining _XOPEN_SOURCE with no value does not
lead to __USE_POSIX199309 being defined in uClibc-ng and old glibcs,
while it is defined in newer glibcs.

The difference comes from the following snippet of code, which is
present in recent enough glibc's <feature.h> but not uClibc-ng's or
older glibc's <feature.h>:

/* If none of the ANSI/POSIX macros are defined, or if _DEFAULT_SOURCE
   is defined, use POSIX.1-2008 (or another version depending on
   _XOPEN_SOURCE).  */

So the fact that we are defining _DEFAULT_SOURCE makes it assume that
we're using POSIX 2008.09, which obviously includes POSIX 1993.09.

Due to the lack of this code snippet, uClibc-ng <features.h> only
enables:

     !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE)

but not:

So we need an _XOPEN_SOURCE level of at least 500 for POSIX 1993.09
definitions to be available.

This is confirmed by the feature_test_macros man page, which states:

                  _XOPEN_SOURCE < 500
                         _POSIX_C_SOURCE is defined with the value 2.

                  500 <= _XOPEN_SOURCE < 600
                         _POSIX_C_SOURCE is defined with the value 199506L.

When this is fixed, another issue arises with older glibc toolchains
(such as Sourcery ARM), where fd_set is no longer defined. Inded, with
POSIX-1.2001 being enabled, we need to include <sys/select.h> to
access the fd_set definition and friends (see man fd_set for details).

This commit was tested with two glibc toolchains (recent and old), one
uClibc-ng toolchain and one musl toolchain.

Fixes:

  http://autobuild.buildroot.net/results/e20f9474fc0217036faa6561df33fa983466ddfe/
  (uClibc-ng)

  http://autobuild.buildroot.net/results/b5d944389fc96ef2c5e0608fe4ac34149e5f9739/
  (glibc)

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Acked-by: Vincent Fazio <vfazio@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2020-08-24 22:36:50 +02:00
Vincent Fazio a34e7f88f6 package/ibm-sw-tpm2: fix glibc build errors
In order to not have to define all architecture bitness variants in
src/LibSupport.h to conditionally define RADIX_BITS, a patch was created
to depend on LONG_BIT being defined via limits.h

For glibc, LONG_BIT is behind a _XOPEN_SOURCE define guard so patch the
makefile to define this macro as well as _DEFAULT_SOURCE.

Defining _XOPEN_SOURCE requires _DEFAULT_SOURCE to be explicitly defined
for builds to succeed as it is no longer impliclty defined when
_XOPEN_SOURCE is defined.

Fixes:
	http://autobuild.buildroot.net/results/bc145dd23c80a0660300766d0c114a00ed2e52b6/
	http://autobuild.buildroot.net/results/1d84e70c30d4d0719274aa4f3edc01772beb24a3/

Fixes: 19bd089004 ("package/ibm-sw-tpm2: fix patch to address musl builds")

Signed-off-by: Vincent Fazio <vfazio@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2020-08-18 16:43:40 +02:00
Vincent Fazio 19bd089004 package/ibm-sw-tpm2: fix patch to address musl builds
Previously, __WORDSIZE was being used to define RADIX_BITS.

__WORDSIZE is not defined consistently via limits.h across all libc
variants, so use LONG_BIT instead.

Fixes:

  http://autobuild.buildroot.net/results/b5cb347a98dc64f77982633c0fc48d14030aa5b6/

Signed-off-by: Vincent Fazio <vfazio@gmail.com>
Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2020-08-15 23:30:08 +02:00
Vincent Fazio 106a30a479 package/ibm-sw-tpm2: needs threads
The server process leverages threads, so add the dependency.

Fixes:

  http://autobuild.buildroot.net/results/7cce8b7ad19a48b36a38ef8fd88b96fad30f05c4/

Signed-off-by: Vincent Fazio <vfazio@gmail.com>
Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2020-05-01 15:47:00 +02:00
Thomas Petazzoni 26e37cef16 package/ibm-sw-tpm2: add patch to fix build issues on several architectures
src/LibSupport.h has some logic to find the wordsize of the current
architecture, using an explicit list of CPU architectures. This makes
the build fail on a number of CPU architectures that are not
explicitly handled.

Let's instead use the __WORDSIZE definition of the C library, which is
guaranteed to be available for all CPU architectures.

Fixes:

  http://autobuild.buildroot.net/results/a235345477ea2ec3b0dd4ffed4d7667d46caec48/

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2020-04-27 22:36:50 +02:00
Philippe Reynes 43162eaaa1 package/ibm-sw-tpm2: new package
This project is an implementation of the TCG TPM 2.0 specification. It
is based on the TPM specification Parts 3 and 4 source code donated by
Microsoft, with additional files to complete the implementation.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2020-04-19 21:37:12 +02:00