sha256: move from crypto to hashes
This commit is contained in:
parent
f4006a67f1
commit
51db509f7c
|
@ -44,7 +44,4 @@
|
|||
*
|
||||
* Additional examples can be found in the test suite.
|
||||
*
|
||||
* @section hashes Hashes
|
||||
*
|
||||
* RIOT currently supports sha256 as a cryptographic hash implementation.
|
||||
*/
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @ingroup sys_crypto
|
||||
* @ingroup sys_hashes
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
|
@ -43,7 +43,7 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#include "crypto/sha256.h"
|
||||
#include "hashes/sha256.h"
|
||||
#include "board.h"
|
||||
|
||||
#ifdef __BIG_ENDIAN__
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
|
||||
/**
|
||||
* @ingroup sys_crypto
|
||||
* @ingroup sys_hashes
|
||||
* @{
|
||||
*
|
||||
* @file
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
void tests_crypto(void)
|
||||
{
|
||||
TESTS_RUN(tests_crypto_sha256_tests());
|
||||
TESTS_RUN(tests_crypto_chacha_tests());
|
||||
TESTS_RUN(tests_crypto_aes_tests());
|
||||
TESTS_RUN(tests_crypto_3des_tests());
|
||||
|
|
|
@ -31,13 +31,6 @@ extern "C" {
|
|||
*/
|
||||
void tests_crypto(void);
|
||||
|
||||
/**
|
||||
* @brief Generates tests for crypto/sha256.h
|
||||
*
|
||||
* @return embUnit tests if successful, NULL if not.
|
||||
*/
|
||||
Test *tests_crypto_sha256_tests(void);
|
||||
|
||||
/**
|
||||
* @brief Generates tests for crypto/chacha.h
|
||||
*
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
|
||||
#include "embUnit/embUnit.h"
|
||||
|
||||
#include "crypto/sha256.h"
|
||||
#include "hashes/sha256.h"
|
||||
|
||||
#include "tests-crypto.h"
|
||||
#include "tests-hashes.h"
|
||||
|
||||
static int compare_str_vs_digest(const char *str,
|
||||
const unsigned char hash[SHA256_DIGEST_LENGTH])
|
||||
|
@ -47,7 +47,7 @@ static int calc_and_compare_hash(const char *str, const char *expected)
|
|||
return compare_str_vs_digest(expected, hash);
|
||||
}
|
||||
|
||||
static void test_crypto_sha256_hash_sequence(void)
|
||||
static void test_hashes_sha256_hash_sequence(void)
|
||||
{
|
||||
TEST_ASSERT(calc_and_compare_hash("1234567890_1",
|
||||
"3eda9ffe5537a588f54d0b2a453e5fa932986d0bc0f9556924f5c2379b2c91b0"));
|
||||
|
@ -81,14 +81,14 @@ static void test_crypto_sha256_hash_sequence(void)
|
|||
"c19d3bf8588897076873f1a0a106ba840ca46bd1179d592953acecc4df59593c"));
|
||||
}
|
||||
|
||||
Test *tests_crypto_sha256_tests(void)
|
||||
Test *tests_hashes_sha256_tests(void)
|
||||
{
|
||||
EMB_UNIT_TESTFIXTURES(fixtures) {
|
||||
new_TestFixture(test_crypto_sha256_hash_sequence),
|
||||
new_TestFixture(test_hashes_sha256_hash_sequence),
|
||||
};
|
||||
|
||||
EMB_UNIT_TESTCALLER(crypto_sha256_tests, NULL, NULL,
|
||||
EMB_UNIT_TESTCALLER(hashes_sha256_tests, NULL, NULL,
|
||||
fixtures);
|
||||
|
||||
return (Test *)&crypto_sha256_tests;
|
||||
return (Test *)&hashes_sha256_tests;
|
||||
}
|
|
@ -23,4 +23,5 @@
|
|||
void tests_hashes(void)
|
||||
{
|
||||
TESTS_RUN(tests_hashes_md5_tests());
|
||||
TESTS_RUN(tests_hashes_sha256_tests());
|
||||
}
|
||||
|
|
|
@ -37,6 +37,14 @@ void tests_hashes(void);
|
|||
*/
|
||||
Test *tests_hashes_md5_tests(void);
|
||||
|
||||
/**
|
||||
* @brief Generates tests for hashes/sha256.h
|
||||
*
|
||||
* @return embUnit tests if successful, NULL if not.
|
||||
*/
|
||||
Test *tests_hashes_sha256_tests(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue