Skip to content

Add evp_cipher perftool#70

Closed
andrewkdinh wants to merge 2 commits into
openssl:mainfrom
andrewkdinh:evp_cipher
Closed

Add evp_cipher perftool#70
andrewkdinh wants to merge 2 commits into
openssl:mainfrom
andrewkdinh:evp_cipher

Conversation

@andrewkdinh

@andrewkdinh andrewkdinh commented Jan 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a CLI tool evp_cipher that encrypts random data using the specified algorithm.
Runs for 5 seconds and prints the average execution time per encryption.

Fixes openssl/project#1727

Features

  • Two modes of operation:
    • evp_isolated: Use EVP API and don't allow shared data between threads
    • evp_shared (default): Use EVP API and allow shared data between threads (i.e. pre-initializing & sharing the EVP_CIPHER_CTX)
  • Currently supported algorithms: [AES-128-CBC, AES-256-CBC] (default: AES-128-CBC)
  • 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#1726 & openssl/openssl#29433), support for freezing the context store has not been added yet.

Usage

$ ./evp_cipher -h
Usage: evp_cipher [-h] [-t] [-o operation] [-u update-times] [-a algorithm] thread-count
-h - print this help output
-t - terse output
-o operation - mode of operation. One of [evp_isolated, evp_shared] (default: evp_shared)
-u update-times - times to update (default: 1)
-a algorithm - One of: [AES-128-CBC, AES-256-CBC] (default: AES-128-CBC)
thread-count - number of threads

$ ./evp_cipher -a AES-128-CBC -o evp_shared 10 # AES-128-CBC encryption algorithm, evp_shared operation mode, 10 threads
Average time per encryption: 0.202960us

$ ./evp_cipher -a AES-128-CBC -o evp_isolated 10 # now using evp_isolated operation mode
Average time per encryption: 2.418870us

Findings

Initial results showed that evp_isolated mode generally runs about 10x slower than evp_shared mode.

@andrewkdinh andrewkdinh changed the title Add evp_hash perftool Add evp_cipher perftool Jan 15, 2026
@andrewkdinh andrewkdinh marked this pull request as ready for review January 16, 2026 13:15

@jogme jogme left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the global err reporting is a bit confusing, but LGTM!

@andrewkdinh andrewkdinh added the approval: done This pull request has the required number of approvals label Jan 20, 2026
nhorman pushed a commit that referenced this pull request Jan 23, 2026
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Fri Jan 23 21:20:21 2026
(Merged from #70)
nhorman pushed a commit that referenced this pull request Jan 23, 2026
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Fri Jan 23 21:20:24 2026
(Merged from #70)
@nhorman

nhorman commented Jan 23, 2026

Copy link
Copy Markdown
Contributor

merged to main, thank you

@nhorman nhorman closed this Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval: done This pull request has the required number of approvals

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add evp_perftool cipher test

3 participants