]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - package/libressl/0002-Fix-build-with-musl-and-older-Linux-kernel.patch
ddb953402d919bd4668c598913538c6e9595aece
[coffee/buildroot.git] / package / libressl / 0002-Fix-build-with-musl-and-older-Linux-kernel.patch
1 From: Baruch Siach <baruch@tkos.co.il>
2 Date: Fri, 29 Sep 2017 10:06:52 +0300
3 Subject: [PATCH] Fix build with musl and older Linux kernel
4
5 The musl libc carries its own copy of Linux system calls. When building
6 with Linux headers older than v3.17, musl provides SYS_getrandom
7 definition, but not GRND_NONBLOCK. This causes build failure for
8 libressl and openntpd:
9
10 getentropy_linux.c: In function 'getentropy_getrandom':
11 getentropy_linux.c:205:42: error: 'GRND_NONBLOCK' undeclared (first use in this function)
12    ret = syscall(SYS_getrandom, buf, len, GRND_NONBLOCK);
13                                           ^~~~~~~~~~~~~
14
15 Define GRND_NONBLOCK locally when its definition is missing to fix the
16 build. There should be no run-time effect. Older kernels return ENOSYS
17 for unsupported syscall().
18
19 [ from upstream pull request with file location changed ]
20 Signed-off-by: Baruch Siach <baruch@tkos.co.il>
21 ---
22 Upstream status: https://github.com/libressl-portable/openbsd/pull/82
23
24 diff -Nuar libressl-2.5.5-orig/crypto/compat/getentropy_linux.c libressl-2.5.5/crypto/compat/getentropy_linux.c
25 --- libressl-2.5.5-orig/crypto/compat/getentropy_linux.c        2017-07-09 13:59:48.000000000 +0300
26 +++ libressl-2.5.5/crypto/compat/getentropy_linux.c     2017-09-29 10:03:32.447958829 +0300
27 @@ -194,6 +194,11 @@
28  }
29  
30  #ifdef SYS_getrandom
31 +
32 +#ifndef GRND_NONBLOCK
33 +#define GRND_NONBLOCK   0x0001
34 +#endif
35 +
36  static int
37  getentropy_getrandom(void *buf, size_t len)
38  {