tpm2-software / tpm2-totp

Attest the trustworthiness of a device against a human using time-based one-time passwords
https://tpm2-software.github.io
BSD 3-Clause "New" or "Revised" License
163 stars 36 forks source link

configure.ac: set AC_GNU_SOURCE #15

Closed ffontaine closed 5 years ago

ffontaine commented 5 years ago

Set _GNU_SOURCE globally through AC_GNU_SOURCE

This will fix the following error with gcc 4.8: src/libtpm2-totp.c: In function 'tpm2totp_calculate': src/libtpm2-totp.c:811:5: error: implicit declaration of function 'htobe64' [-Werror=implicit-function-declaration] tmp = htobe64(tmp);

Fixes:

Signed-off-by: Fabrice Fontaine fontaine.fabrice@gmail.com

codecov[bot] commented 5 years ago

Codecov Report

Merging #15 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #15   +/-   ##
=======================================
  Coverage   84.34%   84.34%           
=======================================
  Files           3        3           
  Lines         658      658           
=======================================
  Hits          555      555           
  Misses        103      103
Impacted Files Coverage Δ
src/tpm2-totp.c 82.65% <ø> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 1d39994...5ef98fa. Read the comment docs.

ffontaine commented 5 years ago

Thanks for merging this PR, before releasing a 0.1.2, I'll try to fix another build failure (http://autobuild.buildroot.org/results/852/852bfd7d2025b703406b379559c07eabbc25920e/build-end.log). We have this following error on gcc 5:

src/tpm2-totp.c: In function 'parse_pcrs':
src/tpm2-totp.c:106:19: error: 'str' may be used uninitialized in this function [-Werror=maybe-uninitialized]
         if (errno || endptr == token || *endptr != '\0') {
                   ^
cc1: all warnings being treated as errors

I'll try to understand why and send another PR if I can fix it. An other option would be to add an option to disable -Werror.

AndreasFuchsTPM commented 5 years ago

I kind of like -Werror for upstream to get patchers to actually not leave warnings behind...

You could compile with make CFLAG="-Wno-uninitialized" or similar ?