Commit 29d1cf1
committed
Check return value of uk_random_bytes()
lwip provides the LWIP_RAND() macro to obtain random numbers for
purposes like TCP ISNs, source port selection, IP fragment IDs, etc
The default implementation implements the macro using rand(), which
is implements a pseudo-rng. Furthermore, the macro assumes no error
checking.
Unikraft's implementation uses libukarandom's uk_random_bytes() to
provide secure randomness. That function may fail on reseed, so it's
is critical to check its return value. Add a check within the macro,
and treat failures as fatal.
Signed-off-by: Michalis Pappas <[email protected]>
Approved-by: Andrei Tatar <[email protected]>
Reviewed-by: Andrei Tatar <[email protected]>
GitHub-Closes: #681 parent 82a9126 commit 29d1cf1
1 file changed
+8
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
66 | 70 | | |
67 | 71 | | |
68 | 72 | | |
| |||
0 commit comments