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
Øyvind Kolås
firmware
Commits
73919274
Commit
73919274
authored
Oct 15, 2020
by
schneider
Browse files
change(micropython): Use CSPRNG to seed MP RNG
Closes #36
parent
81c0b221
Changes
2
Hide whitespace changes
Inline
Side-by-side
pycardium/mpconfigport.h
View file @
73919274
...
...
@@ -31,7 +31,7 @@
#define MICROPY_MODULE_WEAK_LINKS (1)
/* urandom init */
int
mp_hal_
t
rng_read_int
(
void
);
int
mp_hal_
csp
rng_read_int
(
void
);
/* Builtin function and modules */
#define MICROPY_PY_ALL_SPECIAL_METHODS (1)
...
...
@@ -43,7 +43,7 @@ int mp_hal_trng_read_int(void);
#define MICROPY_PY_UJSON (1)
#define MICROPY_PY_URANDOM (1)
#define MICROPY_PY_URANDOM_EXTRA_FUNCS (1)
#define MICROPY_PY_URANDOM_SEED_INIT_FUNC (mp_hal_
t
rng_read_int())
#define MICROPY_PY_URANDOM_SEED_INIT_FUNC (mp_hal_
csp
rng_read_int())
#define MICROPY_PY_URE (1)
#define MICROPY_PY_URE_MATCH_GROUPS (1)
#define MICROPY_PY_URE_MATCH_SPAN_START_END (1)
...
...
pycardium/mphalport.c
View file @
73919274
...
...
@@ -294,12 +294,12 @@ void NORETURN nlr_jump_fail(void *val)
}
/******************************************************************************
*
T
RNG
*
CSP
RNG
*/
int
mp_hal_
t
rng_read_int
(
void
)
int
mp_hal_
csp
rng_read_int
(
void
)
{
int
result
;
epic_
t
rng_read
((
uint8_t
*
)
&
result
,
sizeof
(
result
));
epic_
csp
rng_read
((
uint8_t
*
)
&
result
,
sizeof
(
result
));
return
result
;
}
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