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

Build of OpenSC 0.23.0 fails against LibreSSL 3.8+ #2836

Closed
ismaell opened this issue Aug 15, 2023 · 4 comments · Fixed by #2837
Closed

Build of OpenSC 0.23.0 fails against LibreSSL 3.8+ #2836

ismaell opened this issue Aug 15, 2023 · 4 comments · Fixed by #2837

Comments

@ismaell
Copy link

ismaell commented Aug 15, 2023

Problem Description

sc-ossl-compat.h defines EVP_sha3_* which are implemented by LibreSSL 3.8.0+.

Build Log

  CC       libopensc_la-card-westcos.lo
In file included from card-westcos.c:37:
/usr/include/openssl/evp.h:627:32: error: macro "EVP_sha3_224" passed 1 arguments, but takes just 0
  627 | const EVP_MD *EVP_sha3_224(void);
      |                                ^
In file included from internal.h:45,
                 from card-westcos.c:30:
../../src/libopensc/sc-ossl-compat.h:52: note: macro "EVP_sha3_224" defined here
   52 | #define EVP_sha3_224()                          (NULL)
      |
/usr/include/openssl/evp.h:628:32: error: macro "EVP_sha3_256" passed 1 arguments, but takes just 0
  628 | const EVP_MD *EVP_sha3_256(void);
      |                                ^
../../src/libopensc/sc-ossl-compat.h:53: note: macro "EVP_sha3_256" defined here
   53 | #define EVP_sha3_256()                          (NULL)
      |
/usr/include/openssl/evp.h:629:32: error: macro "EVP_sha3_384" passed 1 arguments, but takes just 0
  629 | const EVP_MD *EVP_sha3_384(void);
      |                                ^
../../src/libopensc/sc-ossl-compat.h:54: note: macro "EVP_sha3_384" defined here
   54 | #define EVP_sha3_384()                          (NULL)
      |
/usr/include/openssl/evp.h:630:32: error: macro "EVP_sha3_512" passed 1 arguments, but takes just 0
  630 | const EVP_MD *EVP_sha3_512(void);
      |                                ^
../../src/libopensc/sc-ossl-compat.h:55: note: macro "EVP_sha3_512" defined here
   55 | #define EVP_sha3_512()                          (NULL)
      |
make[3]: *** [Makefile:1852: libopensc_la-card-westcos.lo] Error 1
frankmorgner added a commit to frankmorgner/OpenSC that referenced this issue Aug 15, 2023
@frankmorgner
Copy link
Member

Please try #2837 as a possible fix

@ismaell ismaell changed the title Build fails against LibreSSL 3.8+ Build of OpenSC 0.23.0 fails against LibreSSL 3.8+ Aug 15, 2023
@ismaell
Copy link
Author

ismaell commented Aug 15, 2023

Thanks, that fixes the build for the master branch.

For 0.23.0 I had to apply the following commits as well:

@ismaell
Copy link
Author

ismaell commented Aug 15, 2023

I ended up with an uninitialized idx variable (framework-pkcs15.c:1580) on 0.23.0. Exposed by the -Os flag with GCC 13.2.0.

Built with:

CFLAGS='-Os' ./configure && make

Error:

framework-pkcs15.c: In function 'pkcs15_create_tokens':
framework-pkcs15.c:1656:43: error: 'idx' may be used uninitialized [-Werror=maybe-uninitialized]
 1656 |                         slot->fw_data_idx = idx;
      |                         ~~~~~~~~~~~~~~~~~~^~~~~
framework-pkcs15.c:1580:20: note: 'idx' was declared here
 1580 |         int rc, i, idx;
      |                    ^~~
cc1: all warnings being treated as errors

@frankmorgner
Copy link
Member

You can fix this by initializing idx with 0. This seems to be a false positive, which is why I don't want to add this change to the PR

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 a pull request may close this issue.

2 participants