Skip to content

Commit 77ab063

Browse files
committed
Update MCT harness
1 parent bdfaa6a commit 77ab063

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

test/Jamfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ run test_nist_cavs_shake256_variable_output.cpp ;
154154

155155
run test_nist_cavs_aes128_kat_ecb.cpp ;
156156
run test_nist_cavs_aes128_mmt_ecb.cpp ;
157-
#run test_nist_cavs_aes128_mct_ecb.cpp ;
157+
run test_nist_cavs_aes128_mct_ecb.cpp ;
158158
#run test_nist_cavs_aes128_kat_cbc.cpp ;
159159
#run test_nist_cavs_aes128_mmt_cbc.cpp ;
160160
#run test_nist_cavs_aes128_mct_cbc.cpp ;

test/test_nist_cavs_aes128_mct_ecb.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Distributed under the Boost Software License, Version 1.0.
44
// https://www.boost.org/LICENSE_1_0.txt
55

6-
#include <boost/crypt/aes/aes128.hpp>
6+
#include <boost/crypt2/aes/ecb.hpp>
77
#include "test_nist_cavs_detail.hpp"
88
#include <string>
99
#include <vector>
@@ -30,7 +30,7 @@ auto main() -> int
3030
// LCOV_EXCL_STOP
3131
}
3232

33-
result_is_ok = (nist::cavs::test_vectors_aes_mct<boost::crypt::aes::cipher_mode::ecb, boost::crypt::aes128>(test_vectors) && result_is_ok);
33+
result_is_ok = (nist::cavs::test_vectors_aes_mct<boost::crypt::aes_cipher_mode::ecb, boost::crypt::aes128<boost::crypt::aes_cipher_mode::ecb>>(test_vectors) && result_is_ok);
3434

3535
BOOST_TEST(result_is_ok);
3636
}

test/test_nist_cavs_detail.hpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2551,8 +2551,7 @@ auto test_vectors_aes_mmt(const nist::cavs::test_vector_container_aes& test_vect
25512551
}
25522552
}
25532553

2554-
/*
2555-
template <boost::crypt::aes::cipher_mode mode, typename AESType>
2554+
template <boost::crypt::aes_cipher_mode mode, typename AESType>
25562555
auto test_vectors_aes_mct(const nist::cavs::test_vector_container_aes& test_vectors) -> bool
25572556
{
25582557
BOOST_TEST(!test_vectors.empty());
@@ -2568,6 +2567,7 @@ auto test_vectors_aes_mct(const nist::cavs::test_vector_container_aes& test_vect
25682567
auto iv {test_vector.iv};
25692568
auto key {test_vector.key};
25702569

2570+
/*
25712571
BOOST_CRYPT_IF_CONSTEXPR (mode == boost::crypt::aes::cipher_mode::cfb8 || mode == boost::crypt::aes::cipher_mode::cfb128)
25722572
{
25732573
if (plaintext.empty() || ciphertext.empty() || iv.empty() || key.empty())
@@ -2581,19 +2581,20 @@ auto test_vectors_aes_mct(const nist::cavs::test_vector_container_aes& test_vect
25812581
iv.pop_back();
25822582
key.pop_back();
25832583
}
2584+
*/
25842585

25852586
AESType aes;
25862587

2587-
aes.init(key.begin(), key.size());
2588+
aes.init(key);
25882589

25892590
if (count < total_tests / 2U)
25902591
{
25912592
// Encrypt Path
2592-
BOOST_CRYPT_IF_CONSTEXPR (mode == boost::crypt::aes::cipher_mode::ecb)
2593+
if constexpr (mode == boost::crypt::aes_cipher_mode::ecb)
25932594
{
25942595
for (int i {0}; i < 1000; ++i)
25952596
{
2596-
aes.template encrypt<mode>(plaintext.begin(), plaintext.size());
2597+
aes.encrypt_no_padding(plaintext);
25972598
}
25982599
}
25992600
else
@@ -2606,13 +2607,13 @@ auto test_vectors_aes_mct(const nist::cavs::test_vector_container_aes& test_vect
26062607
{
26072608
if (i == 0)
26082609
{
2609-
aes.template encrypt<mode>(PT[0].begin(), PT[0].size(), iv.begin(), iv.size());
2610+
aes.encrypt_no_padding(PT[0], iv);
26102611
CT[0] = PT[0];
26112612
PT[1] = iv;
26122613
}
26132614
else
26142615
{
2615-
aes.template encrypt<mode>(PT[i].begin(), PT[i].size());
2616+
aes.encrypt_no_padding(PT[i]);
26162617
CT[i] = PT[i];
26172618
if (i < 999)
26182619
{
@@ -2628,11 +2629,11 @@ auto test_vectors_aes_mct(const nist::cavs::test_vector_container_aes& test_vect
26282629
else
26292630
{
26302631
// Decrypt Path
2631-
BOOST_CRYPT_IF_CONSTEXPR (mode == boost::crypt::aes::cipher_mode::ecb)
2632+
if constexpr (mode == boost::crypt::aes_cipher_mode::ecb)
26322633
{
26332634
for (int i {0}; i < 1000; ++i)
26342635
{
2635-
aes.template decrypt<mode>(ciphertext.begin(), ciphertext.size());
2636+
aes.decrypt_no_padding(ciphertext);
26362637
}
26372638
}
26382639
else
@@ -2645,13 +2646,13 @@ auto test_vectors_aes_mct(const nist::cavs::test_vector_container_aes& test_vect
26452646
{
26462647
if (i == 0)
26472648
{
2648-
aes.template decrypt<mode>(PT[0].begin(), PT[0].size(), iv.begin(), iv.size());
2649+
aes.decrypt_no_padding(PT[0], iv);
26492650
CT[0] = PT[0];
26502651
PT[1] = iv;
26512652
}
26522653
else
26532654
{
2654-
aes.template decrypt<mode>(PT[i].begin(), PT[i].size());
2655+
aes.decrypt_no_padding(PT[i]);
26552656
CT[i] = PT[i];
26562657
if (i < 999)
26572658
{
@@ -2678,7 +2679,6 @@ auto test_vectors_aes_mct(const nist::cavs::test_vector_container_aes& test_vect
26782679

26792680
return result_is_ok;
26802681
}
2681-
*/
26822682

26832683
#ifdef _MSC_VER
26842684
# pragma warning( pop )

0 commit comments

Comments
 (0)