Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

at86rf2xx_internal: Don't get a random number with the function at86rf2xx_get_random #18285

Closed
RocioRojas opened this issue Jun 30, 2022 · 0 comments · Fixed by #18290
Closed

Comments

@RocioRojas
Copy link

Description

I need to get a seed cryptographically secure and I used the PR #4989, but the test described in that PR won't work with the board samr21-xpro.

Steps to reproduce the issue

Tested with the following change in file tests/driver_at86rf2xx/main.c on samr21-xpro board :


   for (int i = 0; i < 10; i++) {
       unsigned int test = 0;
        at86rf2xx_get_random(devs, (uint8_t *)&test, sizeof(test));
        printf("%08x\n", test);
  }

Expected results

If I put this line:

prev_state = at86rf2xx_set_state(dev, AT86RF2XX_STATE_SLEEP);

at the end of at86rf2xx_configure_phy function in drivers/at86rf2xx/at86rf2xx_internal.c

The results are:

2022-06-28 23:39:54,159 # Initialization successful - starting the shell now
> 2022-06-28 23:39:56,422 # main(): This is RIOT! (Version: 2021.10-devel-4249-g5f574-HEAD)
2022-06-28 23:39:56,424 # AT86RF2xx device driver test
2022-06-28 23:39:56,428 # Initializing AT86RF2xx radio at SPI_0
2022-06-28 23:39:56,432 # a4cebbd9
2022-06-28 23:39:56,434 # e28fc5e1
2022-06-28 23:39:56,435 # 02161afd
2022-06-28 23:39:56,436 # 71cd3348
2022-06-28 23:39:56,437 # 772d4273
2022-06-28 23:39:56,438 # 07c145b7
2022-06-28 23:39:56,440 # 1340606d
2022-06-28 23:39:56,441 # 99afd90d
2022-06-28 23:39:56,442 # 593021bc
2022-06-28 23:39:56,443 # f790bba0
2022-06-28 23:39:56,448 # Initialization successful - starting the shell now

Note: when I reset the device I get different randoms numbers.

The problem with this solution is that I don't know how this change affects other parts on the module.

Actual results

I get the following answer:

2022-06-28 23:39:26,082 # AT86RF2xx device driver test
2022-06-28 23:39:26,086 # Initializing AT86RF2xx radio at SPI_0
2022-06-28 23:39:26,092 # gnrc_netdev: possibly lost interrupt.
2022-06-28 23:39:26,093 # ffffffff
2022-06-28 23:39:26,094 # ffffffff
2022-06-28 23:39:26,096 # ffffffff
2022-06-28 23:39:26,097 # ffffffff
2022-06-28 23:39:26,098 # ffffffff
2022-06-28 23:39:26,099 # ffffffff
2022-06-28 23:39:26,101 # ffffffff
2022-06-28 23:39:26,102 # ffffffff
2022-06-28 23:39:26,103 # ffffffff
2022-06-28 23:39:26,104 # ffffffff
2022-06-28 23:39:26,109 # Initialization successful - starting the shell now
> 2022-06-28 23:39:38,542 # Exiting Pyterm

Versions

RIOT version Release 2022.04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant