Commit Graph

9 Commits

Author SHA1 Message Date
Fabrice Fontaine
fb57ad9b9d build: Fix errors with glibc < 2.25
getrandom and sys/random.h are only available since glibc 2.25:
https://www.gnu.org/software/gnulib/manual/html_node/sys_002frandom_002eh.html
resulting in the following build failures since version 5.63 and
https://git.kernel.org/pub/scm/bluetooth/bluez.git/log/?qt=grep&q=getrandom:

plugins/autopair.c:20:24: fatal error: sys/random.h: No such file or directory
 #include <sys/random.h>
                        ^

To fix this build failure, add util_getrandom and a fallback (borrowed
from pipewire and licensed under MIT):
https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/src/pipewire/utils.c

Fixes:
 - http://autobuild.buildroot.org/results/6b8870d12e0804d6154230a7322c49416c1dc0e2
2022-02-15 13:36:35 -08:00
Tedd Ho-Jeong An
df64c87022 emulator: Replace random number generation function
This patch replaces the rand() function to the getrandom() syscall.

It was reported by the Coverity scan
  rand() should not be used for security-related applications, because
  linear congruential algorithms are too easy to break
2021-12-08 16:56:17 -08:00
Tedd Ho-Jeong An
8d23082905 emulator: Fix the unchecked return value
This patch fixes the unchecked return value.
2020-11-24 13:03:46 -08:00
Tedd Ho-Jeong An
f24ee89ab9 emulator: Add SPDX License Identifier
This patch adds SPDX License Identifier and removes the license text.

-------------------------------------
       License            COUNT
-------------------------------------
 LGPL-2.1-or-later    :     20
 GPL-2.0-or-later     :      2

License: LGPL-2.1-or-later
   emulator/server.c
   emulator/amp.c
   emulator/hciemu.c
   emulator/vhci.c
   emulator/btdev.c
   emulator/serial.h
   emulator/le.h
   emulator/le.c
   emulator/main.c
   emulator/amp.h
   emulator/hciemu.h
   emulator/bthost.h
   emulator/btdev.h
   emulator/vhci.h
   emulator/serial.c
   emulator/phy.c
   emulator/smp.c
   emulator/phy.h
   emulator/bthost.c
   emulator/server.h

License: GPL-2.0-or-later
   emulator/b1ee.c
   emulator/hfp.c
2020-09-21 16:19:34 -07:00
Marcel Holtmann
261948090e build: Move declaration of _GNU_SOURCE back into individual source files 2018-12-06 21:28:18 +01:00
Johan Hedberg
649215b62f shared: Move mainloop implementation from monitor to shared 2015-02-12 12:32:07 +02:00
Marcel Holtmann
f58086c23f emulator: Fix leaking file descriptor 2014-12-14 13:53:51 +01:00
Marcel Holtmann
03336eed5a emulator: Add support for simple PHY simulation 2014-12-14 05:14:37 +01:00
Marcel Holtmann
d6c1d96051 emulator: Add skeleton for virtual PHY handling 2014-12-14 01:04:59 +01:00