void-packages/srcpkgs/openssh/patches/bug2722.patch
Leah Neukirchen 6118b964a5 openssh: update to 7.5p1.
Previous build of OpenSSH 7.5p1 broke due to undefined prototypes for
functions provided by LibreSSL, which then were called according to
the wrong calling convention.

We had this situation before in
https://github.com/OpenSMTPD/OpenSMTPD/issues/691

Build with -Werror now to detect new issues arising in the future.
Remove one obsolete constant value to make this pass.

Check OpenBSD libc functions (partially provided by glibc and musl)
using AC_CHECK_DECLS instead to verify they have a prototype.

Explicitly define prototypes for arc4random* when LibreSSL is detected
(from https://bugzilla.mindrot.org/show_bug.cgi?id=2465)
2017-03-21 17:07:11 +01:00

36 lines
1 KiB
Diff

--- openbsd-compat/openbsd-compat.h
+++ openbsd-compat/openbsd-compat.h
@@ -179,20 +179,25 @@ int writev(int, struct iovec *, int);
int getpeereid(int , uid_t *, gid_t *);
#endif
-#ifdef HAVE_ARC4RANDOM
-# ifndef HAVE_ARC4RANDOM_STIR
-# define arc4random_stir()
-# endif
-#else
+#if !defined(HAVE_ARC4RANDOM) || defined(LIBRESSL_VERSION_NUMBER)
unsigned int arc4random(void);
+#endif
+
+#if defined(HAVE_ARC4RANDOM_STIR)
void arc4random_stir(void);
-#endif /* !HAVE_ARC4RANDOM */
+#elif defined(HAVE_ARC4RANDOM) || defined(LIBRESSL_VERSION_NUMBER)
+/* Recent system/libressl implementation; no need for explicit stir */
+# define arc4random_stir()
+#else
+/* openbsd-compat/arc4random.c provides arc4random_stir() */
+void arc4random_stir(void);
+#endif
-#ifndef HAVE_ARC4RANDOM_BUF
+#if !defined(HAVE_ARC4RANDOM_BUF) || defined(LIBRESSL_VERSION_NUMBER)
void arc4random_buf(void *, size_t);
#endif
-#ifndef HAVE_ARC4RANDOM_UNIFORM
+#if !defined(HAVE_ARC4RANDOM_UNIFORM) || defined(LIBRESSL_VERSION_NUMBER)
u_int32_t arc4random_uniform(u_int32_t);
#endif