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

rdrand: Remove checking for 0 and !0 and instead check CPU family and do a self-test #335

Merged
merged 6 commits into from Feb 9, 2023

Commits on Feb 8, 2023

  1. Use correct flag name

    The flag name is +rdrand not +rdrnd
    
    Signed-off-by: Joe Richey <joerichey@google.com>
    josephlr committed Feb 8, 2023
    Copy the full SHA
    a56faa8 View commit details
    Browse the repository at this point in the history
  2. rdrand: Remove check for 0 and !0 values

    Also makes rdrand() return an integer instead of an array of bytes. This
    will make the self-test implementation easier. As we can just return a
    `usize` we no longer need the `WORD_SIZE` constant.
    
    Signed-off-by: Joe Richey <joerichey@google.com>
    josephlr committed Feb 8, 2023
    Copy the full SHA
    c4f7f45 View commit details
    Browse the repository at this point in the history
  3. rdrand: Add CPUID feature detection and self-test

    Signed-off-by: Joe Richey <joerichey@google.com>
    josephlr committed Feb 8, 2023
    Copy the full SHA
    82c3cb8 View commit details
    Browse the repository at this point in the history
  4. Use !0 instead of usize::MAX

    We could use core::usize::MAX, but that is deprecated.
    
    Signed-off-by: Joe Richey <joerichey@google.com>
    josephlr committed Feb 8, 2023
    Copy the full SHA
    f394230 View commit details
    Browse the repository at this point in the history
  5. Remove comment implying this code only runs on SGX

    Signed-off-by: Joe Richey <joerichey@google.com>
    josephlr committed Feb 8, 2023
    Copy the full SHA
    6a3fac8 View commit details
    Browse the repository at this point in the history
  6. Make rdrand_exact #[target_feature(enable = "rdrand")]

    Signed-off-by: Joe Richey <joerichey@google.com>
    josephlr committed Feb 8, 2023
    Copy the full SHA
    5f7aadf View commit details
    Browse the repository at this point in the history