Skip to content
Commit b3407f04 authored by Alberto Escolar Piedras's avatar Alberto Escolar Piedras Committed by Benjamin Cabé
Browse files

drivers: entropy: fix native_posix driver for more than 3 byte requests



Fix the native_posix fake entropy driver for more than 3 byte requests,
and specially for native_sim//64 builds.

The host random() provides a number between 0 and 2**31-1 (INT_MAX),
so bit 32 was always 0.
So when filling a buffer with more than 3 bytes we would be filling
each 4th byte with a byte which always had its MSbit as 0.

For LP64 native_sim//64 builds, this was even worse, as the driver had
another bug where we assumed random() returned the whole long filled,
and therefore all 4 upper bytes would be 0.

Signed-off-by: default avatarAlberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
parent b5b5bfca
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment