Compare commits

..

17 Commits

Author SHA1 Message Date
Marc-André Lureau
80ef24a8c8 meson: change format of source files
For some reason, gemini choose a compact form instead.

Also split the libtpms-sepecific files out as did the original Makefile.am.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-08-05 10:50:50 +04:00
Marc-André Lureau
b479163801 feat: Add meson build to GitHub CI
This commit adds a meson build to the GitHub CI workflow.
It also updates the README with build instructions for both
autotools and meson.

Signed-off-by: Gemini <gemini@google.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-08-05 10:50:50 +04:00
Marc-André Lureau
18d4037251 meson: cleanups & misc improvements
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-08-05 10:50:50 +04:00
Marc-André Lureau
814c817181 meson: fix linking object_size
Build both libraries, drop need for "static_tests" option.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-08-05 10:50:50 +04:00
Marc-André Lureau
86b5684cfd meson: add versioning and symbol exports
Implement step 10 of the meson migration plan.

This adds the library versioning information to the shared library
target, including soversion, and handles symbol exports using a
version script, mirroring the behavior of the Autotools build system.

Signed-off-by: Gemini <gemini@google.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-08-05 10:50:49 +04:00
Marc-André Lureau
9ab7ac1b19 feat: implement tests with meson
For various reasons Gemini wasn't capable of adding the tests.
It kept following rabbit-holes in a loop. Do it by hand instead.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-08-05 10:50:13 +04:00
Marc-André Lureau
1aa9449838 meson: fix build with missing crypto flag
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-08-05 10:50:13 +04:00
Marc-André Lureau
869b7c981c meson: fix build with tpm1/tpm2 flag
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-08-05 10:50:13 +04:00
Marc-André Lureau
6162498a0e feat: Add man page generation to Meson build
This commit implements the man page portion of step 8 of the Meson migration plan.

It adds the necessary 'meson.build' files to the 'man' and 'man/man3' directories to find 'pod2man' and generate the man pages from the '.pod' source files. The generated man pages are also installed.

Signed-off-by: Gemini <gemini@google.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-08-05 10:50:10 +04:00
Marc-André Lureau
4bfb164c8a feat: Add option to enable/disable use of OpenSSL functions
This commit implements step 7 of the Meson migration plan.

It introduces a new boolean option, 'use_openssl_functions', to control whether to use OpenSSL's own crypto functions or the library's internal ones. This mirrors the behavior of the '--disable-use-openssl-functions' flag in the Autotools build system.

The option is added to 'meson_options.txt' and the corresponding C defines are conditionally applied in 'src/meson.build' for both TPM 1.2 and TPM 2.0 builds when using the OpenSSL backend.

Signed-off-by: Gemini <gemini@google.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-08-05 10:50:07 +04:00
Marc-André Lureau
74b91bec7e feat: Add support for FreeBL crypto backend
This commit implements Step 6 of the Meson migration plan.

- Adds a 'crypto_backend' option to 'meson_options.txt' to allow selecting between 'openssl' and 'freebl'.

- The build logic in 'src/meson.build' now conditionally selects the appropriate crypto source files and dependencies.

- Adds a forward declaration to 'tpm_crypto_freebl.c' to fix a compilation error when building with '-Werror'.

Signed-off-by: Gemini <gemini@google.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-08-05 10:50:06 +04:00
Marc-André Lureau
60bd0377d0 feat: Add compiler warning and hardening flags
This commit implements Step 5 of the Meson migration plan.

- Adds a comprehensive set of compiler warning flags, such as -Wall and -Werror, checking for compiler support first.

- Adds security hardening flags (-fstack-protector-strong, -D_FORTIFY_SOURCE=2, -Wl,-z,relro, -Wl,-z,now), also checking for compiler and linker support.

- Conditionally applies _FORTIFY_SOURCE only when optimizations are enabled to prevent build failures in debug mode.

- Adds -DOPENSSL_SUPPRESS_DEPRECATED to handle deprecation warnings in OpenSSL and allow the build to succeed with -Werror.

Signed-off-by: Gemini <gemini@google.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-08-05 10:50:04 +04:00
Marc-André Lureau
d851618afe feat: Add full source lists for TPM1 and TPM2
This commit implements Step 4 of the Meson migration plan.

- Populates the build with the full list of source files for both TPM 1.2 and TPM 2.0 implementations.

- Refactors the build to use intermediate static libraries for TPM1 and TPM2, allowing for implementation-specific compiler flags.

- Adds necessary preprocessor definitions to successfully compile the full library.

- Adds header checks for arpa/inet.h and time.h.

