aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/test/crypto_SUITE.erl
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2012-08-15 20:45:47 +0200
committerSverker Eriksson <[email protected]>2012-08-15 20:45:47 +0200
commit125f494f3a0e31502d209fd050d16f47b9d417da (patch)
tree7bf1913838039690236b84e2b49ee7e48ea67af8 /lib/crypto/test/crypto_SUITE.erl
parentf3c830eddc68d7269d4f48b13ddae40893929573 (diff)
parent6faad239766accdcc007540f0b8b38d4709cd435 (diff)
downloadotp-125f494f3a0e31502d209fd050d16f47b9d417da.tar.gz
otp-125f494f3a0e31502d209fd050d16f47b9d417da.tar.bz2
otp-125f494f3a0e31502d209fd050d16f47b9d417da.zip
Merge branch 'sverk/crypto-unaligned-aes-cfb/OTP-10136' into maint
* sverk/crypto-unaligned-aes-cfb/OTP-10136: crypto: Allow aes_cfb_128_{en|de}crypt to accept unaligned data
Diffstat (limited to 'lib/crypto/test/crypto_SUITE.erl')
-rw-r--r--lib/crypto/test/crypto_SUITE.erl17
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/crypto/test/crypto_SUITE.erl b/lib/crypto/test/crypto_SUITE.erl
index 627c966dfb..196f00da5d 100644
--- a/lib/crypto/test/crypto_SUITE.erl
+++ b/lib/crypto/test/crypto_SUITE.erl
@@ -717,10 +717,19 @@ aes_cfb(Config) when is_list(Config) ->
?line Key = hexstr2bin("2b7e151628aed2a6abf7158809cf4f3c"),
?line IVec = hexstr2bin("000102030405060708090a0b0c0d0e0f"),
?line Plain = hexstr2bin("6bc1bee22e409f96e93d7e117393172a"),
- ?line Cipher = crypto:aes_cfb_128_encrypt(Key, IVec, Plain),
- ?line m(Cipher, hexstr2bin("3b3fd92eb72dad20333449f8e83cfb4a")),
- ?line m(Plain,
- crypto:aes_cfb_128_decrypt(Key, IVec, Cipher)).
+ ?line Cipher = hexstr2bin("3b3fd92eb72dad20333449f8e83cfb4a"),
+
+ %% Try all prefixes of plain and cipher.
+ aes_cfb_do(byte_size(Plain), Plain, Cipher, Key, IVec).
+
+aes_cfb_do(N, Plain, Cipher, Key, IVec) when N >= 0 ->
+ <<P:N/binary, _/binary>> = Plain,
+ <<C:N/binary, _/binary>> = Cipher,
+ ?line C = crypto:aes_cfb_128_encrypt(Key, IVec, P),
+ ?line P = crypto:aes_cfb_128_decrypt(Key, IVec, C),
+ aes_cfb_do(N-1, Plain, Cipher, Key, IVec);
+aes_cfb_do(_, _, _, _, _) -> ok.
+
%%
%%