aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2013-05-28 11:38:20 +0200
committerIngela Anderton Andin <[email protected]>2013-05-28 11:38:20 +0200
commite910933e572a84f145184000438097c4f2a531d7 (patch)
tree556607170e64156d193fc08a72c8a29a4ee1e75f /lib/compiler/src
parent1b5d887a79f31031caf3fc9f0b282b2d1ce71ce9 (diff)
parent7f5fa1b06671d31476e0fc0f28b878a6b5059b1b (diff)
downloadotp-e910933e572a84f145184000438097c4f2a531d7.tar.gz
otp-e910933e572a84f145184000438097c4f2a531d7.tar.bz2
otp-e910933e572a84f145184000438097c4f2a531d7.zip
Merge remote-tracking branch 'upstream/maint'
Conflicts: bootstrap/lib/stdlib/ebin/beam_lib.beam lib/public_key/test/erl_make_certs.erl
Diffstat (limited to 'lib/compiler/src')
-rw-r--r--lib/compiler/src/compile.erl20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl
index 745f1d5cf9..2ca403de54 100644
--- a/lib/compiler/src/compile.erl
+++ b/lib/compiler/src/compile.erl
@@ -1197,9 +1197,9 @@ abstract_code(#compile{code=Code,options=Opts,ofile=OFile}) ->
encrypt_abs_code(Abstr, Key0) ->
try
- {Mode,RealKey} = generate_key(Key0),
+ RealKey = generate_key(Key0),
case start_crypto() of
- ok -> {ok,encrypt(Mode, RealKey, Abstr)};
+ ok -> {ok,encrypt(RealKey, Abstr)};
{error,_}=E -> E
end
catch
@@ -1216,19 +1216,19 @@ start_crypto() ->
{error,[{none,?MODULE,no_crypto}]}
end.
-generate_key({Mode,String}) when is_atom(Mode), is_list(String) ->
- {Mode,beam_lib:make_crypto_key(Mode, String)};
+generate_key({Type,String}) when is_atom(Type), is_list(String) ->
+ beam_lib:make_crypto_key(Type, String);
generate_key(String) when is_list(String) ->
generate_key({des3_cbc,String}).
-encrypt(des3_cbc=Mode, {K1,K2,K3, IVec}, Bin0) ->
- Bin1 = case byte_size(Bin0) rem 8 of
+encrypt({des3_cbc=Type,Key,IVec,BlockSize}, Bin0) ->
+ Bin1 = case byte_size(Bin0) rem BlockSize of
0 -> Bin0;
- N -> list_to_binary([Bin0,random_bytes(8-N)])
+ N -> list_to_binary([Bin0,random_bytes(BlockSize-N)])
end,
- Bin = crypto:des3_cbc_encrypt(K1, K2, K3, IVec, Bin1),
- ModeString = atom_to_list(Mode),
- list_to_binary([0,length(ModeString),ModeString,Bin]).
+ Bin = crypto:block_encrypt(Type, Key, IVec, Bin1),
+ TypeString = atom_to_list(Type),
+ list_to_binary([0,length(TypeString),TypeString,Bin]).
random_bytes(N) ->
{A,B,C} = now(),