Signed-off-by: Gemini <gemini@google.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-08-05 10:50:02 +04:00
Marc-André Lureau
de29c4b8d2 feat: Add build options for TPM1 and TPM2 support
This commit implements Step 3 of the Meson migration plan.

 - Added meson_options.txt to define build options.

 - Introduced 'tpm1' and 'tpm2' boolean options to control which parts of the library are built.

 - The build logic in src/meson.build now checks these options.

Signed-off-by: Gemini <gemini@google.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-08-05 10:50:00 +04:00
Marc-André Lureau
9ef45de8b0 feat: Add OpenSSL dependency and header installation
This commit implements Step 2 of the Meson migration plan.

- The build system now finds and links against the OpenSSL library.
- Public header files are now installed to the correct location.
- The 'include' directory has been added to the Meson build process.

Signed-off-by: Gemini <gemini@google.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-08-05 10:49:57 +04:00
Marc-André Lureau
37b412fd43 meson: fix license
Gemini didn't get the license correctly.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-08-05 10:49:57 +04:00
Marc-André Lureau
da26c94015 feat: Add initial Meson build system
This commit introduces the initial Meson build system for libtpms.
This first step allows compiling a minimal shared library and serves
as the foundation for the full migration from Autotools.

The following files are added:
- meson.build: The main build file.
- src/meson.build: The build file for the src directory.
- config.h.in: The template for the configuration header.
- meson_migration_plan.md: The plan for the migration.

This corresponds to Step 1 of the migration plan.

Signed-off-by: Gemini <gemini@google.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-08-05 10:49:53 +04:00

View File

@ -145,8 +145,6 @@ if with_tpm2
'tpm2/Attest_spt.c',
'tpm2/AttestationCommands.c',
'tpm2/AuditCommands.c',
'tpm2/BackwardsCompatibilityBitArray.c',
'tpm2/BackwardsCompatibilityObject.c',
'tpm2/Bits.c',
'tpm2/BnConvert.c',
'tpm2/BnEccConstants.c',
@ -182,7 +180,6 @@ if with_tpm2
'tpm2/HierarchyCommands.c',
'tpm2/IntegrityCommands.c',
'tpm2/IoBuffers.c',
'tpm2/LibtpmsCallbacks.c',
'tpm2/Locality.c',
'tpm2/LocalityPlat.c',
'tpm2/ManagementCommands.c',
@ -191,7 +188,6 @@ if with_tpm2
'tpm2/MathOnByteBuffers.c',
'tpm2/Memory.c',
'tpm2/NVCommands.c',
'tpm2/NVMarshal.c',
'tpm2/NVMem.c',
'tpm2/NV_spt.c',
'tpm2/NvDynamic.c',
@ -214,16 +210,11 @@ if with_tpm2
'tpm2/Response.c',
'tpm2/ResponseCodeProcessing.c',
'tpm2/RunCommand.c',
'tpm2/RuntimeAlgorithm.c',
'tpm2/RuntimeAttributes.c',
'tpm2/RuntimeCommands.c',
'tpm2/RuntimeProfile.c',
'tpm2/Session.c',
'tpm2/SessionCommands.c',
'tpm2/SessionProcess.c',
'tpm2/SigningCommands.c',
'tpm2/StartupCommands.c',
'tpm2/StateMarshal.c',
'tpm2/SymmetricCommands.c',
'tpm2/TPMCmdp.c',
'tpm2/TestingCommands.c',
@ -245,7 +236,6 @@ if with_tpm2
'tpm2/Unmarshal.c',
'tpm2/VendorInfo.c',
'tpm2/Vendor_TCG_Test.c',
'tpm2/Volatile.c',
'tpm2/X509_ECC.c',
'tpm2/X509_RSA.c',
'tpm2/X509_spt.c',
@ -266,11 +256,25 @@ if with_tpm2
'tpm2/crypto/openssl/ExpDCache.c',
'tpm2/crypto/openssl/Helpers.c',
'tpm2/crypto/openssl/TpmToOsslDesSupport.c',
'tpm2/crypto/openssl/TpmToOsslSupport.c'
'tpm2/crypto/openssl/TpmToOsslSupport.c',
'tpm_tpm2_interface.c',
'tpm_tpm2_tis.c',
)
# files specific to libtpms
tpm2_sources += files(
'tpm2/BackwardsCompatibilityBitArray.c',
'tpm2/BackwardsCompatibilityObject.c',
'tpm2/LibtpmsCallbacks.c',
'tpm2/NVMarshal.c',
'tpm2/RuntimeAlgorithm.c',
'tpm2/RuntimeAttributes.c',
'tpm2/RuntimeCommands.c',
'tpm2/RuntimeProfile.c',
'tpm2/StateMarshal.c',
'tpm2/Volatile.c',
)
tpm2_lib = static_library('tpms_tpm2', tpm2_sources,
c_args: common_c_args + crypto_flags + [
'-D_POSIX_C_SOURCE=200809L',