summaryrefslogtreecommitdiff
path: root/digital/beacon/src/Bitcloud_stack/Components/Security/ServiceProvider/include/private/sspMem.h
blob: 1512a17089feeb8bbc859f530b7a6f70fe4c932e (plain)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
/**************************************************************************//**
  \file sspMem.h
  
  \brief Security Service Provider memory manager header file.

  \author
    Atmel Corporation: http://www.atmel.com \n
    Support email: avr@atmel.com

  Copyright (c) 2008-2011, Atmel Corporation. All rights reserved.
  Licensed under Atmel's Limited License Agreement (BitCloudTM).

  \internal
    History:
      06/12/2007 - ALuzhetsky created.
******************************************************************************/
#ifndef _SSPMEM_H
#define _SSPMEM_H

/******************************************************************************
                        Includes section.
******************************************************************************/
#include <queue.h>
#include <sspManager.h>
#include <sspAuthenticHandler.h>
#include <sspSkkeHandler.h>
#include <sspSfpHandler.h>
#include <sspCcmHandler.h>

/******************************************************************************
                        Types section.
******************************************************************************/
typedef struct
{
  void            *sspReq; // Used by all modules which need to save requests' parameters.
  // For Manager needs.
  SspManagerMem_t managerMem;
  SspAesMem_t     aes;
  union
  {
#ifdef _LINK_SECURITY_ 
    SspAuthenticHandlerMem_t authenticHandlerMem;
    SspSkkeHandlerMem_t      skkeHandlerMem;
#endif // _LINK_SECURITY_ 
    SspSfpHandlerMem_t       sfpHandlerMem;
  };
  union
  {
#ifdef _LINK_SECURITY_ 
    SspHashHandlerMem_t hashHandlerMem;
#endif // _LINK_SECURITY_ 
    SspCcmHandlerMem_t  ccmHandlerMem;
  };
} SspMem_t;

/******************************************************************************
                        External variables.
******************************************************************************/
extern SspMem_t sspMem;

/******************************************************************************
                        Inline static functions prototypes section.
******************************************************************************/
/******************************************************************************
  Stores the pointer to the current request.
  Parameters:
    req - pointer to the current request.
  returns:
    none.
******************************************************************************/
INLINE void sspStoreReqParams(void *req)
{
  sspMem.sspReq = req;
}

/******************************************************************************
  Gets the pointer to the current request.
  Parameters:
    none.
  returns:
    Pointer to the current request.
******************************************************************************/
INLINE void* sspGetReqParams(void)
{
  return sspMem.sspReq;
}

/******************************************************************************
  Gets the current manager state.
  Parameters:
    none.
  returns:
    current manager state.
******************************************************************************/
/*INLINE SspState_t sspGetManagerState(void)
{
  return sspMem.managerMem.managerState;
}*/

/******************************************************************************
  Sets the current manager state.
  Parameters:
    new state.
  returns:
    none.
******************************************************************************/
/*INLINE void sspSetManagerState(SspState_t newState)
{
  sspMem.managerMem.managerState = newState;
}*/

/******************************************************************************
  Gets pointer to the queue descriptor.
  Parameters:
    none.
  returns:
    pointer to the queue descriptor.
******************************************************************************/
INLINE QueueDescriptor_t* sspGetQueueDescr(void)
{
  return &sspMem.managerMem.reqQueueDescr;
}

/******************************************************************************
  Gets pointer to the queue descriptor.
  Parameters:
    none.
  returns:
    pointer to the queue descriptor.
******************************************************************************/
INLINE SspTaskBitMask_t* sspGetTaskBitMask(void)
{
  return &sspMem.managerMem.taskBitMask;
}

/******************************************************************************
  Gets pointer to the current request.
  Parameters:
    none.
  returns:
    pointer to the current request.
******************************************************************************/
INLINE void* sspGetCurrentReq(void)
{
  return sspMem.sspReq;
}

/******************************************************************************
  Stores pointer to the current request.
  Parameters:
    pointer to the current request.
  returns:
    none.
******************************************************************************/
INLINE void sspSetCurrentReq(void* param)
{
  sspMem.sspReq = param;
}

#ifdef _LINK_SECURITY_ 
/******************************************************************************
  Gets pointer to the authentic handler memory.
  Parameters:
    none.
  returns:
    pointer to the authentic handler memory.
******************************************************************************/
INLINE SspAuthenticHandlerMem_t* sspGetAuthenticHandlerMem(void)
{
  return &sspMem.authenticHandlerMem;
}

/******************************************************************************
  Gets pointer to the skke handler memory.
  Parameters:
    none.
  returns:
    pointer to the skke handler memory.
******************************************************************************/
INLINE SspSkkeHandlerMem_t* sspGetSkkeHandlerMem(void)
{
  return &sspMem.skkeHandlerMem;
}

/******************************************************************************
  Gets pointer to the hash handler memory.
  Parameters:
    none.
  returns:
    pointer to the hash handler memory.
******************************************************************************/
INLINE SspHashHandlerMem_t* sspGetHashHandlerMem(void)
{
  return &sspMem.hashHandlerMem;
}
#endif // _LINK_SECURITY_ 

/******************************************************************************
  Gets pointer to the sfp handler memory.
  Parameters:
    none.
  returns:
    pointer to the sfp handler memory.
******************************************************************************/
INLINE SspSfpHandlerMem_t* sspGetSfpHandlerMem(void)
{
  return &sspMem.sfpHandlerMem;
}

/******************************************************************************
  Gets pointer to the memory for aes encryption procedure.
  Parameters:
    none.
  returns:
    pointer to the memory for aes encryption procedure.
******************************************************************************/
INLINE SspAesMem_t* sspGetAesMem(void)
{
  return &sspMem.aes;
}

/******************************************************************************
  Gets pointer to the ccm handler memory.
  Parameters:
    none.
  returns:
    pointer to the ccm handler memory.
******************************************************************************/
INLINE SspCcmHandlerMem_t* sspGetCcmHandlerMem(void)
{
  return &sspMem.ccmHandlerMem;
}


//#endif // _SSP_USE_STATIC_MEM_

#endif //_SSPMEM_H
// eof sspMem.h