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

declaring arc4random_buf arc4random arc4random_stir arc4random_uniform #109

Closed
Safari77 opened this issue Jul 17, 2015 · 3 comments
Closed

Comments

@Safari77
Copy link

These functions are not declared in the installed headers.

When compiling openssh-portable on Linux:

sshd.c:397:2: warning: implicit declaration of function ‘arc4random_buf’ [-Wimplicit-function-declaration]

because AC_CHECK_FUNCS does not care about implicit declaration..

@bcook-r7
Copy link
Contributor

I don't think we intend to declare arc4random_buf as a library function in the headers from LibreSSL. It is a compatibility function added to work around this function being missing from the Linux C library. We still need to export the symbol though, since it is used in libcrypto, libssl, libtls, openssl(1), etc. but these use LibreSSL's internal shim headers.

Alternative solutions would be for your C library to support arc4random, or openssh-portable could include the definition in its own compat headers if it is not found in stdlib.h.

@busterb
Copy link
Contributor

busterb commented Aug 20, 2015

I think this should probably be redirected toward the openssh-portable project. The problem is that the configure script is not checking if the system headers are defining these files, which is certainly doable. See the recent discussion about this here #120

@busterb
Copy link
Contributor

busterb commented Sep 12, 2015

I was unable to find the corresponding bug in the openssh portable bug tracker, so I made one. Thanks for the report:

https://bugzilla.mindrot.org/show_bug.cgi?id=2465

@busterb busterb closed this as completed Sep 12, 2015
smaeul added a commit to smaeul/opensmtpd that referenced this issue Jan 11, 2017
These functions are exported by libcrypto from libressl, due to its
similar OpenBSD compatibility layer, but they are not present in any
header files. Thus, while we can use the existing compiled function,
and do not need to provide our own, we do need to provide the prototype
for it.

This avoids implicit function declarations and the resulting crashes due
to pointer truncation.

The patch is based on an equivalent patch for OpenSSH from
https://bugzilla.mindrot.org/show_bug.cgi?id=2465
Also see
libressl/portable#109

Fixes OpenSMTPD#691
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

No branches or pull requests

3 participants