2014-12-11 00:41:15 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014 Philipp Rosenkranz
|
2015-04-02 08:56:18 +02:00
|
|
|
* Copyright (C) 2014 Nico von Geyso
|
2014-12-11 00:41:15 +01:00
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @addtogroup unittests
|
|
|
|
* @{
|
|
|
|
*
|
2015-05-22 07:34:41 +02:00
|
|
|
* @file
|
2014-12-11 00:41:15 +01:00
|
|
|
* @brief Unittests for the ``crypto`` module
|
|
|
|
*
|
|
|
|
* @author Philipp Rosenkranz <philipp.rosenkranz@fu-berlin.de>
|
|
|
|
*/
|
2015-03-22 15:29:20 +01:00
|
|
|
#ifndef TESTS_CRYPTO_H_
|
|
|
|
#define TESTS_CRYPTO_H_
|
2014-12-11 00:41:15 +01:00
|
|
|
|
2016-02-27 01:12:02 +01:00
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2014-11-27 22:30:14 +01:00
|
|
|
#include "embUnit.h"
|
2014-12-11 00:41:15 +01:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief The entry point of this test suite.
|
|
|
|
*/
|
|
|
|
void tests_crypto(void);
|
|
|
|
|
2015-06-21 09:50:14 +02:00
|
|
|
/**
|
|
|
|
* @brief Generates tests for crypto/chacha.h
|
|
|
|
*
|
|
|
|
* @return embUnit tests if successful, NULL if not.
|
|
|
|
*/
|
|
|
|
Test *tests_crypto_chacha_tests(void);
|
|
|
|
|
2015-04-02 08:56:18 +02:00
|
|
|
static inline int compare(uint8_t a[16], uint8_t b[16], uint8_t len)
|
|
|
|
{
|
|
|
|
int result = 1;
|
|
|
|
|
|
|
|
for (uint8_t i = 0; i < len; ++i) {
|
|
|
|
result &= a[i] == b[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
Test* tests_crypto_aes_tests(void);
|
|
|
|
Test* tests_crypto_3des_tests(void);
|
|
|
|
Test* tests_crypto_cipher_tests(void);
|
|
|
|
Test* tests_crypto_modes_ccm_tests(void);
|
|
|
|
Test* tests_crypto_modes_ecb_tests(void);
|
|
|
|
Test* tests_crypto_modes_cbc_tests(void);
|
|
|
|
Test* tests_crypto_modes_ctr_tests(void);
|
|
|
|
|
2014-12-11 00:41:15 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-03-22 15:29:20 +01:00
|
|
|
#endif /* TESTS_CRYPTO_H_ */
|
2014-12-11 00:41:15 +01:00
|
|
|
/** @} */
|