Skip to content

Commit

Permalink
Finish sha1 nist cavs testing
Browse files Browse the repository at this point in the history
  • Loading branch information
ckormanyos committed Oct 21, 2024
1 parent 3ab6262 commit 82cfb12
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 24 deletions.
2 changes: 1 addition & 1 deletion test/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ project : requirements

run quick.cpp ;
run test_md5.cpp ;
run test_nist_cavs_sha1_short.cpp ;
run test_nist_cavs_sha1_short_long.cpp ;
run test_sha1.cpp ;
4 changes: 2 additions & 2 deletions test/test_cavs_nist_detail.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ struct test_object_hash

using test_vector_container_type = std::deque<test_object_hash>;

auto where_file(const std::string& test_vectors_filename) -> std::string
auto where_file_shabytesvectors(const std::string& test_vectors_filename) -> std::string
{
// Try to open the file in each of the known relative paths
// in order to find out where it is located.
Expand Down Expand Up @@ -159,7 +159,7 @@ auto parse_file_vectors(const std::string& test_vectors_filename, test_vector_co
{
bool result_parse_is_ok { false };

const std::string test_vectors_filename_relative { where_file(test_vectors_filename) };
const std::string test_vectors_filename_relative { where_file_shabytesvectors(test_vectors_filename) };

const bool result_filename_plausible_is_ok { (!test_vectors_filename_relative.empty()) };

Expand Down
21 changes: 0 additions & 21 deletions test/test_nist_cavs_sha1_short.cpp

This file was deleted.

36 changes: 36 additions & 0 deletions test/test_nist_cavs_sha1_short_long.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright 2024 Matt Borland
// Copyright 2024 Christopher Kormanyos
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt

#include "test_nist_cavs_detail.hpp"

#include <boost/crypt/hash/sha1.hpp>

auto main() -> int
{
bool result_is_ok { true };

{
nist::cavs::test_vector_container_type test_vectors_short { };

static_cast<void>(nist::cavs::detail::parse_file_vectors("SHA1ShortMsg.rsp", test_vectors_short));

result_is_ok = (nist::cavs::test_vectors_oneshot<boost::crypt::sha1_hasher>(test_vectors_short) && result_is_ok);

BOOST_TEST(result_is_ok);
}


{
nist::cavs::test_vector_container_type test_vectors_long { };

static_cast<void>(nist::cavs::detail::parse_file_vectors("SHA1LongMsg.rsp", test_vectors_long));

result_is_ok = (nist::cavs::test_vectors_oneshot<boost::crypt::sha1_hasher>(test_vectors_long) && result_is_ok);

BOOST_TEST(result_is_ok);
}

return boost::report_errors();
}

0 comments on commit 82cfb12

Please sign in to comment.