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>
|
|
|
|
*/
|
2017-01-18 13:00:05 +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
|
|
|
|
|
2018-10-23 14:06:15 +02:00
|
|
|
/**
|
|
|
|
* @brief Generates tests for helper functions
|
|
|
|
*
|
|
|
|
* @return embUnit tests
|
|
|
|
*/
|
|
|
|
Test *tests_crypto_helper_tests(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);
|
|
|
|
|
2018-05-29 20:28:12 +02:00
|
|
|
Test *tests_crypto_poly1305_tests(void);
|
|
|
|
|
2018-10-21 21:34:29 +02:00
|
|
|
Test *tests_crypto_chacha20poly1305_tests(void);
|
|
|
|
|
2018-11-12 18:33:02 +01:00
|
|
|
static inline int compare(const uint8_t *a, const uint8_t *b, uint8_t len)
|
2015-04-02 08:56:18 +02:00
|
|
|
{
|
|
|
|
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_cipher_tests(void);
|
|
|
|
Test* tests_crypto_modes_ccm_tests(void);
|
2019-04-23 10:36:31 +02:00
|
|
|
Test* tests_crypto_modes_ocb_tests(void);
|
2015-04-02 08:56:18 +02:00
|
|
|
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
|
|
|
|
|
2017-01-18 13:00:05 +01:00
|
|
|
#endif /* TESTS_CRYPTO_H */
|
2014-12-11 00:41:15 +01:00
|
|
|
/** @} */
|