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

Can't build on macOS due to using the deprecated explicit_bzero function #483

Open
shamilsan opened this issue Dec 2, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@shamilsan
Copy link

shamilsan commented Dec 2, 2023

Description

When trying to build the library on macOS I get an error:

ledger-secure-sdk/src/os.c:331:5: error: call to undeclared function 'explicit_bzero'

There is no explicit_bzero function in macOS SDK's strings.h. There is only bzero function.

Your environment

  • OS and version: macOS 14.1.2 (23B2091)
  • branch that causes this issue: master

Proposed solution

explicit_bzero is not portable and is deprecated in favor of memset. There is the memset_explicit function in the C23 standard, but it has not been added to macOS SDK yet.

Maybe it's worth implementing a custom function for zeroing sensitive information.

void zeroize(void *buf, size_t len) {
    void *volatile const bufv = buf;
    memset(bufv, 0, len);
}
@shamilsan shamilsan added the bug Something isn't working label Dec 2, 2023
@tdejoigny-ledger
Copy link
Contributor

Hello @shamilsan, you can use our docker image, it's easier to use and it's working on macOS.

@shamilsan
Copy link
Author

Hello @shamilsan, you can use our docker image, it's easier to use and it's working on macOS.

Thank you for the suggestion, @tdejoigny-ledger
Yes, I can, but native compilation is simpler and faster for me. Anyway, it is better not to use obsolete functions as they can be removed in the future. And there's no significant barrier to support macOS too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants