Blame view

RIOT/tests/unittests/tests-crypto/tests-crypto.h 1.29 KB
a752c7ab   elopes   add first test an...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
  /*
   * Copyright (C) 2014 Philipp Rosenkranz
   * Copyright (C) 2014 Nico von Geyso
   *
   * 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
   * @{
   *
   * @file
   * @brief       Unittests for the ``crypto`` module
   *
   * @author      Philipp Rosenkranz <philipp.rosenkranz@fu-berlin.de>
   */
  #ifndef TESTS_CRYPTO_H
  #define TESTS_CRYPTO_H
  
  #include <stddef.h>
  #include <stdint.h>
  
  #include "embUnit.h"
  
  #ifdef __cplusplus
  extern "C" {
  #endif
  
  /**
   * @brief   The entry point of this test suite.
   */
  void tests_crypto(void);
  
  /**
   * @brief   Generates tests for crypto/chacha.h
   *
   * @return  embUnit tests if successful, NULL if not.
   */
  Test *tests_crypto_chacha_tests(void);
  
  static inline int compare(uint8_t *a, uint8_t *b, 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_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);
  
  #ifdef __cplusplus
  }
  #endif
  
  #endif /* TESTS_CRYPTO_H */
  /** @} */