Skip to content

Instantly share code, notes, and snippets.

@maximvl
Created January 21, 2014 17:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maximvl/8544010 to your computer and use it in GitHub Desktop.
Save maximvl/8544010 to your computer and use it in GitHub Desktop.
erl
Erlang R16B01 (erts-5.10.2) [source-bdf5300] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V5.10.2 (abort with ^G)
1> crypto:start().
ok
2> H = crypto:hmac_init(sha, "test").
<<128,144,53,134,175,127,0,0,128,144,53,134,175,127,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,...>>
3> H2 = crypto:hmac_update(H, "hello world").
<<128,144,53,134,175,127,0,0,128,144,53,134,175,127,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,...>>
4> crypto:hmac_final(H2) == crypto:hmac_final(H).
[1] 20604 segmentation fault (core dumped) erl
%
@sverker
Copy link

sverker commented Jan 22, 2014

Is this something you want to do? That is, use the same hmac context several times (H in this case)? Or is it just something you discovered from a typo in your code?

@sverker
Copy link

sverker commented Feb 19, 2014

Fix done for OTP 17.0.
You will get a badarg exception instead of segmentation fault.
We can not support hmac context reuse as OpenSSL does not support it.

/Sverker, Erlang/OTP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment