Contiki-NG
ecb.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-ecb cc2538 AES-ECB
36  *
37  * Driver for the cc2538 AES-ECB mode of the security core
38  * @{
39  *
40  * \file
41  * Header file for the cc2538 AES-ECB driver
42  */
43 #ifndef ECB_H_
44 #define ECB_H_
45 
46 #include "contiki.h"
47 #include "dev/aes.h"
48 
49 #include <stdbool.h>
50 #include <stdint.h>
51 /*---------------------------------------------------------------------------*/
52 /** \name AES-ECB functions
53  * @{
54  */
55 
56 /** \brief Starts an ECB 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 mdata_in Pointer to input message in SRAM
61  * \param mdata_out Pointer to output message in SRAM (may be \p mdata_in)
62  * \param mdata_len Length of message in octets
63  * \param process Process to be polled upon completion of the operation, or
64  * \c NULL
65  * \return \c CRYPTO_SUCCESS if successful, or CRYPTO/AES/ECB error code
66  */
67 uint8_t ecb_crypt_start(uint8_t encrypt, uint8_t key_area, const void *mdata_in,
68  void *mdata_out, uint16_t mdata_len,
69  struct process *process);
70 
71 /** \brief Checks the status of the ECB crypto operation
72  * \return \c CRYPTO_PENDING if operation still pending, \c CRYPTO_SUCCESS if
73  * successful, or CRYPTO/AES/ECB error code
74  * \note This function must be called only after \c ecb_crypt_start().
75  */
76 int8_t ecb_crypt_check_status(void);
77 
78 /** @} */
79 
80 #endif /* ECB_H_ */
81 
82 /**
83  * @}
84  * @}
85  */
uint8_t ecb_crypt_start(uint8_t encrypt, uint8_t key_area, const void *mdata_in, void *mdata_out, uint16_t mdata_len, struct process *process)
Starts an ECB crypto operation.
Definition: ecb.c:45
Header file for the cc2538 AES driver.
int8_t ecb_crypt_check_status(void)
Checks the status of the ECB crypto operation.
Definition: ecb.c:58