aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2019-05-22 15:17:48 +0200
committerHans Nilsson <[email protected]>2019-06-14 13:33:07 +0200
commite4afb9b62bfcfc2e89ffb893163c2bd374ec7865 (patch)
treeb7990ff13ee63632c6339d29cea3ed9d5353a597 /lib/crypto
parentc8be59d5ec262084b335eceec2ab1db0a6dd133d (diff)
downloadotp-e4afb9b62bfcfc2e89ffb893163c2bd374ec7865.tar.gz
otp-e4afb9b62bfcfc2e89ffb893163c2bd374ec7865.tar.bz2
otp-e4afb9b62bfcfc2e89ffb893163c2bd374ec7865.zip
crypto: Begin test of the new mac interface directly.
Diffstat (limited to 'lib/crypto')
-rw-r--r--lib/crypto/test/crypto_SUITE.erl19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/crypto/test/crypto_SUITE.erl b/lib/crypto/test/crypto_SUITE.erl
index 3b60de9eb7..0da70d5592 100644
--- a/lib/crypto/test/crypto_SUITE.erl
+++ b/lib/crypto/test/crypto_SUITE.erl
@@ -1049,6 +1049,25 @@ cmac_check({cmac, Type, Key, Text, Size, CMac}) ->
ct:fail({{crypto, cmac, [Type, Key, Text, Size]}, {expected, ExpCMac}, {got, Other}})
end.
+
+mac_check({MacType, SubType, Key, Text, Mac}) ->
+ ExpMac = iolist_to_binary(Mac),
+ case crypto:mac(MacType, SubType, Key, Text) of
+ ExpMac ->
+ ok;
+ Other ->
+ ct:fail({{crypto, mac, [MacType, SubType, Key, Text]}, {expected, ExpMac}, {got, Other}})
+ end;
+mac_check({MacType, SubType, Key, Text, Size, Mac}) ->
+ ExpMac = iolist_to_binary(Mac),
+ case crypto:mac(MacType, SubType, Key, Text, Size) of
+ ExpMac ->
+ ok;
+ Other ->
+ ct:fail({{crypto, mac, [MacType, SubType, Key, Text]}, {expected, ExpMac}, {got, Other}})
+ end.
+
+
block_cipher({Type, Key, PlainText}) ->
Plain = iolist_to_binary(PlainText),
CipherText = crypto:block_encrypt(Type, Key, PlainText),