Blame view

RIOT/sys/crypto/doc.txt 1.67 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
  /*
   * Copyright (C) 2013 Freie Universität Berlin
   *
   * 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.
   */
  
  /**
   * @defgroup    sys_crypto Crypto
   * @ingroup     sys
   *
   * @brief       RIOT provides a collection of block cipher ciphers, different
     operation modes and cryptographic hash algorithms.
   *
   * @section ciphers Ciphers
   *
   * Riot supports the following block ciphers:
   *  * AES-128
   *  * NULL
   *
   * You can use them directly by adding "crypto" to your USEMODULE-List.
   * While you can use the ciphers functions directly, you should resort to
   * the generic API for block ciphers whenever possible.
   *
   * Additionally you need to set a CFLAG for each cipher you want to use in your Makefile:
   *  * AES-128: CFLAGS += -DCRYPTO_AES
   * Setting the CFLAGS initializes a sufficient large buffer size of the cipher_context_t,
   * used by the ciphers for en-/de-cryption operations.
   *
   * Example:
   * @code
   *  #include "crypto/ciphers.h"
   *
   *  cipher_t cipher;
   *  uint8_t key[AES_KEY_SIZE] = {0},
   *          plain_text[AES_BLOCK_SIZE] = {0},
   *          cipher_text[AES_BLOCK_SIZE] = {0};
   *
   *  if (cipher_init(&cipher, CIPHER_AES_128, key, AES_KEY_SIZE) < 0)
   *      printf("Cipher init failed!\n");
   *
   *  if (cipher_encrypt(&cipher, plain_text, cipher_text) < 0)
   *      printf("Cipher encryption failed!\n");
   *  else
   *      od_hex_dump(cipher_text, AES_BLOCK_SIZE, 0);
   *
   * @endcode
   *
   * If you need to encrypt data of arbitrary size take a look at the different
   * operation modes like: CBC, CTR or CCM.
   *
   * Additional examples can be found in the test suite.
   *
   */