tpm2-software / tpm2-tss

OSS implementation of the TCG TPM2 Software Stack (TSS2)
https://tpm2-software.github.io
BSD 2-Clause "Simplified" License
730 stars 359 forks source link

consistent include / header file layout #93

Closed flihp closed 8 years ago

flihp commented 8 years ago

Related to the point raised by @theopolis in #92: The include directives in some of the TSS code, namely the common test code, references headers in a way that requires that their location be on the gcc search path.

With the tpm2.0-tools referencing this code directly (not how they were intended to be used I imagine, but the code is useful so it's being used elsewhere) we run into a situation where the the tpm2.0-tools build must either use the headers in the TPM2.0-TSS repo (the current approach) or it will need to be told where to search for them on the build host. The later is preferable as it prevents us from referencing headers and compiled libraries that may be out of sync though it requires that the tpm2.0-tools know where to find the installed headers.

Neither of these two approaches are ideal though. The "right way to do it" is a bit more invasive and requires two things:

1) modify the code layout a bit in the TPM2.0-TSS repo so that all headers that are installed reside under $(srcdir)/include/ and in the same relative location when they're installed. 2) Update the common code to include headers relative to $(PREFIX)/include instead of $(PREFIX)/include/tpm2(sapi|tcti) like they do now. Using https://github.com/01org/TPM2.0-TSS/blob/master/test/common/sample/CatSizedByteBuffer.c#L28 as an example this would require changing #include to #include <tpm2sapi/tpm20.h>

The most disruptive change will be the first as it will effect both the Linux build as well as the Windows build. I doubt the changes will be significant but they will need to be coordinated. I'll put together a PR in the next few days to make this more clear.

flihp commented 8 years ago

These changes were trivial but I've held up the PR till I get my Windows system back from the IT shop for testing. If you're interested the Linux bits are up on my github mirror. I'll get the windows build tested when I get my laptop back.

theopolis commented 8 years ago

Hey @flihp, I pulled your branch on my development machines. Looks and builds great!

flihp commented 8 years ago

thx for the extra set of eyes on this @theopolis. After being locked in mortal combat with Visual Studio for a day I've managed to update the VS build files as well. PR is #99

Also turns out that some of these headers shouldn't be installed in the first place (whoops!). Sorting that out today.

flihp commented 8 years ago

merged, missed trigger in commit message