Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mismatch of OpenSSL function signatures that cause errors with gc… #283

Merged
merged 1 commit into from
Aug 12, 2024

Conversation

mgerstner
Copy link
Contributor

…c-14

Building with gcc-14 fails with diagnostics like this:

src/tpm2-tss-engine-rsa.c:805:46: error: passing argument 2 of 'EVP_PKEY_meth_set_copy' from incompatible pointer type [-Wincompatible-pointer-types]
  805 |     EVP_PKEY_meth_set_copy(pkey_rsa_methods, rsa_pkey_copy);
      |                                              ^~~~~~~~~~~~~
      |                                              |
      |                                              int (*)(EVP_PKEY_CTX *, EVP_PKEY_CTX *) {aka int (*)(struct evp_pkey_ctx_st *, struct evp_pkey_ctx_st *)}
/usr/include/openssl/evp.h:2005:36: note: expected 'int (*)(EVP_PKEY_CTX *, const EVP_PKEY_CTX *)' {aka 'int (*)(struct evp_pkey_ctx_st *, const struct evp_pkey_ctx_st *)'} but argument is of type 'int (*)(EVP_PKEY_CTX *, EVP_PKEY_CTX *)' {aka 'int (*)(struct evp_pkey_ctx_st *, struct evp_pkey_ctx_st *)'}

A look into OpenSSL upstream shows that these functions have always had const src parameters. Thus this error was simply not detected by earlier compiler versions.

bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this pull request May 7, 2024
https://build.opensuse.org/request/show/1172350
by user mgerstner + dimstar_suse
- Add gcc14-fixes.patch: Building with gcc14 fails due to a mismatch in
  OpenSSL function declarations. Provided PR# to upstream here:
  tpm2-software/tpm2-tss-engine#283
- Add tpm2-tss-engine.keyring: needed for validation of the tarball signature.
  This keyring is taken over from tpm2-0-tss which has the same (or very
  similar) maintainers.
@bluca
Copy link
Contributor

bluca commented Aug 9, 2024

@williamcroberts any chance you could please look into this PR? The project fails to build with GCC 14

@williamcroberts
Copy link
Member

@mgerstner can you sign off on your commit and re-push? Otherwise, LGTM.

…c-14

Building with gcc-14 fails with diagnostics like this:

```
src/tpm2-tss-engine-rsa.c:805:46: error: passing argument 2 of 'EVP_PKEY_meth_set_copy' from incompatible pointer type [-Wincompatible-pointer-types]
  805 |     EVP_PKEY_meth_set_copy(pkey_rsa_methods, rsa_pkey_copy);
      |                                              ^~~~~~~~~~~~~
      |                                              |
      |                                              int (*)(EVP_PKEY_CTX *, EVP_PKEY_CTX *) {aka int (*)(struct evp_pkey_ctx_st *, struct evp_pkey_ctx_st *)}
/usr/include/openssl/evp.h:2005:36: note: expected 'int (*)(EVP_PKEY_CTX *, const EVP_PKEY_CTX *)' {aka 'int (*)(struct evp_pkey_ctx_st *, const struct evp_pkey_ctx_st *)'} but argument is of type 'int (*)(EVP_PKEY_CTX *, EVP_PKEY_CTX *)' {aka 'int (*)(struct evp_pkey_ctx_st *, struct evp_pkey_ctx_st *)'}
```

A look into OpenSSL upstream shows that these functions have always had const
`src` parameters. Thus this error was simply not detected by earlier compiler
versions.

Signed-off-by: Matthias Gerstner <[email protected]>
@mgerstner
Copy link
Contributor Author

@mgerstner can you sign off on your commit and re-push? Otherwise, LGTM.

I just did so.

@williamcroberts williamcroberts merged commit 766505b into tpm2-software:master Aug 12, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants