[erlang-questions] crypto:hmac/3 using hardware acceleration

Ben Browitt ben.browitt@REDACTED
Wed May 8 13:15:51 CEST 2019


I've tested the speed with and without evp. evp is slower because Intel
cpus don't have hardware acceleration for sha.
So it's best to leave it without evp for now. Thanks.
openssl speed sha1
openssl speed -evp sha1

On Wed, May 8, 2019 at 1:06 PM Hans Nilsson R <hans.r.nilsson@REDACTED>
wrote:

> Yes it's possible to use the EVP_* functions. But it is nothing that we
> plan to do for the moment.
>
> But pull-requests are always welcome :)
>
> /Hans
>
> On Tue, 2019-05-07 at 19:19 +0300, Ben Browitt wrote:
>
> Profiling my server with eprof show that my app spends most of the time
> on  crypto:hmac(sha, Key, Data) while crypto:stream_encrypt/2 using aes_ctr
> is much faster.
>
> This answer [1] says that HMAC_* routines are software based and don't use
> hardware. The hmac nif seems to use them [2].
>
> Is my resolution correct?
> Is it possible to use EVP_* functions instead of HMAC_* functions in the
> nif?
>
> [1] https://stackoverflow.com/a/20322002
> [2] https://github.com/erlang/otp/blob/master/lib/crypto/c_src/hmac.c
> <https://protect2.fireeye.com/url?k=ff45ecfa-a3d7e1a6-ff45ac61-0cc47ad93d46-7719c85c2345896d&u=https://github.com/erlang/otp/blob/master/lib/crypto/c_src/hmac.c>
>
> _______________________________________________
>
> erlang-questions mailing list
>
> erlang-questions@REDACTED
>
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20190508/4c5d9154/attachment.htm>


More information about the erlang-questions mailing list