Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
ccf704ba
Commit
ccf704ba
authored
7 years ago
by
Kaspar Schleiser
Browse files
Options
Downloads
Patches
Plain Diff
sys: random: use luid to generate random seed
parent
ac2e2e21
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Makefile.dep
+2
-0
2 additions, 0 deletions
Makefile.dep
sys/auto_init/auto_init.c
+2
-5
2 additions, 5 deletions
sys/auto_init/auto_init.c
sys/random/Makefile
+2
-0
2 additions, 0 deletions
sys/random/Makefile
sys/random/seed.c
+41
-0
41 additions, 0 deletions
sys/random/seed.c
with
47 additions
and
5 deletions
Makefile.dep
+
2
−
0
View file @
ccf704ba
...
@@ -656,6 +656,8 @@ ifneq (,$(filter random,$(USEMODULE)))
...
@@ -656,6 +656,8 @@ ifneq (,$(filter random,$(USEMODULE)))
ifneq
(,$(filter prng_tinymt32,$(USEMODULE)))
ifneq
(,$(filter prng_tinymt32,$(USEMODULE)))
USEMODULE
+=
tinymt32
USEMODULE
+=
tinymt32
endif
endif
USEMODULE
+=
luid
endif
endif
ifneq
(,$(filter openthread_contrib,$(USEMODULE)))
ifneq
(,$(filter openthread_contrib,$(USEMODULE)))
...
...
This diff is collapsed.
Click to expand it.
sys/auto_init/auto_init.c
+
2
−
5
View file @
ccf704ba
...
@@ -80,10 +80,6 @@
...
@@ -80,10 +80,6 @@
#include
"net/fib.h"
#include
"net/fib.h"
#endif
#endif
#ifdef MODULE_PRNG
#include
"random.h"
#endif
#ifdef MODULE_GCOAP
#ifdef MODULE_GCOAP
#include
"net/gcoap.h"
#include
"net/gcoap.h"
#endif
#endif
...
@@ -99,7 +95,8 @@
...
@@ -99,7 +95,8 @@
void
auto_init
(
void
)
void
auto_init
(
void
)
{
{
#ifdef MODULE_PRNG
#ifdef MODULE_PRNG
random_init
(
0
);
void
auto_init_random
(
void
);
auto_init_random
();
#endif
#endif
#ifdef MODULE_XTIMER
#ifdef MODULE_XTIMER
DEBUG
(
"Auto init xtimer module.
\n
"
);
DEBUG
(
"Auto init xtimer module.
\n
"
);
...
...
This diff is collapsed.
Click to expand it.
sys/random/Makefile
+
2
−
0
View file @
ccf704ba
SRC
:=
seed.c
BASE_MODULE
:=
prng
BASE_MODULE
:=
prng
SUBMODULES
:=
1
SUBMODULES
:=
1
...
...
This diff is collapsed.
Click to expand it.
sys/random/seed.c
0 → 100644
+
41
−
0
View file @
ccf704ba
/**
* Copyright (C) 2017 Kaspar Schleiser <kaspar@schleiser.de>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup sys_random
* @{
* @file
*
* @brief PRNG seeding
*
* @author Kaspar Schleiser <kaspar@schleiser.de>
* @}
*/
#include
<stdint.h>
#include
"log.h"
#include
"luid.h"
#include
"periph/cpuid.h"
#include
"random.h"
#define ENABLE_DEBUG (0)
#include
"debug.h"
void
auto_init_random
(
void
)
{
uint32_t
seed
;
#ifdef MODULE_PERIPH_CPUID
luid_get
(
&
seed
,
4
);
#else
LOG_WARNING
(
"random: NO SEED AVAILABLE!
\n
"
);
seed
=
1
;
#endif
DEBUG
(
"random: using seed value %u
\n
"
,
(
unsigned
)
seed
);
random_init
(
seed
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment