From 5805b576e5c817faf697985ea2d2ce205d9b52d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Mon, 13 May 2013 11:13:50 +0200 Subject: beam_lib, compile: Replace use of deprecated crypto functions Since both the STDLIB and compiler applications turn warnings into errors, we must stop using the old deprecated crypto functions. While we are at it, generalize the format of the key tuple returned by beam_lib:make_crypto_key/2 to facilitate introducing new crypto methods in the future. Change the format to: {Type,Key,IV,BlockSize} where Type, Key, and IV are the first three arguments for either crypto:block_encrypt4/ or crypto:block_decrypt/4, and BlockSize is the block size for the crypto algorithm (it is needed to properly pad the plaintext blocks before encryption). --- lib/compiler/test/compile_SUITE.erl | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/compiler/test/compile_SUITE.erl') diff --git a/lib/compiler/test/compile_SUITE.erl b/lib/compiler/test/compile_SUITE.erl index 229e5a98a1..c635d13c89 100644 --- a/lib/compiler/test/compile_SUITE.erl +++ b/lib/compiler/test/compile_SUITE.erl @@ -492,6 +492,16 @@ encrypted_abstr_1(Simple, Target) -> ?line {error,beam_lib,{key_missing_or_invalid,"simple.beam",abstract_code}} = beam_lib:chunks("simple.beam", [abstract_code]), ?line ok = file:set_cwd(OldCwd), + + %% Test key compatibility by reading a BEAM file produced before + %% the update to the new crypto functions. + install_crypto_key("an old key"), + KeyCompat = filename:join(filename:dirname(Simple), + "key_compatibility"), + {ok,{key_compatibility,[Chunk]}} = beam_lib:chunks(KeyCompat, + [abstract_code]), + {abstract_code,{raw_abstract_v1,_}} = Chunk, + ok. -- cgit v1.2.3