Contiki-NG
Toggle main menu visibility
Loading...
Searching...
No Matches
ctr.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2015, Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
3
* All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
7
* are met:
8
* 1. Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
* 2. Redistributions in binary form must reproduce the above copyright
11
* notice, this list of conditions and the following disclaimer in the
12
* documentation and/or other materials provided with the distribution.
13
*
14
* 3. Neither the name of the copyright holder nor the names of its
15
* contributors may be used to endorse or promote products derived
16
* from this software without specific prior written permission.
17
*
18
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29
* OF THE POSSIBILITY OF SUCH DAMAGE.
30
*/
31
/**
32
* \addtogroup cc2538-aes
33
* @{
34
*
35
* \defgroup cc2538-ctr cc2538 AES-CTR
36
*
37
* Driver for the cc2538 AES-CTR mode of the security core
38
* @{
39
*
40
* \file
41
* Header file for the cc2538 AES-CTR driver
42
*/
43
#ifndef CTR_H_
44
#define CTR_H_
45
46
#include "contiki.h"
47
#include "
dev/aes.h
"
48
49
#include <stdbool.h>
50
#include <stdint.h>
51
/*---------------------------------------------------------------------------*/
52
/** \name AES-CTR functions
53
* @{
54
*/
55
56
/** \brief Starts a CTR crypto operation
57
* \param encrypt \c true to encrypt, or \c false to decrypt
58
* \param key_area Area in Key RAM where the key is stored (0 to
59
* \c AES_KEY_AREAS - 1)
60
* \param nonce Pointer to nonce (\c AES_IV_LEN - \p ctr_len octets), or \c NULL
61
* \param ictr Pointer to initial counter
62
* \param ctr_len Length of counter in octets (4, 8, 12, or 16)
63
* \param mdata_in Pointer to input message in SRAM
64
* \param mdata_out Pointer to output message in SRAM (may be \p mdata_in)
65
* \param mdata_len Length of message in octets
66
* \param process Process to be polled upon completion of the operation, or
67
* \c NULL
68
* \return \c CRYPTO_SUCCESS if successful, or CRYPTO/AES/CTR error code
69
*/
70
uint8_t
ctr_crypt_start
(uint8_t encrypt, uint8_t key_area,
const
void
*nonce,
71
const
void
*ictr, uint8_t ctr_len,
const
void
*mdata_in,
72
void
*mdata_out, uint16_t mdata_len,
73
struct
process *process);
74
75
/** \brief Checks the status of the CTR crypto operation
76
* \return \c CRYPTO_PENDING if operation still pending, \c CRYPTO_SUCCESS if
77
* successful, or CRYPTO/AES/CTR error code
78
* \note This function must be called only after \c ctr_crypt_start().
79
*/
80
int8_t
ctr_crypt_check_status
(
void
);
81
82
/** @} */
83
84
#endif
/* CTR_H_ */
85
86
/**
87
* @}
88
* @}
89
*/
aes.h
Header file for the cc2538 AES driver.
ctr_crypt_start
uint8_t ctr_crypt_start(uint8_t encrypt, uint8_t key_area, const void *nonce, const void *ictr, uint8_t ctr_len, const void *mdata_in, void *mdata_out, uint16_t mdata_len, struct process *process)
Starts a CTR crypto operation.
Definition
ctr.c:46
ctr_crypt_check_status
int8_t ctr_crypt_check_status(void)
Checks the status of the CTR crypto operation.
Definition
ctr.c:71
arch
cpu
cc2538
dev
ctr.h
Generated on
for Contiki-NG by
1.17.0