aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/crypto/doc/src/crypto.xml12
-rw-r--r--lib/crypto/src/crypto.erl10
-rw-r--r--lib/crypto/test/crypto_SUITE.erl127
3 files changed, 73 insertions, 76 deletions
diff --git a/lib/crypto/doc/src/crypto.xml b/lib/crypto/doc/src/crypto.xml
index eff6129622..34de65217b 100644
--- a/lib/crypto/doc/src/crypto.xml
+++ b/lib/crypto/doc/src/crypto.xml
@@ -171,14 +171,14 @@
<funcs>
<func>
<name>block_encrypt(Type, Key, PlainText) -> CipherText</name>
- <fsummary>Encrypt <c>PlainText</c>according to <c>Type</c> block cipher</fsummary>
+ <fsummary>Encrypt <c>PlainText</c> according to <c>Type</c> block cipher</fsummary>
<type>
<v>Type = des_ecb | blowfish_ecb | aes_ecb </v>
<v>Key = block_key() </v>
<v>PlainText = iodata() </v>
</type>
<desc>
- <p>Encrypt <c>PlainText</c>according to <c>Type</c> block cipher.</p>
+ <p>Encrypt <c>PlainText</c> according to <c>Type</c> block cipher.</p>
<p>May throw exception <c>notsup</c> in case the chosen <c>Type</c>
is not supported by the underlying OpenSSL implementation.</p>
</desc>
@@ -186,14 +186,14 @@
<func>
<name>block_decrypt(Type, Key, CipherText) -> PlainText</name>
- <fsummary>Decrypt <c>CipherText</c>according to <c>Type</c> block cipher</fsummary>
+ <fsummary>Decrypt <c>CipherText</c> according to <c>Type</c> block cipher</fsummary>
<type>
<v>Type = des_ecb | blowfish_ecb | aes_ecb </v>
<v>Key = block_key() </v>
<v>PlainText = iodata() </v>
</type>
<desc>
- <p>Decrypt <c>CipherText</c>according to <c>Type</c> block cipher.</p>
+ <p>Decrypt <c>CipherText</c> according to <c>Type</c> block cipher.</p>
<p>May throw exception <c>notsup</c> in case the chosen <c>Type</c>
is not supported by the underlying OpenSSL implementation.</p>
</desc>
@@ -211,7 +211,7 @@
<v>AAD = IVec = CipherText = CipherTag = binary()</v>
</type>
<desc>
- <p>Encrypt <c>PlainText</c>according to <c>Type</c> block cipher.
+ <p>Encrypt <c>PlainText</c> according to <c>Type</c> block cipher.
<c>IVec</c> is an arbitrary initializing vector.</p>
<p>In AEAD (Authenticated Encryption with Associated Data) mode, encrypt
<c>PlainText</c>according to <c>Type</c> block cipher and calculate
@@ -233,7 +233,7 @@
<v>AAD = IVec = CipherText = CipherTag = binary()</v>
</type>
<desc>
- <p>Decrypt <c>CipherText</c>according to <c>Type</c> block cipher.
+ <p>Decrypt <c>CipherText</c> according to <c>Type</c> block cipher.
<c>IVec</c> is an arbitrary initializing vector.</p>
<p>In AEAD (Authenticated Encryption with Associated Data) mode, decrypt
<c>CipherText</c>according to <c>Type</c> block cipher and check the authenticity
diff --git a/lib/crypto/src/crypto.erl b/lib/crypto/src/crypto.erl
index c59c9077c2..695c33f586 100644
--- a/lib/crypto/src/crypto.erl
+++ b/lib/crypto/src/crypto.erl
@@ -154,11 +154,6 @@
-deprecated({aes_ctr_decrypt, 3, next_major_release}).
-deprecated({rc4_encrypt, 2, next_major_release}).
-%aes ecb enc/dec
--export([aes_ecb_encrypt/2,aes_ecb_decrypt/2]).
--deprecated({aes_ecb_encrypt, 2, next_major_release}).
--deprecated({aes_ecb_decrypt, 2, next_major_release}).
-
%% Replace by public/private_encrypt/decrypt
-export([rsa_public_encrypt/3, rsa_private_decrypt/3]).
-export([rsa_private_encrypt/3, rsa_public_decrypt/3]).
@@ -216,7 +211,7 @@ supports()->
[{hashs, Hashs},
{ciphers, [des_cbc, des_cfb, des3_cbc, des_ede3, blowfish_cbc,
blowfish_cfb64, blowfish_ofb64, blowfish_ecb, aes_cbc128, aes_cfb8, aes_cfb128,
- aes_cbc256, rc2_cbc, aes_ctr, rc4] ++ Ciphers},
+ aes_cbc256, rc2_cbc, aes_ctr, rc4, aes_ecb] ++ Ciphers},
{public_keys, [rsa, dss, dh, srp] ++ PubKeys}
].
@@ -383,7 +378,7 @@ block_encrypt(blowfish_ecb, Key, Data) ->
block_encrypt(aes_ecb, Key, Data) ->
aes_ecb_encrypt(Key, Data).
--spec block_decrypt(des_ecb | blowfish_ecb, Key::iodata(), Data::iodata()) -> binary().
+-spec block_decrypt(des_ecb | blowfish_ecb | aes_ecb, Key::iodata(), Data::iodata()) -> binary().
block_decrypt(des_ecb, Key, Data) ->
des_ecb_decrypt(Key, Data);
@@ -1875,7 +1870,6 @@ mod_exp_nif(_Base,_Exp,_Mod,_bin_hdr) -> ?nif_stub.
aes_ctr_encrypt, aes_ctr_decrypt,
aes_ctr_stream_init, aes_ctr_stream_encrypt, aes_ctr_stream_decrypt,
%%
- aes_ecb_encrypt, aes_ecb_decrypt,
next_iv,
%% deprecated
aes_cbc_ivec,
diff --git a/lib/crypto/test/crypto_SUITE.erl b/lib/crypto/test/crypto_SUITE.erl
index 1206ba2ca2..e3ff753f71 100644
--- a/lib/crypto/test/crypto_SUITE.erl
+++ b/lib/crypto/test/crypto_SUITE.erl
@@ -1191,98 +1191,101 @@ aes_cbc256() ->
aes_ecb() ->
[
{aes_ecb,
- hexstr2bin("0000000000000000"),
- hexstr2bin("0000000000000000")},
+ <<"YELLOW SUBMARINE">>,
+ <<"YELLOW SUBMARINE">>},
{aes_ecb,
- hexstr2bin("FFFFFFFFFFFFFFFF"),
- hexstr2bin("FFFFFFFFFFFFFFFF")},
+ <<"0000000000000000">>,
+ <<"0000000000000000">>},
{aes_ecb,
- hexstr2bin("3000000000000000"),
- hexstr2bin("1000000000000001")},
+ <<"FFFFFFFFFFFFFFFF">>,
+ <<"FFFFFFFFFFFFFFFF">>},
{aes_ecb,
- hexstr2bin("1111111111111111"),
- hexstr2bin("1111111111111111")},
+ <<"3000000000000000">>,
+ <<"1000000000000001">>},
{aes_ecb,
- hexstr2bin("0123456789ABCDEF"),
- hexstr2bin("1111111111111111")},
+ <<"1111111111111111">>,
+ <<"1111111111111111">>},
{aes_ecb,
- hexstr2bin("0000000000000000"),
- hexstr2bin("0000000000000000")},
+ <<"0123456789ABCDEF">>,
+ <<"1111111111111111">>},
{aes_ecb,
- hexstr2bin("FEDCBA9876543210"),
- hexstr2bin("0123456789ABCDEF")},
+ <<"0000000000000000">>,
+ <<"0000000000000000">>},
{aes_ecb,
- hexstr2bin("7CA110454A1A6E57"),
- hexstr2bin("01A1D6D039776742")},
+ <<"FEDCBA9876543210">>,
+ <<"0123456789ABCDEF">>},
{aes_ecb,
- hexstr2bin("0131D9619DC1376E"),
- hexstr2bin("5CD54CA83DEF57DA")},
+ <<"7CA110454A1A6E57">>,
+ <<"01A1D6D039776742">>},
{aes_ecb,
- hexstr2bin("07A1133E4A0B2686"),
- hexstr2bin("0248D43806F67172")},
+ <<"0131D9619DC1376E">>,
+ <<"5CD54CA83DEF57DA">>},
{aes_ecb,
- hexstr2bin("3849674C2602319E"),
- hexstr2bin("51454B582DDF440A")},
+ <<"07A1133E4A0B2686">>,
+ <<"0248D43806F67172">>},
{aes_ecb,
- hexstr2bin("04B915BA43FEB5B6"),
- hexstr2bin("42FD443059577FA2")},
+ <<"3849674C2602319E">>,
+ <<"51454B582DDF440A">>},
{aes_ecb,
- hexstr2bin("0113B970FD34F2CE"),
- hexstr2bin("059B5E0851CF143A")},
+ <<"04B915BA43FEB5B6">>,
+ <<"42FD443059577FA2">>},
{aes_ecb,
- hexstr2bin("0170F175468FB5E6"),
- hexstr2bin("0756D8E0774761D2")},
+ <<"0113B970FD34F2CE">>,
+ <<"059B5E0851CF143A">>},
{aes_ecb,
- hexstr2bin("43297FAD38E373FE"),
- hexstr2bin("762514B829BF486A")},
+ <<"0170F175468FB5E6">>,
+ <<"0756D8E0774761D2">>},
{aes_ecb,
- hexstr2bin("07A7137045DA2A16"),
- hexstr2bin("3BDD119049372802")},
+ <<"43297FAD38E373FE">>,
+ <<"762514B829BF486A">>},
{aes_ecb,
- hexstr2bin("04689104C2FD3B2F"),
- hexstr2bin("26955F6835AF609A")},
+ <<"07A7137045DA2A16">>,
+ <<"3BDD119049372802">>},
{aes_ecb,
- hexstr2bin("37D06BB516CB7546"),
- hexstr2bin("164D5E404F275232")},
+ <<"04689104C2FD3B2F">>,
+ <<"26955F6835AF609A">>},
{aes_ecb,
- hexstr2bin("1F08260D1AC2465E"),
- hexstr2bin("6B056E18759F5CCA")},
+ <<"37D06BB516CB7546">>,
+ <<"164D5E404F275232">>},
{aes_ecb,
- hexstr2bin("584023641ABA6176"),
- hexstr2bin("004BD6EF09176062")},
+ <<"1F08260D1AC2465E">>,
+ <<"6B056E18759F5CCA">>},
{aes_ecb,
- hexstr2bin("025816164629B007"),
- hexstr2bin("480D39006EE762F2")},
+ <<"584023641ABA6176">>,
+ <<"004BD6EF09176062">>},
{aes_ecb,
- hexstr2bin("49793EBC79B3258F"),
- hexstr2bin("437540C8698F3CFA")},
+ <<"025816164629B007">>,
+ <<"480D39006EE762F2">>},
{aes_ecb,
- hexstr2bin("018310DC409B26D6"),
- hexstr2bin("1D9D5C5018F728C2")},
+ <<"49793EBC79B3258F">>,
+ <<"437540C8698F3CFA">>},
{aes_ecb,
- hexstr2bin("1C587F1C13924FEF"),
- hexstr2bin("305532286D6F295A")},
+ <<"018310DC409B26D6">>,
+ <<"1D9D5C5018F728C2">>},
{aes_ecb,
- hexstr2bin("0101010101010101"),
- hexstr2bin("0123456789ABCDEF")},
+ <<"1C587F1C13924FEF">>,
+ <<"305532286D6F295A">>},
{aes_ecb,
- hexstr2bin("1F1F1F1F0E0E0E0E"),
- hexstr2bin("0123456789ABCDEF")},
+ <<"0101010101010101">>,
+ <<"0123456789ABCDEF">>},
{aes_ecb,
- hexstr2bin("E0FEE0FEF1FEF1FE"),
- hexstr2bin("0123456789ABCDEF")},
+ <<"1F1F1F1F0E0E0E0E">>,
+ <<"0123456789ABCDEF">>},
{aes_ecb,
- hexstr2bin("0000000000000000"),
- hexstr2bin("FFFFFFFFFFFFFFFF")},
+ <<"E0FEE0FEF1FEF1FE">>,
+ <<"0123456789ABCDEF">>},
{aes_ecb,
- hexstr2bin("FFFFFFFFFFFFFFFF"),
- hexstr2bin("0000000000000000")},
+ <<"0000000000000000">>,
+ <<"FFFFFFFFFFFFFFFF">>},
{aes_ecb,
- hexstr2bin("0123456789ABCDEF"),
- hexstr2bin("0000000000000000")},
+ <<"FFFFFFFFFFFFFFFF">>,
+ <<"0000000000000000">>},
{aes_ecb,
- hexstr2bin("FEDCBA9876543210"),
- hexstr2bin("FFFFFFFFFFFFFFFF")}
+ <<"0123456789ABCDEF">>,
+ <<"0000000000000000">>},
+ {aes_ecb,
+ <<"FEDCBA9876543210">>,
+ <<"FFFFFFFFFFFFFFFF">>}
].
aes_ige256() ->