rust icon indicating copy to clipboard operation
rust copied to clipboard

Add getentropy for RTEMS

Open thesummer opened this issue 1 year ago • 6 comments

RTEMS provides the getentropy function. Use this for providing random data.

This PR enables the getentropy function for the RTEMS operating system to get random data. It is exposed via libc (see https://github.com/rust-lang/libc/pull/3975).

thesummer avatar Oct 16 '24 08:10 thesummer

r? @Noratrieb

rustbot has assigned @Noratrieb. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

rustbot avatar Oct 16 '24 08:10 rustbot

Does RTEMS also have a suitable arc4random interface? If so, I'd prefer that, as we use that on nearly all other UNIXes.

Also I don't think the libc change has been released yet? That'll need to happen before this can be merged.

r? joboet

joboet avatar Oct 16 '24 13:10 joboet

@joboet I checked and the arc4random function is also available. I updated the PR accordingly. This currently also does not require further changes to libc.

However, I might try to still move the function declaration there.

thesummer avatar Oct 16 '24 14:10 thesummer

The changes in libc have been released tonight: https://github.com/rust-lang/libc/releases/tag/0.2.160

@joboet My suggestion would be to merge this PR with arc4random_buf defined here in std. I will add the definition to libc, so that it will become part of 0.2.161 and change it here afterwards. Alternatively, we can go back to the getentropy version and move to arc4random with the next libc release. Any preferences?

My goal is to get a first compiling version of the RTEMS tier 3 port into the mainline, so I can setup a local CI to track changes/regressions. Currently I have to manually monitor the different repos which is not ideal.

thesummer avatar Oct 17 '24 08:10 thesummer

My suggestion would be to merge this PR with arc4random_buf defined here in std.

That seems reasonable. Could you also add RTEMS to the documentation for DefaultRandomSource? After that, I think this PR is ready to merge.

joboet avatar Oct 17 '24 18:10 joboet

@joboet Thanks fixed.

thesummer avatar Oct 17 '24 19:10 thesummer

There are merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged.

You can start a rebase with the following commands:

$ # rebase
$ git pull --rebase https://github.com/rust-lang/rust.git master
$ git push --force-with-lease

The following commits are merge commits:

  • 339ae32d71a41b1542d9c1345a0f678f5511c20e

rustbot avatar Oct 18 '24 08:10 rustbot

@bors r+ rollup

joboet avatar Oct 18 '24 10:10 joboet

:pushpin: Commit e20636a78621d823334f3114d5d49ab8a442dfa3 has been approved by joboet

It is now in the queue for this repository.

bors avatar Oct 18 '24 10:10 bors