mbed TLS v2.2.0
Main Page
Modules
Files
Documentation Home
silabs.com
File List
util
third_party
mbedtls
sl_crypto
include
cryptodrv.h
Go to the documentation of this file.
1
/*
2
* \file cryptodrv.h
3
*
4
* \brief CRYPTO driver definitions including CRYPTO preemption and
5
* yield when crypto busy management.
6
*
7
* Copyright (C) 2016 Silicon Labs, http://www.silabs.com
8
* SPDX-License-Identifier: Apache-2.0
9
*
10
* Licensed under the Apache License, Version 2.0 (the "License"); you may
11
* not use this file except in compliance with the License.
12
* You may obtain a copy of the License at
13
*
14
* http://www.apache.org/licenses/LICENSE-2.0
15
*
16
* Unless required by applicable law or agreed to in writing, software
17
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
* See the License for the specific language governing permissions and
20
* limitations under the License.
21
*/
22
#ifndef MBEDTLS_CRYPTODRV_H
23
#define MBEDTLS_CRYPTODRV_H
24
25
#if !defined(MBEDTLS_CONFIG_FILE)
26
#include "
config.h
"
27
#else
28
#include MBEDTLS_CONFIG_FILE
29
#endif
30
31
#include "em_device.h"
32
33
#if ( defined(CRYPTO_COUNT) && (CRYPTO_COUNT > 0) )
34
35
#include "
slcl_device.h
"
36
#include "
mbedtls_ecode.h
"
37
#include "em_crypto.h"
38
#include "em_core.h"
39
#if defined( MBEDTLS_DEVICE_YIELD_WHEN_BUSY )
40
#include "
slpal.h
"
41
#endif
42
#if defined( MBEDTLS_INCLUDE_IO_MODE_DMA )
43
#include "dmadrv.h"
44
#endif
45
#include <stdint.h>
46
#include <stdbool.h>
47
48
#ifdef __cplusplus
49
extern
"C"
{
50
#endif
51
52
/*******************************************************************************
53
******************************* ERROR CODES **********************************
54
******************************************************************************/
55
56
#define MBEDTLS_ECODE_CRYPTODRV_OPERATION_ABORTED ((int)MBEDTLS_ECODE_CRYPTODRV_BASE | 0x1)
57
#define MBEDTLS_ECODE_CRYPTODRV_BUSY ((int)MBEDTLS_ECODE_CRYPTODRV_BASE | 0x2)
59
/*******************************************************************************
60
******************************* TYPEDEFS **********************************
61
******************************************************************************/
62
63
#if defined(MBEDTLS_CRYPTO_DEVICE_PREEMPTION)
64
66
typedef
struct
67
{
68
uint32_t CTRL;
69
uint32_t WAC;
70
uint32_t SEQCTRL;
71
uint32_t SEQCTRLB;
72
uint32_t IEN;
73
uint32_t SEQ[5];
74
CRYPTO_Data260_TypeDef DDATA[5];
79
} CRYPTO_Context_t;
80
81
#endif
/* #if defined(MBEDTLS_CRYPTO_DEVICE_PREEMPTION) */
82
84
typedef
struct
85
{
86
CRYPTO_TypeDef *
crypto
;
87
IRQn_Type
irqn
;
88
uint32_t
clk
;
89
mbedtls_device_context
**
ppMbedtlsDevice
;
91
#if defined(MBEDTLS_INCLUDE_IO_MODE_DMA)
92
DMADRV_PeripheralSignal_t dmaReqSigChIn;
93
DMADRV_PeripheralSignal_t dmaReqSigChOut;
94
#endif
95
}
CRYPTO_Device_t
;
96
98
typedef
struct
99
{
100
const
CRYPTO_Device_t
*
device
;
102
#if defined( MBEDTLS_CRYPTO_DEVICE_PREEMPTION )
103
104
CRYPTO_Context_t cryptoContext;
105
bool
aborted;
108
int
lockWaitTicks;
109
unsigned
long
priority;
111
/* Double linked-list for CRYPTO context preemption. */
112
void
* pContextPreempted;
114
void
* pContextPreemptor;
116
#if defined( MBEDTLS_ALLOW_ISR_CALLS_IRQ_MASK )
117
CORE_nvicMask_t nvicState;
120
#endif
121
#if defined( MBEDTLS_DEVICE_YIELD_WHEN_NOT_OWNER )
122
bool
waitOwnership;
125
SLPAL_Completion_t
ownership;
128
#endif
129
#endif
/* #if defined(MBEDTLS_CRYPTO_DEVICE_PREEMPTION) */
130
131
}
CRYPTODRV_Context_t
;
132
133
#ifdef __cplusplus
134
}
135
#endif
136
137
#endif
/* #if ( defined(CRYPTO_COUNT) && (CRYPTO_COUNT > 0) ) || \
138
( defined(AES_COUNT) && (AES_COUNT > 0) ) */
139
140
#endif
/* #ifndef MBEDTLS_CRYPTODRV_H */
CRYPTO_Device_t::irqn
IRQn_Type irqn
CRYPTO irq number.
Definition:
cryptodrv.h:87
CRYPTO_Device_t::clk
uint32_t clk
CRYPTO clock.
Definition:
cryptodrv.h:88
mbedtls_device_context
Device context structure.
Definition:
slcl_device.h:67
slcl_device.h
CRYPTO_Device_t::crypto
CRYPTO_TypeDef * crypto
CRYPTO hw instance.
Definition:
cryptodrv.h:86
config.h
Compatibility names (set of defines)
CRYPTO_Device_t
CRYPTO device structure.
Definition:
cryptodrv.h:84
mbedtls_ecode.h
Silicon Labs specific mbedtls error code definitions.
SLPAL_Completion_t
volatile bool SLPAL_Completion_t
Definition:
slpal_baremetal.h:67
CRYPTODRV_Context_t::device
const CRYPTO_Device_t * device
CRYPTO hw instance.
Definition:
cryptodrv.h:100
CRYPTODRV_Context_t
CRYPTODRV operation context.
Definition:
cryptodrv.h:98
slpal.h
CRYPTO_Device_t::ppMbedtlsDevice
mbedtls_device_context ** ppMbedtlsDevice
Pointer to pointer of mbedtls device context.
Definition:
cryptodrv.h:89
Generated on Thu Mar 9 2017 20:48:04 for mbed TLS v2.2.0 by
1.8.10