google / google/go-tpm-tools

Build failure of 0.4.7 on ppc64el and s390x

Open
#703 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
309
Forks
118
Avg merge
1d 16h
Merged PRs (30d)
33

Description

Hi! I help maintain this package for Debian. It builds fine on many platforms, but on ppc64el and s390x there is build problems for the embedded C code.

For ppc64el:

https://ci.debian.net/packages/g/golang-github-google-go-tpm-tools/testing/ppc64el/68775364/

```
...
63s os
63s internal/fmtsort
63s encoding/binary
63s github.com/google/go-tpm-tools/simulator/internal
63s # github.com/google/go-tpm-tools/simulator/internal
63s In file included from src/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Tpm.h:47,
63s from src/github.com/google/go-tpm-tools/simulator/internal/internal_cgo.go:47:
63s src/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/LibSupport.h:54:9: error: #error Unable to determine RADIX_BITS from compiler environment
63s 54 | # error Unable to determine RADIX_BITS from compiler environment
63s | ^~~~~
63s In file included from src/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Global.h:82,
63s from src/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Tpm.h:52:
63s src/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/BnValues.h:66:3: error: #error "Unsupported radix"
63s 66 | # error "Unsupported radix"
63s | ^~~~~
63s src/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/BnValues.h:312:9: error: #error "RADIX_BITS must either be 32 or 64"
63s 312 | # error "RADIX_BITS must either be 32 or 64"
63s | ^~~~~
63s In file included from src/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/BnValues.h:317:
63s src/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ossl/TpmToOsslMath.h:73:5: error: #error Ossl library is using different radix
63s 73 | # error Ossl library is using different radix
63s | ^~~~~
63s In file included from src/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Global.h:85:
63s src/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptRand.h:67:30: error: division by zero in #if
63s 67 | #if ((DRBG_KEY_SIZE_BITS % RADIX_BITS) != 0) \
63s | ^
63s src/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptRand.h:69:2: error: #error "Key size and IV for DRBG must be even multiples of the radix"
63s 69 | #error "Key size and IV for DRBG must be even multiples of the radix"
63s | ^~~~~
63s golang.org/x/sys/unix
63s fmt
63s crypto/internal/sysrand
63s net
...
```

For s390x:

https://ci.debian.net/packages/g/golang-github-google-go-tpm-tools/testing/s390x/68775547/

```
...
time
68s internal/syscall/unix
68s github.com/google/go-tpm-tools/simulator/internal
68s # github.com/google/go-tpm-tools/simulator/internal
68s In file included from src/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Tpm.h:47,
68s from src/github.com/google/go-tpm-tools/simulator/internal/internal_cgo.go:47:
68s src/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/LibSupport.h:54:9: error: #error Unable to determine RADIX_BITS from compiler environment
68s 54 | # error Unable to determine RADIX_BITS from compiler environment
68s | ^~~~~
68s In file included from src/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Global.h:82,
68s from src/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Tpm.h:52:
68s src/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/BnValues.h:66:3: error: #error "Unsupported radix"
68s 66 | # error "Unsupported radix"
68s | ^~~~~
68s src/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/BnValues.h:312:9: error: #error "RADIX_BITS must either be 32 or 64"
68s 312 | # error "RADIX_BITS must either be 32 or 64"
68s | ^~~~~
68s In file included from src/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/BnValues.h:317:
68s src/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ossl/TpmToOsslMath.h:73:5: error: #error Ossl library is using different radix
68s 73 | # error Ossl library is using different radix
68s | ^~~~~
68s In file included from src/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Global.h:85:
68s src/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptRand.h:67:30: error: division by zero in #if
68s 67 | #if ((DRBG_KEY_SIZE_BITS % RADIX_BITS) != 0) \
68s | ^
68s src/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptRand.h:69:2: error: #error "Key size and IV for DRBG must be even multiples of the radix"
68s 69 | #error "Key size and IV for DRBG must be even multiples of the radix"
68s | ^~~~~
68s crypto/internal/fips140/nistec
68s context
68s internal/poll
68s io/fs
...
```

Any ideas?

Thanks,
Simon

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Debian CI builds for ppc64el and s390x, then read simulator/internal/internal_cgo.go and the compiler checks in ms-tpm-20-ref/TPMCmd/tpm/include/LibSupport.h and BnValues.h. Compare the radix-related checks with TpmToOsslMath.h and CryptRand.h. Done means the simulator package builds successfully on both architectures.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, go
Domain
security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.