Skip to content

Commit 78d9a50

Browse files
AdamMajercodebytere
authored andcommittedMar 30, 2020
deps: openssl: cherry-pick 4dcb150ea30f
OpenSSL 1.1.1d does not ship with getrandom syscall being predefined on all architectures. So when NodeJS is run with glibc prior to 2.25, where getentropy is unavailable, and the getrandom syscall is unknown, it will fail. PPC64LE or s390 are affected by lack of this definition. Original commit message. commit 4dcb150ea30f9bbfa7946e6b39c30a86aca5ed02 Author: Kurt Roeckx <kurt@roeckx.be> Date: Sat Sep 28 14:59:32 2019 +0200 Add defines for __NR_getrandom for all Linux architectures Fixes: openssl/openssl#10015 Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> GH: openssl/openssl#10044 Fixes: #31671 PR-URL: #32002 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
1 parent df54a19 commit 78d9a50

File tree

1 file changed

+49
-3
lines changed

1 file changed

+49
-3
lines changed
 

‎deps/openssl/openssl/crypto/rand/rand_unix.c

+49-3
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,58 @@ static ssize_t sysctl_random(char *buf, size_t buflen)
282282
# if defined(OPENSSL_RAND_SEED_GETRANDOM)
283283

284284
# if defined(__linux) && !defined(__NR_getrandom)
285-
# if defined(__arm__) && defined(__NR_SYSCALL_BASE)
285+
# if defined(__arm__)
286286
# define __NR_getrandom (__NR_SYSCALL_BASE+384)
287287
# elif defined(__i386__)
288288
# define __NR_getrandom 355
289-
# elif defined(__x86_64__) && !defined(__ILP32__)
290-
# define __NR_getrandom 318
289+
# elif defined(__x86_64__)
290+
# if defined(__ILP32__)
291+
# define __NR_getrandom (__X32_SYSCALL_BIT + 318)
292+
# else
293+
# define __NR_getrandom 318
294+
# endif
295+
# elif defined(__xtensa__)
296+
# define __NR_getrandom 338
297+
# elif defined(__s390__) || defined(__s390x__)
298+
# define __NR_getrandom 349
299+
# elif defined(__bfin__)
300+
# define __NR_getrandom 389
301+
# elif defined(__powerpc__)
302+
# define __NR_getrandom 359
303+
# elif defined(__mips__) || defined(__mips64)
304+
# if _MIPS_SIM == _MIPS_SIM_ABI32
305+
# define __NR_getrandom (__NR_Linux + 353)
306+
# elif _MIPS_SIM == _MIPS_SIM_ABI64
307+
# define __NR_getrandom (__NR_Linux + 313)
308+
# elif _MIPS_SIM == _MIPS_SIM_NABI32
309+
# define __NR_getrandom (__NR_Linux + 317)
310+
# endif
311+
# elif defined(__hppa__)
312+
# define __NR_getrandom (__NR_Linux + 339)
313+
# elif defined(__sparc__)
314+
# define __NR_getrandom 347
315+
# elif defined(__ia64__)
316+
# define __NR_getrandom 1339
317+
# elif defined(__alpha__)
318+
# define __NR_getrandom 511
319+
# elif defined(__sh__)
320+
# if defined(__SH5__)
321+
# define __NR_getrandom 373
322+
# else
323+
# define __NR_getrandom 384
324+
# endif
325+
# elif defined(__avr32__)
326+
# define __NR_getrandom 317
327+
# elif defined(__microblaze__)
328+
# define __NR_getrandom 385
329+
# elif defined(__m68k__)
330+
# define __NR_getrandom 352
331+
# elif defined(__cris__)
332+
# define __NR_getrandom 356
333+
# elif defined(__aarch64__)
334+
# define __NR_getrandom 278
335+
# else /* generic */
336+
# define __NR_getrandom 278
291337
# endif
292338
# endif
293339

0 commit comments

Comments
 (0)
Please sign in to comment.