Created
January 21, 2014 17:12
-
-
Save maximvl/8544010 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
% |
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
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?