1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 #include "prc_types.h"
20 /* lenghth of the pointer variable */
21 #define BC_ICPU_MSG_LEN sizeof(BcIcpuMsg)
22 #define BC_LOCAL_REG 0
23 #define BC_SHARED_REG 1
24 #define BC_ICPU_MSG_NOR 0
25 #define BC_ICPU_MSG_FREE 1
27 #define BC_MAX_PDU_CIPHER_REQ 1
28 #define BC_MAX_PDU_INTPROT_REQ 1
32 #define PJ_SEC_ALLOC(_cb, _buf, _size) \
34 if (SGetSBuf(1,0, (Data **)&_buf,\
35 (Size) _size) == ROK) \
37 cmMemset((U8 *)(_buf), 0, _size); \
44 typedef struct intProtCallBkParams
46 PRC_SNOW_INTEGRITY_PARAMS *intgrtyParams;
48 PRC_SNOW_INTEGRITY_DATA *pdu_list;
51 Buffer *pduInfoBuffer;
52 Buffer *pduListBuffer;
54 typedef struct intVerCallBkParams
56 PRC_SNOW_INTEGRITY_PARAMS *intgrtyParams;
58 PRC_SNOW_INTEGRITY_DATA *pdu_list;
61 Buffer *pduInfoBuffer;
62 Buffer *pduListBuffer;
66 #ifdef CIPH_BATCH_PROC
67 typedef struct pjTxEntDtl {
72 typedef struct pjRxEntDtl {
77 typedef struct cipherCallBkParams
79 #ifdef CIPH_BATCH_PROC
80 Data *cipheredBuf[32];
81 PjTxEnt *txEntLst[32];
82 PjRxEnt *rxEntLst[32];
83 PRC_SNOW_CIPHER_DATA *pduList;
85 PRC_SNOW_CIPHER_DATA *pdu_list;
88 Buffer *pduInfoBuffer;
89 Buffer *pduListBuffer;
94 PRC_SNOW_CIPHER_PARAMS *cipherParams;
98 typedef struct zucIntProtCallBkParams
100 PRC_ZUC_INTEGRITY_PARAMS *intgrtyParams;
102 PRC_ZUC_INTEGRITY_DATA *pdu_list;
105 Buffer *pduInfoBuffer;
106 Buffer *pduListBuffer;
107 }ZucIntProtCallBkParams;
109 typedef struct zucIntVerCallBkParams
111 PRC_ZUC_INTEGRITY_PARAMS *intgrtyParams;
113 PRC_ZUC_INTEGRITY_DATA *pdu_list;
116 Buffer *pduInfoBuffer;
117 Buffer *pduListBuffer;
119 }ZucIntVerCallBkParams;
121 typedef struct zucEncryptCallBkParams
123 #ifdef CIPH_BATCH_PROC
124 Data *encryptBuf[32];
125 PjTxEnt *txEntLst[32];
126 PjRxEnt *rxEntLst[32];
127 PRC_ZUC_ENCRYPTION_DATA *pduList;
129 PRC_ZUC_ENCRYPTION_DATA *pdu_list;
132 Buffer *pduInfoBuffer;
133 Buffer *pduListBuffer;
138 PRC_ZUC_ENCRYPTION_PARAMS *encryptParams;
139 }ZucEncryptCallBkParams;
143 typedef struct aesIntProtCallBkParams
145 PRC_AES_INTEGRITY_PARAMS *intgrtyParams;
147 PRC_AES_INTEGRITY_DATA *pdu_list;
150 Buffer *pduInfoBuffer;
151 Buffer *pduListBuffer;
152 }AesIntProtCallBkParams;
154 typedef struct aesIntVerCallBkParams
156 PRC_AES_INTEGRITY_PARAMS *intgrtyParams;
158 PRC_AES_INTEGRITY_DATA *pdu_list;
161 Buffer *pduInfoBuffer;
162 Buffer *pduListBuffer;
164 }AesIntVerCallBkParams;
166 typedef struct aesEncryptCallBkParams
168 #ifdef CIPH_BATCH_PROC
169 Data *encryptBuf[32];
170 PjTxEnt *txEntLst[32];
171 PjRxEnt *rxEntLst[32];
172 PRC_AES_ENCRYPTION_DATA *pduList;
174 PRC_AES_ENCRYPTION_DATA *pdu_list;
177 Buffer *pduInfoBuffer;
178 Buffer *pduListBuffer;
183 PRC_AES_ENCRYPTION_PARAMS *encryptParams;
184 }AesEncryptCallBkParams;
187 #ifdef CIPH_BATCH_PROC
188 typedef struct deCipherCallBkParams
191 PjRxEnt *rxEntLst[32];
192 //Buffer *deCipheredBuf[16];
193 PRC_SNOW_CIPHER_DATA *pduList;
194 PRC_SNOW_CIPHER_PARAMS *deCipherParams;
195 }DecipherCallBkParams;
197 typedef struct decryptCallBkParams
200 PjRxEnt *rxEntLst[32];
201 //Buffer *deCipheredBuf[16];
202 PRC_ZUC_ENCRYPTION_DATA *pduList;
203 PRC_ZUC_ENCRYPTION_PARAMS *decryptParams;
204 }DecryptCallBkParams;
207 typedef struct decryptAesCallBkParams
210 PjRxEnt *rxEntLst[32];
211 //Buffer *deCipheredBuf[16];
212 PRC_AES_ENCRYPTION_DATA *pduList;
213 PRC_AES_ENCRYPTION_PARAMS *decryptParams;
214 }DecryptAesCallBkParams;
219 extern S16 pjUtlIntProtCallBk ARGS((
221 Void* callback_params
223 extern S16 pjUtlIntVerCallBk ARGS((
225 Void* callback_params
229 extern S16 bcIntProtReq ARGS((
231 PjSecInp secInp, /* Input for Integrity protection */
233 Buffer *mBuf /* SDU to be compressed */
236 extern S16 bcIntProtReq ARGS((
237 PjSecInp secInp, /* Input for Integrity protection */
239 Buffer *mBuf, /* SDU to be compressed */
240 U32 *macI /* Message authentication code for the SDU */
244 extern S16 pjUtlCipherCallBk ARGS((U32 rc, Void* callback_params));
245 #ifdef CIPH_BATCH_PROC
246 extern S16 pjUtlBatchCipherCallBk ARGS((U32 rc, Void* callback_params));