Contiki-NG
Toggle main menu visibility
Loading...
Searching...
No Matches
crypto.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2013, ADVANSEE - http://www.advansee.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
33
* @{
34
*
35
* \defgroup cc2538-crypto cc2538 AES/SHA cryptoprocessor
36
*
37
* Driver for the cc2538 AES/SHA cryptoprocessor
38
* @{
39
*
40
* \file
41
* Header file for the cc2538 AES/SHA cryptoprocessor driver
42
*/
43
#ifndef CRYPTO_H_
44
#define CRYPTO_H_
45
46
#include "contiki.h"
47
#include "
dev/sys-ctrl.h
"
48
#include "
reg.h
"
49
/*---------------------------------------------------------------------------*/
50
/** \name Crypto drivers return codes
51
* @{
52
*/
53
#define CRYPTO_PENDING (-1)
54
#define CRYPTO_SUCCESS 0
55
#define CRYPTO_INVALID_PARAM 1
56
#define CRYPTO_NULL_ERROR 2
57
#define CRYPTO_RESOURCE_IN_USE 3
58
#define CRYPTO_DMA_BUS_ERROR 4
59
/** @} */
60
/*---------------------------------------------------------------------------*/
61
/** \name Crypto macros
62
* @{
63
*/
64
65
/** \brief Indicates whether the AES/SHA cryptoprocessor is enabled
66
* \return Boolean value indicating whether the AES/SHA cryptoprocessor is
67
* enabled
68
*/
69
#define CRYPTO_IS_ENABLED() (!!(REG(SYS_CTRL_RCGCSEC) & SYS_CTRL_RCGCSEC_AES))
70
71
/** @} */
72
/*---------------------------------------------------------------------------*/
73
/** \name Crypto functions
74
* @{
75
*/
76
77
/** \brief Enables and resets the AES/SHA cryptoprocessor
78
*/
79
void
crypto_init
(
void
);
80
81
/** \brief Enables the AES/SHA cryptoprocessor
82
*/
83
void
crypto_enable
(
void
);
84
85
/** \brief Disables the AES/SHA cryptoprocessor
86
* \note Call this function to save power when the cryptoprocessor is unused.
87
*/
88
void
crypto_disable
(
void
);
89
90
/** \brief Registers a process to be notified of the completion of a crypto
91
* operation
92
* \param p Process to be polled upon IRQ
93
* \note This function is only supposed to be called by the crypto drivers.
94
*/
95
void
crypto_register_process_notification
(
struct
process *p);
96
97
/** @} */
98
99
#endif
/* CRYPTO_H_ */
100
101
/**
102
* @}
103
* @}
104
*/
crypto_init
void crypto_init(void)
Enables and resets the AES/SHA cryptoprocessor.
Definition
crypto.c:77
crypto_enable
void crypto_enable(void)
Enables the AES/SHA cryptoprocessor.
Definition
crypto.c:92
crypto_register_process_notification
void crypto_register_process_notification(struct process *p)
Registers a process to be notified of the completion of a crypto operation.
Definition
crypto.c:110
crypto_disable
void crypto_disable(void)
Disables the AES/SHA cryptoprocessor.
Definition
crypto.c:101
reg.h
Header file with register manipulation macro definitions.
sys-ctrl.h
Header file for the cc2538 System Control driver.
arch
cpu
cc2538
dev
crypto.h
Generated on
for Contiki-NG by
1.17.0