1 /******************************************************************************
2  *
3  * Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
4  * Analog Devices, Inc.),
5  * Copyright (C) 2023-2024 Analog Devices, Inc.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  ******************************************************************************/
20 
21 #include "mxc_device.h"
22 #include "mxc_errors.h"
23 #include "mxc_assert.h"
24 #include "mxc_sys.h"
25 #include "ctb_reva.h"
26 #include "ctb_common.h"
27 #include "trng_regs.h"
28 
29 /* ************************************************************************* */
30 /* Global Control/Configuration functions                                    */
31 /* ************************************************************************* */
32 
33 /********************************************************/
34 
MXC_CTB_Init(uint32_t features)35 int MXC_CTB_Init(uint32_t features)
36 {
37     // The crypto clock needs to be turned on for crypto to work.
38     if ((MXC_GCR->clkctrl & MXC_F_GCR_CLKCTRL_ISO_EN) == 0) {
39         MXC_GCR->clkctrl |= MXC_F_GCR_CLKCTRL_ISO_EN;
40 
41         // Check if CRYPTO clock is ready
42         if (MXC_SYS_Clock_Timeout(MXC_F_GCR_CLKCTRL_ISO_RDY) != E_NO_ERROR) {
43             return E_TIME_OUT;
44         }
45     }
46 
47     if (features & ~MXC_CTB_FEATURE_TRNG) {
48         MXC_SYS_ClockEnable(MXC_SYS_PERIPH_CLOCK_CRYPTO);
49     }
50 
51     MXC_CTB_RevA_Init((mxc_ctb_reva_regs_t *)MXC_CTB, features);
52 
53     if (features & MXC_CTB_FEATURE_TRNG) {
54         MXC_SYS_ClockEnable(MXC_SYS_PERIPH_CLOCK_TRNG);
55     }
56 
57     return E_NO_ERROR;
58 }
59 
MXC_CTB_CheckFeatures(void)60 uint32_t MXC_CTB_CheckFeatures(void)
61 {
62     return MXC_CTB_FEATURE_DMA | MXC_CTB_FEATURE_ECC | MXC_CTB_FEATURE_CIPHER |
63            MXC_CTB_FEATURE_HASH | MXC_CTB_FEATURE_CRC | MXC_CTB_FEATURE_TRNG;
64 }
65 
MXC_CTB_EnableInt(void)66 void MXC_CTB_EnableInt(void)
67 {
68     MXC_CTB_RevA_EnableInt((mxc_ctb_reva_regs_t *)MXC_CTB);
69 }
70 
MXC_CTB_DisableInt(void)71 void MXC_CTB_DisableInt(void)
72 {
73     MXC_CTB_RevA_DisableInt((mxc_ctb_reva_regs_t *)MXC_CTB);
74 }
75 
MXC_CTB_Ready(void)76 int MXC_CTB_Ready(void)
77 {
78     return MXC_CTB_RevA_Ready((mxc_ctb_reva_regs_t *)MXC_CTB);
79 }
80 
MXC_CTB_DoneClear(uint32_t features)81 void MXC_CTB_DoneClear(uint32_t features)
82 {
83     MXC_CTB_RevA_DoneClear((mxc_ctb_reva_regs_t *)MXC_CTB, features);
84 }
85 
MXC_CTB_Done(void)86 uint32_t MXC_CTB_Done(void)
87 {
88     return MXC_CTB_RevA_Done((mxc_ctb_reva_regs_t *)MXC_CTB);
89 }
90 
MXC_CTB_Reset(uint32_t features)91 void MXC_CTB_Reset(uint32_t features)
92 {
93     MXC_CTB_RevA_Reset(features);
94 }
95 
MXC_CTB_CacheInvalidate(void)96 void MXC_CTB_CacheInvalidate(void)
97 {
98     MXC_CTB_RevA_CacheInvalidate();
99 }
100 
MXC_CTB_Shutdown(uint32_t features)101 int MXC_CTB_Shutdown(uint32_t features)
102 {
103     uint32_t new_features;
104 
105     int error = MXC_CTB_RevA_Shutdown(features);
106 
107     if (error != E_NO_ERROR) {
108         return error;
109     }
110 
111     new_features = MXC_CTB_GetEnabledFeatures();
112 
113     // If CTB is not needed, disable clock
114     if ((new_features & ~MXC_CTB_FEATURE_TRNG) == 0) {
115         MXC_SYS_ClockDisable(MXC_SYS_PERIPH_CLOCK_CRYPTO);
116     }
117 
118     // If shutting down TRNG, disable clock
119     if (features & MXC_CTB_FEATURE_TRNG) {
120         MXC_SYS_ClockDisable(MXC_SYS_PERIPH_CLOCK_TRNG);
121     }
122 
123     return E_NO_ERROR;
124 }
125 
MXC_CTB_GetEnabledFeatures(void)126 uint32_t MXC_CTB_GetEnabledFeatures(void)
127 {
128     return MXC_CTB_RevA_GetEnabledFeatures();
129 }
130 
MXC_CTB_Handler(void)131 void MXC_CTB_Handler(void)
132 {
133     MXC_CTB_RevA_Handler((mxc_trng_reva_regs_t *)MXC_TRNG);
134 }
135 
136 /************************************/
137 /* CTB DMA - Used for all features  */
138 /************************************/
139 
MXC_CTB_DMA_SetReadSource(mxc_ctb_dma_read_source_t source)140 void MXC_CTB_DMA_SetReadSource(mxc_ctb_dma_read_source_t source)
141 {
142     MXC_CTB_RevA_DMA_SetReadSource((mxc_ctb_reva_regs_t *)MXC_CTB,
143                                    (mxc_ctb_reva_dma_read_source_t)source);
144 }
145 
MXC_CTB_DMA_GetReadSource(void)146 mxc_ctb_dma_read_source_t MXC_CTB_DMA_GetReadSource(void)
147 {
148     return (mxc_ctb_dma_read_source_t)MXC_CTB_RevA_DMA_GetReadSource(
149         (mxc_ctb_reva_regs_t *)MXC_CTB);
150 }
151 
MXC_CTB_DMA_SetWriteSource(mxc_ctb_dma_write_source_t source)152 void MXC_CTB_DMA_SetWriteSource(mxc_ctb_dma_write_source_t source)
153 {
154     MXC_CTB_RevA_DMA_SetWriteSource((mxc_ctb_reva_regs_t *)MXC_CTB,
155                                     (mxc_ctb_reva_dma_write_source_t)source);
156 }
157 
MXC_CTB_DMA_GetWriteSource(void)158 mxc_ctb_dma_write_source_t MXC_CTB_DMA_GetWriteSource(void)
159 {
160     return (mxc_ctb_dma_write_source_t)MXC_CTB_RevA_DMA_GetWriteSource(
161         (mxc_ctb_reva_regs_t *)MXC_CTB);
162 }
163 
MXC_CTB_DMA_SetSource(uint8_t * source)164 void MXC_CTB_DMA_SetSource(uint8_t *source)
165 {
166     MXC_ASSERT(((uint32_t)source > 0x100FFFFF) || ((uint32_t)source < 0x08000000));
167     MXC_CTB_RevA_DMA_SetSource((mxc_ctb_reva_regs_t *)MXC_CTB, source);
168 }
169 
MXC_CTB_DMA_SetDestination(uint8_t * dest)170 void MXC_CTB_DMA_SetDestination(uint8_t *dest)
171 {
172     MXC_CTB_RevA_DMA_SetDestination((mxc_ctb_reva_regs_t *)MXC_CTB, dest);
173 }
174 
MXC_CTB_DMA_SetupOperation(mxc_ctb_dma_req_t * req)175 int MXC_CTB_DMA_SetupOperation(mxc_ctb_dma_req_t *req)
176 {
177     return MXC_CTB_RevA_DMA_SetupOperation((mxc_ctb_reva_dma_req_t *)req);
178 }
179 
MXC_CTB_DMA_DoOperation(mxc_ctb_dma_req_t * req)180 int MXC_CTB_DMA_DoOperation(mxc_ctb_dma_req_t *req)
181 {
182     return MXC_CTB_RevA_DMA_DoOperation((mxc_ctb_reva_dma_req_t *)req);
183 }
184 
MXC_CTB_DMA_StartTransfer(uint32_t length)185 void MXC_CTB_DMA_StartTransfer(uint32_t length)
186 {
187     MXC_CTB_RevA_DMA_StartTransfer((mxc_ctb_reva_regs_t *)MXC_CTB, length);
188 }
189 
190 /* ************************************************************************* */
191 /* True Random Number Generator (TRNG) functions                             */
192 /* ************************************************************************* */
193 
MXC_CTB_TRNG_RandomInt(void)194 int MXC_CTB_TRNG_RandomInt(void)
195 {
196     return MXC_CTB_RevA_TRNG_RandomInt((mxc_trng_reva_regs_t *)MXC_TRNG);
197 }
198 
MXC_CTB_TRNG_Random(uint8_t * data,uint32_t len)199 int MXC_CTB_TRNG_Random(uint8_t *data, uint32_t len)
200 {
201     return MXC_CTB_RevA_TRNG_Random(data, len);
202 }
203 
MXC_CTB_TRNG_RandomAsync(uint8_t * data,uint32_t len,mxc_ctb_complete_cb_t callback)204 void MXC_CTB_TRNG_RandomAsync(uint8_t *data, uint32_t len, mxc_ctb_complete_cb_t callback)
205 {
206     MXC_CTB_RevA_TRNG_RandomAsync((mxc_trng_reva_regs_t *)MXC_TRNG, data, len, callback);
207 }
208 
209 /* ************************************************************************* */
210 /* Error Correction Code (ECC) functions                                     */
211 /* ************************************************************************* */
212 
213 /*******************************/
214 /* Low Level Functions         */
215 /*******************************/
216 
MXC_CTB_ECC_Enable(void)217 void MXC_CTB_ECC_Enable(void)
218 {
219     MXC_CTB_RevA_ECC_Enable((mxc_ctb_reva_regs_t *)MXC_CTB);
220 }
221 
MXC_CTB_ECC_Disable(void)222 void MXC_CTB_ECC_Disable(void)
223 {
224     MXC_CTB_RevA_ECC_Disable((mxc_ctb_reva_regs_t *)MXC_CTB);
225 }
226 
MXC_CTB_ECC_GetResult(void)227 uint32_t MXC_CTB_ECC_GetResult(void)
228 {
229     return MXC_CTB_RevA_ECC_GetResult((mxc_ctb_reva_regs_t *)MXC_CTB);
230 }
231 
232 /*******************************/
233 /* High Level Functions        */
234 /*******************************/
235 
MXC_CTB_ECC_Compute(mxc_ctb_ecc_req_t * req)236 int MXC_CTB_ECC_Compute(mxc_ctb_ecc_req_t *req)
237 {
238     return MXC_CTB_RevA_ECC_Compute((mxc_ctb_reva_ecc_req_t *)req);
239 }
240 
MXC_CTB_ECC_ErrorCheck(mxc_ctb_ecc_req_t * req)241 int MXC_CTB_ECC_ErrorCheck(mxc_ctb_ecc_req_t *req)
242 {
243     return MXC_CTB_RevA_ECC_ErrorCheck((mxc_ctb_reva_ecc_req_t *)req);
244 }
245 
MXC_CTB_ECC_ComputeAsync(mxc_ctb_ecc_req_t * req)246 void MXC_CTB_ECC_ComputeAsync(mxc_ctb_ecc_req_t *req)
247 {
248     MXC_CTB_RevA_ECC_ComputeAsync((mxc_ctb_reva_ecc_req_t *)req);
249 }
250 
MXC_CTB_ECC_ErrorCheckAsync(mxc_ctb_ecc_req_t * req)251 void MXC_CTB_ECC_ErrorCheckAsync(mxc_ctb_ecc_req_t *req)
252 {
253     MXC_CTB_RevA_ECC_ErrorCheckAsync((mxc_ctb_reva_ecc_req_t *)req);
254 }
255 
256 /* ************************************************************************* */
257 /* Cyclic Redundancy Check (CRC) functions                                   */
258 /* ************************************************************************* */
259 
260 /*******************************/
261 /* Low Level Functions         */
262 /*******************************/
263 
MXC_CTB_CRC_SetDirection(mxc_ctb_crc_bitorder_t bitOrder)264 void MXC_CTB_CRC_SetDirection(mxc_ctb_crc_bitorder_t bitOrder)
265 {
266     MXC_CTB_RevA_CRC_SetDirection((mxc_ctb_reva_regs_t *)MXC_CTB,
267                                   (mxc_ctb_reva_crc_bitorder_t)bitOrder);
268 }
269 
MXC_CTB_CRC_GetDirection(void)270 mxc_ctb_crc_bitorder_t MXC_CTB_CRC_GetDirection(void)
271 {
272     return (mxc_ctb_crc_bitorder_t)MXC_CTB_RevA_CRC_GetDirection((mxc_ctb_reva_regs_t *)MXC_CTB);
273 }
274 
MXC_CTB_CRC_SetPoly(uint32_t poly)275 void MXC_CTB_CRC_SetPoly(uint32_t poly)
276 {
277     MXC_CTB_RevA_CRC_SetPoly((mxc_ctb_reva_regs_t *)MXC_CTB, poly);
278 }
279 
MXC_CTB_CRC_GetPoly(void)280 uint32_t MXC_CTB_CRC_GetPoly(void)
281 {
282     return MXC_CTB_RevA_CRC_GetPoly((mxc_ctb_reva_regs_t *)MXC_CTB);
283 }
284 
MXC_CTB_CRC_GetResult(void)285 uint32_t MXC_CTB_CRC_GetResult(void)
286 {
287     return MXC_CTB_RevA_CRC_GetResult((mxc_ctb_reva_regs_t *)MXC_CTB);
288 }
289 
MXC_CTB_CRC_SetInitialValue(uint32_t seed)290 void MXC_CTB_CRC_SetInitialValue(uint32_t seed)
291 {
292     MXC_CTB_RevA_CRC_SetInitialValue(seed);
293 }
294 
MXC_CTB_CRC_SetFinalXORValue(uint32_t xor)295 void MXC_CTB_CRC_SetFinalXORValue(uint32_t xor)
296 {
297     MXC_CTB_RevA_CRC_SetFinalXORValue(xor);
298 }
299 
300 /*******************************/
301 /* High Level Functions        */
302 /*******************************/
303 
MXC_CTB_CRC_Compute(mxc_ctb_crc_req_t * req)304 int MXC_CTB_CRC_Compute(mxc_ctb_crc_req_t *req)
305 {
306     return MXC_CTB_RevA_CRC_Compute((mxc_ctb_reva_regs_t *)MXC_CTB, (mxc_ctb_reva_crc_req_t *)req);
307 }
308 
MXC_CTB_CRC_ComputeAsync(mxc_ctb_crc_req_t * req)309 void MXC_CTB_CRC_ComputeAsync(mxc_ctb_crc_req_t *req)
310 {
311     MXC_CTB_RevA_CRC_ComputeAsync((mxc_ctb_reva_regs_t *)MXC_CTB, (mxc_ctb_reva_crc_req_t *)req);
312 }
313 
314 /* ************************************************************************* */
315 /* Hash functions                                                            */
316 /* ************************************************************************* */
317 
318 /***********************/
319 /* Low Level Functions */
320 /***********************/
321 
MXC_CTB_Hash_GetBlockSize(mxc_ctb_hash_func_t function)322 unsigned int MXC_CTB_Hash_GetBlockSize(mxc_ctb_hash_func_t function)
323 {
324     return MXC_CTB_Common_Hash_GetBlockSize(function);
325 }
326 
MXC_CTB_Hash_GetDigestSize(mxc_ctb_hash_func_t function)327 unsigned int MXC_CTB_Hash_GetDigestSize(mxc_ctb_hash_func_t function)
328 {
329     return MXC_CTB_Common_Hash_GetDigestSize(function);
330 }
331 
MXC_CTB_Hash_SetFunction(mxc_ctb_hash_func_t function)332 void MXC_CTB_Hash_SetFunction(mxc_ctb_hash_func_t function)
333 {
334     MXC_CTB_RevA_Hash_SetFunction((mxc_ctb_reva_regs_t *)MXC_CTB,
335                                   (mxc_ctb_reva_hash_func_t)function);
336 }
337 
MXC_CTB_Hash_GetFunction(void)338 mxc_ctb_hash_func_t MXC_CTB_Hash_GetFunction(void)
339 {
340     return (mxc_ctb_hash_func_t)MXC_CTB_RevA_Hash_GetFunction((mxc_ctb_reva_regs_t *)MXC_CTB);
341 }
342 
MXC_CTB_Hash_SetAutoPad(int pad)343 void MXC_CTB_Hash_SetAutoPad(int pad)
344 {
345     MXC_CTB_RevA_Hash_SetAutoPad((mxc_ctb_reva_regs_t *)MXC_CTB, pad);
346 }
347 
MXC_CTB_Hash_GetAutoPad(void)348 int MXC_CTB_Hash_GetAutoPad(void)
349 {
350     return MXC_CTB_RevA_Hash_GetAutoPad((mxc_ctb_reva_regs_t *)MXC_CTB);
351 }
352 
MXC_CTB_Hash_GetResult(uint8_t * digest,int * len)353 void MXC_CTB_Hash_GetResult(uint8_t *digest, int *len)
354 {
355     MXC_CTB_RevA_Hash_GetResult((mxc_ctb_reva_regs_t *)MXC_CTB, digest, len);
356 }
357 
MXC_CTB_Hash_SetMessageSize(uint32_t size)358 void MXC_CTB_Hash_SetMessageSize(uint32_t size)
359 {
360     MXC_CTB_RevA_Hash_SetMessageSize((mxc_ctb_reva_regs_t *)MXC_CTB, size);
361 }
362 
MXC_CTB_Hash_SetSource(mxc_ctb_hash_source_t source)363 void MXC_CTB_Hash_SetSource(mxc_ctb_hash_source_t source)
364 {
365     MXC_CTB_RevA_Hash_SetSource((mxc_ctb_reva_regs_t *)MXC_CTB, (mxc_ctb_reva_hash_source_t)source);
366 }
367 
MXC_CTB_Hash_GetSource(void)368 mxc_ctb_hash_source_t MXC_CTB_Hash_GetSource(void)
369 {
370     return (mxc_ctb_hash_source_t)MXC_CTB_RevA_Hash_GetSource((mxc_ctb_reva_regs_t *)MXC_CTB);
371 }
372 
MXC_CTB_Hash_InitializeHash(void)373 void MXC_CTB_Hash_InitializeHash(void)
374 {
375     MXC_CTB_RevA_Hash_InitializeHash((mxc_ctb_reva_regs_t *)MXC_CTB);
376 }
377 
378 /************************/
379 /* High Level Functions */
380 /************************/
381 
MXC_CTB_Hash_Compute(mxc_ctb_hash_req_t * req)382 int MXC_CTB_Hash_Compute(mxc_ctb_hash_req_t *req)
383 {
384     return MXC_CTB_RevA_Hash_Compute((mxc_ctb_reva_hash_req_t *)req);
385 }
386 
MXC_CTB_Hash_ComputeAsync(mxc_ctb_hash_req_t * req)387 void MXC_CTB_Hash_ComputeAsync(mxc_ctb_hash_req_t *req)
388 {
389     MXC_CTB_RevA_Hash_ComputeAsync((mxc_ctb_reva_hash_req_t *)req);
390 }
391 
392 /* ************************************************************************* */
393 /* Cipher functions                                                          */
394 /* ************************************************************************* */
395 
396 /************************/
397 /* Low Level Functions  */
398 /************************/
399 
MXC_CTB_Cipher_GetKeySize(mxc_ctb_cipher_t cipher)400 unsigned int MXC_CTB_Cipher_GetKeySize(mxc_ctb_cipher_t cipher)
401 {
402     return MXC_CTB_Common_Cipher_GetKeySize(cipher);
403 }
404 
MXC_CTB_Cipher_GetBlockSize(mxc_ctb_cipher_t cipher)405 unsigned int MXC_CTB_Cipher_GetBlockSize(mxc_ctb_cipher_t cipher)
406 {
407     return MXC_CTB_Common_Cipher_GetBlockSize(cipher);
408 }
409 
MXC_CTB_Cipher_SetMode(mxc_ctb_cipher_mode_t mode)410 void MXC_CTB_Cipher_SetMode(mxc_ctb_cipher_mode_t mode)
411 {
412     MXC_CTB_RevA_Cipher_SetMode((mxc_ctb_reva_regs_t *)MXC_CTB, (mxc_ctb_reva_cipher_mode_t)mode);
413 }
414 
MXC_CTB_Cipher_GetMode(void)415 mxc_ctb_cipher_mode_t MXC_CTB_Cipher_GetMode(void)
416 {
417     return (mxc_ctb_cipher_mode_t)MXC_CTB_RevA_Cipher_GetMode((mxc_ctb_reva_regs_t *)MXC_CTB);
418 }
419 
MXC_CTB_Cipher_SetCipher(mxc_ctb_cipher_t cipher)420 void MXC_CTB_Cipher_SetCipher(mxc_ctb_cipher_t cipher)
421 {
422     MXC_CTB_RevA_Cipher_SetCipher((mxc_ctb_reva_regs_t *)MXC_CTB, (mxc_ctb_reva_cipher_t)cipher);
423 }
424 
MXC_CTB_Cipher_GetCipher(void)425 mxc_ctb_cipher_t MXC_CTB_Cipher_GetCipher(void)
426 {
427     return (mxc_ctb_cipher_t)MXC_CTB_RevA_Cipher_GetCipher((mxc_ctb_reva_regs_t *)MXC_CTB);
428 }
429 
MXC_CTB_Cipher_SetKeySource(mxc_ctb_cipher_key_t source)430 void MXC_CTB_Cipher_SetKeySource(mxc_ctb_cipher_key_t source)
431 {
432     MXC_CTB_RevA_Cipher_SetKeySource((mxc_ctb_reva_regs_t *)MXC_CTB,
433                                      (mxc_ctb_reva_cipher_key_t)source);
434 }
435 
MXC_CTB_Cipher_GetKeySource(void)436 mxc_ctb_cipher_key_t MXC_CTB_Cipher_GetKeySource(void)
437 {
438     return (mxc_ctb_cipher_key_t)MXC_CTB_RevA_Cipher_GetKeySource((mxc_ctb_reva_regs_t *)MXC_CTB);
439 }
440 
MXC_CTB_Cipher_LoadKey(void)441 void MXC_CTB_Cipher_LoadKey(void)
442 {
443     MXC_CTB_RevA_Cipher_LoadKey((mxc_ctb_reva_regs_t *)MXC_CTB);
444 }
445 
MXC_CTB_Cipher_SetOperation(mxc_ctb_cipher_operation_t operation)446 void MXC_CTB_Cipher_SetOperation(mxc_ctb_cipher_operation_t operation)
447 {
448     MXC_CTB_RevA_Cipher_SetOperation((mxc_ctb_reva_regs_t *)MXC_CTB,
449                                      (mxc_ctb_reva_cipher_operation_t)operation);
450 }
451 
MXC_CTB_Cipher_SetKey(uint8_t * key,uint32_t len)452 void MXC_CTB_Cipher_SetKey(uint8_t *key, uint32_t len)
453 {
454     MXC_CTB_RevA_Cipher_SetKey((mxc_ctb_reva_regs_t *)MXC_CTB, key, len);
455 }
456 
MXC_CTB_Cipher_SetIV(uint8_t * iv,uint32_t len)457 void MXC_CTB_Cipher_SetIV(uint8_t *iv, uint32_t len)
458 {
459     MXC_CTB_RevA_Cipher_SetIV((mxc_ctb_reva_regs_t *)MXC_CTB, iv, len);
460 }
461 
MXC_CTB_Cipher_GetIV(uint8_t * ivOut,uint32_t len)462 void MXC_CTB_Cipher_GetIV(uint8_t *ivOut, uint32_t len)
463 {
464     MXC_CTB_RevA_Cipher_GetIV((mxc_ctb_reva_regs_t *)MXC_CTB, ivOut, len);
465 }
466 
467 /************************/
468 /* High Level Functions */
469 /************************/
470 
MXC_CTB_Cipher_Encrypt(mxc_ctb_cipher_req_t * req)471 int MXC_CTB_Cipher_Encrypt(mxc_ctb_cipher_req_t *req)
472 {
473     return MXC_CTB_RevA_Cipher_Encrypt((mxc_ctb_reva_cipher_req_t *)req);
474 }
475 
MXC_CTB_Cipher_Decrypt(mxc_ctb_cipher_req_t * req)476 int MXC_CTB_Cipher_Decrypt(mxc_ctb_cipher_req_t *req)
477 {
478     return MXC_CTB_RevA_Cipher_Decrypt((mxc_ctb_reva_cipher_req_t *)req);
479 }
480 
MXC_CTB_Cipher_EncryptAsync(mxc_ctb_cipher_req_t * req)481 void MXC_CTB_Cipher_EncryptAsync(mxc_ctb_cipher_req_t *req)
482 {
483     MXC_CTB_RevA_Cipher_EncryptAsync((mxc_ctb_reva_cipher_req_t *)req);
484 }
485 
MXC_CTB_Cipher_DecryptAsync(mxc_ctb_cipher_req_t * req)486 void MXC_CTB_Cipher_DecryptAsync(mxc_ctb_cipher_req_t *req)
487 {
488     MXC_CTB_RevA_Cipher_DecryptAsync((mxc_ctb_reva_cipher_req_t *)req);
489 }
490