diff options
author | Raimo Niskanen <raimo@erlang.org> | 2023-05-02 15:43:27 +0200 |
---|---|---|
committer | Raimo Niskanen <raimo@erlang.org> | 2023-05-02 15:43:27 +0200 |
commit | e182323919b8ff695e48e5c5648306716482a3c4 (patch) | |
tree | 4350506b0745c57680b117dbf7c73876648b4557 | |
parent | fa7f01c633afc3d7a15763e8391ba31480e3e583 (diff) | |
parent | f382175f7439451a8726f2f3b3cf8ee06f224aa8 (diff) | |
download | erlang-e182323919b8ff695e48e5c5648306716482a3c4.tar.gz |
Merge branch 'raimo/test-cuddle'
* raimo/test-cuddle:
CMAC is only possible with CBC mode
Test all algorithms documented for CMAC Update
Remove unsuported algorithm from cmac_update test
-rw-r--r-- | lib/crypto/src/crypto.erl | 2 | ||||
-rw-r--r-- | lib/crypto/test/crypto_SUITE.erl | 25 |
2 files changed, 13 insertions, 14 deletions
diff --git a/lib/crypto/src/crypto.erl b/lib/crypto/src/crypto.erl index 69b01e6418..6abaacad5c 100644 --- a/lib/crypto/src/crypto.erl +++ b/lib/crypto/src/crypto.erl @@ -685,8 +685,6 @@ hash_final_xof(Context, Length) -> -type hmac_hash_algorithm() :: sha1() | sha2() | sha3() | compatibility_only_hash(). -type cmac_cipher_algorithm() :: aes_128_cbc | aes_192_cbc | aes_256_cbc | aes_cbc - | aes_128_cfb128 | aes_192_cfb128 | aes_256_cfb128 | aes_cfb128 - | aes_128_cfb8 | aes_192_cfb8 | aes_256_cfb8 | aes_cfb8 | blowfish_cbc | des_cbc | des_ede3_cbc | rc2_cbc diff --git a/lib/crypto/test/crypto_SUITE.erl b/lib/crypto/test/crypto_SUITE.erl index 516ad02ee2..0572feaf33 100644 --- a/lib/crypto/test/crypto_SUITE.erl +++ b/lib/crypto/test/crypto_SUITE.erl @@ -1,7 +1,7 @@ % %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2022. All Rights Reserved. +%% Copyright Ericsson AB 1999-2023. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -411,11 +411,11 @@ groups() -> {ecdh, [], [compute, generate, use_all_ecdh_generate_compute]}, {eddh, [], [compute, generate, use_all_eddh_generate_compute]}, {srp, [], [generate_compute]}, - {des_cbc, [], [api_ng, api_ng_one_shot, api_ng_tls]}, + {des_cbc, [], [api_ng, api_ng_one_shot, api_ng_tls, cmac, cmac_update]}, {des_cfb, [], [api_ng, api_ng_one_shot, api_ng_tls]}, - {des_ede3_cbc, [], [api_ng, api_ng_one_shot, api_ng_tls, cmac]}, + {des_ede3_cbc, [], [api_ng, api_ng_one_shot, api_ng_tls, cmac, cmac_update]}, {des_ede3_cfb, [], [api_ng, api_ng_one_shot, api_ng_tls]}, - {rc2_cbc, [], [api_ng, api_ng_one_shot, api_ng_tls]}, + {rc2_cbc, [], [api_ng, api_ng_one_shot, api_ng_tls, cmac, cmac_update]}, {aes_cfb8, [], []}, {aes_128_cfb8, [], [api_ng, api_ng_one_shot, api_ng_tls]}, {aes_192_cfb8, [], [api_ng, api_ng_one_shot, api_ng_tls]}, @@ -426,7 +426,7 @@ groups() -> {aes_192_cfb128, [], [api_ng, api_ng_one_shot, api_ng_tls]}, {aes_256_cfb128, [], [api_ng, api_ng_one_shot, api_ng_tls]}, {no_aes_cfb128, [], [no_support]}, - {blowfish_cbc, [], [api_ng, api_ng_one_shot, api_ng_tls]}, + {blowfish_cbc, [], [api_ng, api_ng_one_shot, api_ng_tls, cmac, cmac_update]}, {blowfish_ecb, [], [api_ng, api_ng_one_shot]}, {blowfish_cfb64, [], [api_ng, api_ng_one_shot, api_ng_tls]}, {blowfish_ofb64, [], [api_ng, api_ng_one_shot, api_ng_tls]}, @@ -473,15 +473,15 @@ groups() -> {des_ede3_cbc, [], [api_ng, api_ng_one_shot, api_ng_tls]}, {des_ede3_cfb, [], [api_ng, api_ng_one_shot, api_ng_tls]}, {aes_128_cbc, [], [api_ng, api_ng_one_shot, api_ng_tls, cmac, cmac_update]}, - {aes_192_cbc, [], [api_ng, api_ng_one_shot, api_ng_tls]}, - {aes_256_cbc, [], [api_ng, api_ng_one_shot, api_ng_tls, cmac]}, + {aes_192_cbc, [], [api_ng, api_ng_one_shot, api_ng_tls, cmac, cmac_update]}, + {aes_256_cbc, [], [api_ng, api_ng_one_shot, api_ng_tls, cmac, cmac_update]}, {aes_128_ctr, [], [api_ng, api_ng_one_shot, api_ng_tls]}, {aes_192_ctr, [], [api_ng, api_ng_one_shot, api_ng_tls]}, {aes_256_ctr, [], [api_ng, api_ng_one_shot, api_ng_tls]}, {aes_128_ccm, [], [aead_ng, aead_bad_tag]}, {aes_192_ccm, [], [aead_ng, aead_bad_tag]}, {aes_256_ccm, [], [aead_ng, aead_bad_tag]}, - {aes_128_ecb, [], [api_ng, api_ng_one_shot, cmac_update]}, + {aes_128_ecb, [], [api_ng, api_ng_one_shot]}, {aes_192_ecb, [], [api_ng, api_ng_one_shot]}, {aes_256_ecb, [], [api_ng, api_ng_one_shot]}, {aes_128_gcm, [], [aead_ng, aead_bad_tag]}, @@ -2378,6 +2378,8 @@ do_configure_mac(cmac, Cipher, Config) -> case Cipher of aes_128_cbc -> fun() -> read_rsp(Config, Cipher, ["CMACGenAES128.rsp", "CMACVerAES128.rsp"]) end; + aes_192_cbc -> + fun() -> read_rsp(Config, Cipher, ["CMACGenAES192.rsp", "CMACVerAES192.rsp"]) end; aes_256_cbc -> fun() -> read_rsp(Config, Cipher, ["CMACGenAES256.rsp", "CMACVerAES256.rsp"]) end; des_ede3_cbc -> @@ -2933,10 +2935,9 @@ hmac_inc(_) -> [<<"Sampl">>, <<"e #1">>]. -cmac_key(aes_128_cbc) -> - hexstr2bin("8eeca0d146fd09ffbbe0d47edcddfcec"); -cmac_key(aes_128_ecb) -> - hexstr2bin("8eeca0d146fd09ffbbe0d47edcddfcec"). +cmac_key(SubType) -> + rand:bytes( + maps:get(key_length, crypto:cipher_info(SubType))). cmac_inc(_) -> [<<"Sampl">>, <<"e #1">>]. |