Browse Source

sha256: move from crypto to hashes

pr/gpio
Oleg Hahm 7 years ago
parent
commit
51db509f7c
  1. 3
      sys/crypto/doc.txt
  2. 4
      sys/hashes/sha256.c
  3. 2
      sys/include/hashes/sha256.h
  4. 1
      tests/unittests/tests-crypto/tests-crypto.c
  5. 7
      tests/unittests/tests-crypto/tests-crypto.h
  6. 14
      tests/unittests/tests-hashes/tests-hashes-sha256.c
  7. 1
      tests/unittests/tests-hashes/tests-hashes.c
  8. 8
      tests/unittests/tests-hashes/tests-hashes.h

3
sys/crypto/doc.txt

@ -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.
*/

4
sys/crypto/sha256.c → sys/hashes/sha256.c

@ -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__

2
sys/include/crypto/sha256.h → sys/include/hashes/sha256.h

@ -29,7 +29,7 @@
/**
* @ingroup sys_crypto
* @ingroup sys_hashes
* @{
*
* @file

1
tests/unittests/tests-crypto/tests-crypto.c

@ -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());

7
tests/unittests/tests-crypto/tests-crypto.h

@ -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
tests/unittests/tests-crypto/tests-crypto-sha256.c → tests/unittests/tests-hashes/tests-hashes-sha256.c

@ -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;
}

1
tests/unittests/tests-hashes/tests-hashes.c

@ -23,4 +23,5 @@
void tests_hashes(void)
{
TESTS_RUN(tests_hashes_md5_tests());
TESTS_RUN(tests_hashes_sha256_tests());
}

8
tests/unittests/tests-hashes/tests-hashes.h

@ -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…
Cancel
Save