openssl / openssl/openssl

Enable Keccak AVX-512 support

Open
#21,126 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

branch: master triaged: feature triaged: performance
Dominant language
C
Stars
30.8k
Forks
11.5k
Avg merge
10m
Merged PRs (30d)
1

Description

After testing, I think that OpenSSL 3.0.8 (and older) as available in current
Fedora 38, Keccak acceleration with AVX-512 is seemingly not activated. I
performed a timing with a file that I generated as follows:

dd if=/dev/zero of=/dev/shm/file count=8 bs=1GB

I am maintaining my own crypto library [1]. That library contains an AVX-512
implementation whose timing is:

$ time build/hash/tests/hasher -h SHA3-512 -f /dev/shm/file
Message digest =
b2cc3439955e990d319bfc5b0bc1401ae18de07ff275abad5fec77e0f921e8e3d77b9a58b769cd44c7b0fa5c300782a97d151259bd63a76cd16f278c3a4c0126

real 0m54,888s
user 0m53,969s
sys 0m0,762s

Using OpenSSL's implementation on the very same system:

time openssl dgst -sha3-512 /dev/shm/file
SHA3-512(/dev/shm/file)=
b2cc3439955e990d319bfc5b0bc1401ae18de07ff275abad5fec77e0f921e8e3d77b9a58b769cd44c7b0fa5c300782a97d151259bd63a76cd16f278c3a4c0126

real 1m20,355s
user 1m18,127s
sys 0m1,984s

After forcing my implementation to use AVX2 (as opposed to AVX-512):

$ time build/hash/tests/hasher -h SHA3-512 -f /dev/shm/file
Message digest =
b2cc3439955e990d319bfc5b0bc1401ae18de07ff275abad5fec77e0f921e8e3d77b9a58b769cd44c7b0fa5c300782a97d151259bd63a76cd16f278c3a4c0126

real 1m17,026s
user 1m15,906s
sys 0m0,901s

You see, it seems to be the case that AVX-512 support is not active for Keccak.

[1] https://www.chronox.de/leancrypto.html

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported openssl dgst -sha3-512 /dev/shm/file timing and compare it with the AVX-2 and AVX-512 timings described in the issue. Trace the Keccak/SHA3 implementation and CPU-feature dispatch to determine whether AVX-512 is selected; done means AVX-512 acceleration is active where supported and the reported digest remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
cryptography, performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.