Bug 1666317
| Summary: | Inconsistency between tpm documentation and headers | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Piyush Bhoot <pbhoot> | ||||
| Component: | tpm-tools | Assignee: | Jerry Snitselaar <jsnitsel> | ||||
| Status: | CLOSED ERRATA | QA Contact: | Vilém Maršík <vmarsik> | ||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | 7.7 | CC: | jsnitsel, jwright, rvr, smeisner | ||||
| Target Milestone: | rc | ||||||
| Target Release: | 7.8 | ||||||
| Hardware: | All | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2020-03-31 20:11:13 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Bug Depends On: | |||||||
| Bug Blocks: | 1713151 | ||||||
| Attachments: |
|
||||||
Patch submitted upstream to fix outdated manpage. Hi, the manpage added the BOOL argument, but still says: #include <tpm_unseal/tpm_unseal.h> If you try this, you get: # gcc test.c test.c:1:35: fatal error: tpm_unseal/tpm_unseal.h: No such file or directory #include <tpm_unseal/tpm_unseal.h> On the other hand, if you try #include <tpm_tools/tpm_unseal.h> you get: # gcc test.c In file included from test.c:1:0: /usr/include/tpm_tools/tpm_unseal.h:40:49: error: unknown type name ‘BOOL’ int tpmUnsealFile(char*, unsigned char**, int*, BOOL); I guess this should work, and if another header defines the type BOOL, it should be included from tpm_unseal.h _and_ required by tpm-tools-devel, right? Did I miss something? Version: tpm-tools-devel-1.3.9-5.el7.x86_64 Yeah, kick this back to me. I'm not sure if I just swept this bz up with the other manpage cleanup bz and I guess completely missed what this was asking. We should drop this from the errata and I can clean it up for 7.8. tpm_utils.h includes a define of BOOL, but it doesn't ship in either package I think it is just used for building everything. Okay, removed from erratum. Pushed with patch to correct header include in example to <tpm_tools/tpm_unseal.h>. I've come across another issue here, but I don't think it is exception or blocker worthy since it has existed since 2009 according to git blame. The tpmUnsealFile declaration in tpm_unseal.h uses BOOL, but nothing defines BOOL for 3rd party programs that make use of libtpm_unseal and tpm_unseal.h. The tpm-tools code itself has the following in tpm_utils.h: #ifndef BOOL #define BOOL int #endif and I think the solution would be to add that to tpm_unseal.h as well. I've opened bug #1770048 to track it. Jerry, is this really fixed?
[root@amd-pike-02 ~]# g++ tpmtest.cpp
In file included from tpmtest.cpp:1:0:
/usr/include/tpm_tools/tpm_unseal.h:40:49: error: ‘BOOL’ has not been declared
int tpmUnsealFile(char*, unsigned char**, int*, BOOL);
^
tpmtest.cpp: In function ‘int main()’:
tpmtest.cpp:7:15: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
char* path = "/home/testuser/.ssh/.ldappasswd";
^
tpmtest.cpp:13:40: error: too few arguments to function ‘int tpmUnsealFile(char*, unsigned char**, int*, int)’
r = tpmUnsealFile(path, data, datasize);
^
In file included from tpmtest.cpp:1:0:
/usr/include/tpm_tools/tpm_unseal.h:40:5: note: declared here
int tpmUnsealFile(char*, unsigned char**, int*, BOOL);
^
[root@amd-pike-02 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.8 Beta (Maipo)
It looks like your test program is still using the old signature, and doesn't have the 4th argument. The header file and manpage match each other now, which this bug was reporting, but there is an issue with the header file mentioned in comment #11. BOOL isn't defined, and causes the problem unless someone adds the bit I put in that comment. This apparently has existed in the header file upstream since 2009: f581b0f6b85bf (Rajiv Andrade 2009-08-20 17:22:59 -0300 44) int tpmUnsealFile(char*, unsigned char**, int*, BOOL); 7b7019074dbc5 (kylene 2005-08-12 18:52:46 +0000 45) void tpmUnsealShred(unsigned char*, int); I meant to say that the manpage now points to tpm_tools/tpm_unseal.h. The function signature in the manpage was fixed in 1.3.9-5. Okay, if I change the function call according to the manpage, it will not fail on this, but on the missing BOOL. You reported that as another bug, but then closed it as WONTFIX. From my point of view, things are still broken. We can close this, but why not at least fix the BOOL problem for 7.9 ? Do you think that none will compile TPM code on RHEL7 in the future? No one has complained about the problem which has existed for over 10 years. So either no one is compiling against it, or they are solving the BOOL undefined then they see it. If you want, open that bz back up and I'll fix that. Okay, TPM1.2 is obsolete anyway, closing. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2020:1184 |
Created attachment 1520776 [details] reproducer Description of problem: Inconsistency between tpm documentation and headers The `man 3 tpmUnsealFile` documentation says to "#include <tpm_unseal/tpm_unseal.h>" and that the signature for tpmUnsealFile is "int tpmUnsealFile(char* file, char** data, int* size);" If you look at the header file, which is actually at /usr/include/tpm_tools/tpm_unseal.h, the signature for that function is "int tpmUnsealFile(char*, unsigned char**, int*, BOOL)". One of these must be incorrect. Version-Release number of selected component (if applicable): tpm-tools-devel-1.3.9-2.el7.x86_64 tpm-tools-1.3.9-2.el7.x86_64 How reproducible: Always Steps to Reproduce: Reproducer code attached Actual results: tmptest.cpp:13:40: error: too few arguments to function ‘int tpmUnsealFile(char*, unsigned char**, int*, int)’ r = tpmUnsealFile(path, data, datasize); ^ In file included from tmptest.cpp:1:0: /usr/include/tpm_tools/tpm_unseal.h:40:5: note: declared here int tpmUnsealFile(char*, unsigned char**, int*, BOOL); Expected results: No error or warning