Skip to content

Conversation

@andrewkdinh
Copy link
Contributor

@andrewkdinh andrewkdinh commented Feb 5, 2026

Summary

Adds a CLI tool evp_rand that generates random data with HASH-DRGB.
Runs for 5 seconds and prints the average execution time per computation.

openssl/project#1840

Features

  • Two modes of operation:
    • evp_shared (default): Use EVP API and allow shared data between computations
    • evp_isolated: Use EVP API and don't allow shared data between computations
  • Configurable number of times to update
  • Terse output for easier CI automation (-t)
  • Configurable thread count

TODO: Since freeze functionality hasn't been properly added yet (see openssl/project#1835 & openssl/openssl#29433), support for freezing the context store has not been added yet.

Usage

$ ./evp_rand -h
Usage: evp_rand [-h] [-t] [-o operation] [-V] thread-count
-h - print this help output
-t - terse output
-o operation - mode of operation. One of [evp_isolated, evp_shared] (default: evp_shared)
-V - print version information and exit
thread-count - number of thread

$ ./evp_rand -o evp_shared 10 # evp_shared operation mode, 10 threads
Average time per computation: 2.888452us

$ ./evp_rand -o evp_isolated 10 # now using evp_isolated mode
Average time per computation: 9.663231us

Findings

Initial results showed that evp_isolated takes about 3x time as evp_shared

@andrewkdinh andrewkdinh linked an issue Feb 6, 2026 that may be closed by this pull request
@andrewkdinh andrewkdinh marked this pull request as ready for review February 9, 2026 15:52
Copy link
Contributor

@nhorman nhorman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this test completely replace the randbytes test? i.e. should that one be deleted in this PR?

@andrewkdinh
Copy link
Contributor Author

@nhorman I don’t think the randbytes test should be removed. The randbytes test calls RAND_BYTES while this perftool focuses on EVP_RAND.

Copy link
Contributor

@Sashan Sashan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me.

@Sashan
Copy link
Contributor

Sashan commented Feb 10, 2026

should this test completely replace the randbytes test? i.e. should that one be deleted in this PR?

I don't feel strongly about that. however if we are going for this, than it should be seperate PR.

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 this pull request may close these issues.

Create perftool for EVP_RAND

4 participants