Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
Icecast libigloo
Commits
b5abbe48
Commit
b5abbe48
authored
Feb 24, 2021
by
Philipp Schafft
🦁
Committed by
Philipp Schafft
Feb 22, 2022
Browse files
Feature: Consider machine-id, and boot-id for PRNG
parent
eaff9f89
Changes
2
Hide whitespace changes
Inline
Side-by-side
configure.ac
View file @
b5abbe48
...
...
@@ -102,6 +102,27 @@ CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}"
CPPFLAGS="${CPPFLAGS} ${PTHREAD_CPPFLAGS}"
LIBS="${LIBS} ${PTHREAD_LIBS}"
AC_DEFUN([IC_CHECK_PATH], [
AC_ARG_WITH([$1],
AS_HELP_STRING([--with-$1=PATH], [Sets the path to the $1 file]),
[],
[AS_IF([test "$build" = "$host"],
[AC_CHECK_FILE([$4],
[with_$2="$4"],
[])],
[])])
AS_IF([test "$with_$2" != "no"],
[
AS_IF([test "$with_$2" = "yes"], [AC_MSG_ERROR([You need to supply a path as value for --with-$1])])
AC_DEFINE_UNQUOTED([PATH_$3], ["$with_$2"], [Define to $1 path])
])
])
IC_CHECK_PATH([machine-id], [machine_id], [MACHINE_ID], [/etc/machine-id])
IC_CHECK_PATH([boot-id], [boot_id], [BOOT_ID], [/proc/sys/kernel/random/boot_id])
AC_DEFINE(igloo_INTERNAL,1,[Set to signal that we are building libigloo in contrast to linking against libigloo.])
AC_REQUIRE_AUX_FILE([tap-driver.sh])
...
...
src/prng.c
View file @
b5abbe48
...
...
@@ -195,6 +195,18 @@ static igloo_error_t get_inited_state(igloo_prng_state_t **state, size_t *instan
self
->
bits
=
5
;
self
->
state
|=
STATE_INITED
;
#if defined(PATH_BOOT_ID) || defined(PATH_MACHINE_ID)
// this is safe as we are inited now. In worst case we read initial seeds twice.
pthread_mutex_unlock
(
&
(
self
->
lock
));
#ifdef PATH_BOOT_ID
igloo_prng_read_file
(
instance
,
PATH_BOOT_ID
,
-
1
,
-
1
,
igloo_PRNG_FLAG_NONE
);
#endif
#ifdef PATH_MACHINE_ID
igloo_prng_read_file
(
instance
,
PATH_MACHINE_ID
,
-
1
,
0
,
igloo_PRNG_FLAG_NONE
);
#endif
pthread_mutex_lock
(
&
(
self
->
lock
));
#endif
}
return
igloo_ERROR_NONE
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment