File bitcask-2.0.8-crypto.patch of Package bitcask
diff -Ndurp bitcask-2.0.8/src/bitcask.erl bitcask-2.0.8-crypto/src/bitcask.erl
--- bitcask-2.0.8/src/bitcask.erl 2017-03-04 01:37:58.000000000 +0200
+++ bitcask-2.0.8-crypto/src/bitcask.erl 2019-07-07 01:18:19.831031690 +0300
@@ -2236,7 +2236,7 @@ fold_corrupt_file_test2() ->
% and a pending hash is created. There *has* to be an iterator open when you
% call this or it will loop for ever and ever. Don't try this at home.
put_till_frozen(B) ->
- Key = crypto:rand_bytes(32),
+ Key = crypto:strong_rand_bytes(32),
bitcask:put(B, Key, <<>>),
bitcask:delete(B, Key),
diff -Ndurp bitcask-2.0.8/src/bitcask_nifs.erl bitcask-2.0.8-crypto/src/bitcask_nifs.erl
--- bitcask-2.0.8/src/bitcask_nifs.erl 2017-03-04 01:37:58.000000000 +0200
+++ bitcask-2.0.8-crypto/src/bitcask_nifs.erl 2019-07-07 01:18:28.405829767 +0300
@@ -733,7 +733,7 @@ keydir_itr_out_of_date_test2() ->
end).
put_till_frozen(R, Name) ->
- bitcask_nifs:keydir_put(R, crypto:rand_bytes(32), 0, 1234, 0, 1, bitcask_time:tstamp()),
+ bitcask_nifs:keydir_put(R, crypto:strong_rand_bytes(32), 0, 1234, 0, 1, bitcask_time:tstamp()),
{ready, Ref2} = bitcask_nifs:keydir_new(Name),
%%?debugFmt("Putting", []),
case bitcask_nifs:keydir_itr_int(Ref2, 2000001,
diff -Ndurp bitcask-2.0.8/test/bcfold_setup bitcask-2.0.8-crypto/test/bcfold_setup
--- bitcask-2.0.8/test/bcfold_setup 2017-03-04 01:37:58.000000000 +0200
+++ bitcask-2.0.8-crypto/test/bcfold_setup 2019-07-07 01:18:08.134307128 +0300
@@ -40,8 +40,8 @@ make_dir(Dir, KeySz, BinSz) ->
BinarySize = 14 + KeySz + BinSz + 12,
%% 1GB
NumObjs = (1073741824 div BinarySize) + 1,
- Key = crypto:rand_bytes(KeySz),
- Bin = crypto:rand_bytes(BinSz),
+ Key = crypto:strong_rand_bytes(KeySz),
+ Bin = crypto:strong_rand_bytes(BinSz),
[bitcask:put(Ref, <<Key/binary,X:32>>, Bin) ||
X <- lists:seq(1, NumObjs)],
bitcask:close(Ref).