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_CTB);
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_CTB);
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, source);
143 }
144
MXC_CTB_DMA_GetReadSource(void)145 mxc_ctb_dma_read_source_t MXC_CTB_DMA_GetReadSource(void)
146 {
147 return MXC_CTB_RevA_DMA_GetReadSource((mxc_ctb_reva_regs_t *)MXC_CTB);
148 }
149
MXC_CTB_DMA_SetWriteSource(mxc_ctb_dma_write_source_t source)150 void MXC_CTB_DMA_SetWriteSource(mxc_ctb_dma_write_source_t source)
151 {
152 MXC_CTB_RevA_DMA_SetWriteSource((mxc_ctb_reva_regs_t *)MXC_CTB, source);
153 }
154
MXC_CTB_DMA_GetWriteSource(void)155 mxc_ctb_dma_write_source_t MXC_CTB_DMA_GetWriteSource(void)
156 {
157 return MXC_CTB_RevA_DMA_GetWriteSource((mxc_ctb_reva_regs_t *)MXC_CTB);
158 }
159
MXC_CTB_DMA_SetSource(uint8_t * source)160 void MXC_CTB_DMA_SetSource(uint8_t *source)
161 {
162 MXC_ASSERT(((uint32_t)source > 0x100FFFFF) || ((uint32_t)source < 0x08000000));
163 MXC_CTB_RevA_DMA_SetSource((mxc_ctb_reva_regs_t *)MXC_CTB, source);
164 }
165
MXC_CTB_DMA_SetDestination(uint8_t * dest)166 void MXC_CTB_DMA_SetDestination(uint8_t *dest)
167 {
168 MXC_CTB_RevA_DMA_SetDestination((mxc_ctb_reva_regs_t *)MXC_CTB, dest);
169 }
170
MXC_CTB_DMA_SetupOperation(mxc_ctb_dma_req_t * req)171 int MXC_CTB_DMA_SetupOperation(mxc_ctb_dma_req_t *req)
172 {
173 return MXC_CTB_RevA_DMA_SetupOperation((mxc_ctb_reva_dma_req_t *)req);
174 }
175
MXC_CTB_DMA_DoOperation(mxc_ctb_dma_req_t * req)176 int MXC_CTB_DMA_DoOperation(mxc_ctb_dma_req_t *req)
177 {
178 return MXC_CTB_RevA_DMA_DoOperation((mxc_ctb_reva_dma_req_t *)req);
179 }
180
MXC_CTB_DMA_StartTransfer(uint32_t length)181 void MXC_CTB_DMA_StartTransfer(uint32_t length)
182 {
183 MXC_CTB_RevA_DMA_StartTransfer((mxc_ctb_reva_regs_t *)MXC_CTB, length);
184 }
185
186 /* ************************************************************************* */
187 /* True Random Number Generator (TRNG) functions */
188 /* ************************************************************************* */
189
MXC_CTB_TRNG_RandomInt(void)190 int MXC_CTB_TRNG_RandomInt(void)
191 {
192 return MXC_CTB_RevA_TRNG_RandomInt((mxc_trng_reva_regs_t *)MXC_TRNG);
193 }
194
MXC_CTB_TRNG_Random(uint8_t * data,uint32_t len)195 int MXC_CTB_TRNG_Random(uint8_t *data, uint32_t len)
196 {
197 return MXC_CTB_RevA_TRNG_Random(data, len);
198 }
199
MXC_CTB_TRNG_RandomAsync(uint8_t * data,uint32_t len,mxc_ctb_complete_cb_t callback)200 void MXC_CTB_TRNG_RandomAsync(uint8_t *data, uint32_t len, mxc_ctb_complete_cb_t callback)
201 {
202 MXC_CTB_RevA_TRNG_RandomAsync((mxc_trng_reva_regs_t *)MXC_TRNG, data, len, callback);
203 }
204
205 /* ************************************************************************* */
206 /* Error Correction Code (ECC) functions */
207 /* ************************************************************************* */
208
209 /*******************************/
210 /* Low Level Functions */
211 /*******************************/
212
MXC_CTB_ECC_Enable(void)213 void MXC_CTB_ECC_Enable(void)
214 {
215 MXC_CTB_RevA_ECC_Enable((mxc_ctb_reva_regs_t *)MXC_CTB);
216 }
217
MXC_CTB_ECC_Disable(void)218 void MXC_CTB_ECC_Disable(void)
219 {
220 MXC_CTB_RevA_ECC_Disable((mxc_ctb_reva_regs_t *)MXC_CTB);
221 }
222
MXC_CTB_ECC_GetResult(void)223 uint32_t MXC_CTB_ECC_GetResult(void)
224 {
225 return MXC_CTB_RevA_ECC_GetResult((mxc_ctb_reva_regs_t *)MXC_CTB);
226 }
227
228 /*******************************/
229 /* High Level Functions */
230 /*******************************/
231
MXC_CTB_ECC_Compute(mxc_ctb_ecc_req_t * req)232 int MXC_CTB_ECC_Compute(mxc_ctb_ecc_req_t *req)
233 {
234 return MXC_CTB_RevA_ECC_Compute((mxc_ctb_reva_ecc_req_t *)req);
235 }
236
MXC_CTB_ECC_ErrorCheck(mxc_ctb_ecc_req_t * req)237 int MXC_CTB_ECC_ErrorCheck(mxc_ctb_ecc_req_t *req)
238 {
239 return MXC_CTB_RevA_ECC_ErrorCheck((mxc_ctb_reva_ecc_req_t *)req);
240 }
241
MXC_CTB_ECC_ComputeAsync(mxc_ctb_ecc_req_t * req)242 void MXC_CTB_ECC_ComputeAsync(mxc_ctb_ecc_req_t *req)
243 {
244 MXC_CTB_RevA_ECC_ComputeAsync((mxc_ctb_reva_ecc_req_t *)req);
245 }
246
MXC_CTB_ECC_ErrorCheckAsync(mxc_ctb_ecc_req_t * req)247 void MXC_CTB_ECC_ErrorCheckAsync(mxc_ctb_ecc_req_t *req)
248 {
249 MXC_CTB_RevA_ECC_ErrorCheckAsync((mxc_ctb_reva_ecc_req_t *)req);
250 }
251
252 /* ************************************************************************* */
253 /* Cyclic Redundancy Check (CRC) functions */
254 /* ************************************************************************* */
255
256 /*******************************/
257 /* Low Level Functions */
258 /*******************************/
259
MXC_CTB_CRC_SetDirection(mxc_ctb_crc_bitorder_t bitOrder)260 void MXC_CTB_CRC_SetDirection(mxc_ctb_crc_bitorder_t bitOrder)
261 {
262 MXC_CTB_RevA_CRC_SetDirection((mxc_ctb_reva_regs_t *)MXC_CTB, bitOrder);
263 }
264
MXC_CTB_CRC_GetDirection(void)265 mxc_ctb_crc_bitorder_t MXC_CTB_CRC_GetDirection(void)
266 {
267 return MXC_CTB_RevA_CRC_GetDirection((mxc_ctb_reva_regs_t *)MXC_CTB);
268 }
269
MXC_CTB_CRC_SetPoly(uint32_t poly)270 void MXC_CTB_CRC_SetPoly(uint32_t poly)
271 {
272 MXC_CTB_RevA_CRC_SetPoly((mxc_ctb_reva_regs_t *)MXC_CTB, poly);
273 }
274
MXC_CTB_CRC_GetPoly(void)275 uint32_t MXC_CTB_CRC_GetPoly(void)
276 {
277 return MXC_CTB_RevA_CRC_GetPoly((mxc_ctb_reva_regs_t *)MXC_CTB);
278 }
279
MXC_CTB_CRC_GetResult(void)280 uint32_t MXC_CTB_CRC_GetResult(void)
281 {
282 return MXC_CTB_RevA_CRC_GetResult((mxc_ctb_reva_regs_t *)MXC_CTB);
283 }
284
MXC_CTB_CRC_SetInitialValue(uint32_t seed)285 void MXC_CTB_CRC_SetInitialValue(uint32_t seed)
286 {
287 MXC_CTB_RevA_CRC_SetInitialValue(seed);
288 }
289
MXC_CTB_CRC_SetFinalXORValue(uint32_t xor)290 void MXC_CTB_CRC_SetFinalXORValue(uint32_t xor)
291 {
292 MXC_CTB_RevA_CRC_SetFinalXORValue(xor);
293 }
294
295 /*******************************/
296 /* High Level Functions */
297 /*******************************/
298
MXC_CTB_CRC_Compute(mxc_ctb_crc_req_t * req)299 int MXC_CTB_CRC_Compute(mxc_ctb_crc_req_t *req)
300 {
301 return MXC_CTB_RevA_CRC_Compute((mxc_ctb_reva_regs_t *)MXC_CTB, (mxc_ctb_reva_crc_req_t *)req);
302 }
303
MXC_CTB_CRC_ComputeAsync(mxc_ctb_crc_req_t * req)304 void MXC_CTB_CRC_ComputeAsync(mxc_ctb_crc_req_t *req)
305 {
306 MXC_CTB_RevA_CRC_ComputeAsync((mxc_ctb_reva_regs_t *)MXC_CTB, (mxc_ctb_reva_crc_req_t *)req);
307 }
308
309 /* ************************************************************************* */
310 /* Hash functions */
311 /* ************************************************************************* */
312
313 /***********************/
314 /* Low Level Functions */
315 /***********************/
316
MXC_CTB_Hash_GetBlockSize(mxc_ctb_hash_func_t function)317 unsigned int MXC_CTB_Hash_GetBlockSize(mxc_ctb_hash_func_t function)
318 {
319 return MXC_CTB_Common_Hash_GetBlockSize(function);
320 }
321
MXC_CTB_Hash_GetDigestSize(mxc_ctb_hash_func_t function)322 unsigned int MXC_CTB_Hash_GetDigestSize(mxc_ctb_hash_func_t function)
323 {
324 return MXC_CTB_Common_Hash_GetDigestSize(function);
325 }
326
MXC_CTB_Hash_SetFunction(mxc_ctb_hash_func_t function)327 void MXC_CTB_Hash_SetFunction(mxc_ctb_hash_func_t function)
328 {
329 MXC_CTB_RevA_Hash_SetFunction((mxc_ctb_reva_regs_t *)MXC_CTB, function);
330 }
331
MXC_CTB_Hash_GetFunction(void)332 mxc_ctb_hash_func_t MXC_CTB_Hash_GetFunction(void)
333 {
334 return MXC_CTB_RevA_Hash_GetFunction((mxc_ctb_reva_regs_t *)MXC_CTB);
335 }
336
MXC_CTB_Hash_SetAutoPad(int pad)337 void MXC_CTB_Hash_SetAutoPad(int pad)
338 {
339 MXC_CTB_RevA_Hash_SetAutoPad((mxc_ctb_reva_regs_t *)MXC_CTB, pad);
340 }
341
MXC_CTB_Hash_GetAutoPad(void)342 int MXC_CTB_Hash_GetAutoPad(void)
343 {
344 return MXC_CTB_RevA_Hash_GetAutoPad((mxc_ctb_reva_regs_t *)MXC_CTB);
345 }
346
MXC_CTB_Hash_GetResult(uint8_t * digest,int * len)347 void MXC_CTB_Hash_GetResult(uint8_t *digest, int *len)
348 {
349 MXC_CTB_RevA_Hash_GetResult((mxc_ctb_reva_regs_t *)MXC_CTB, digest, len);
350 }
351
MXC_CTB_Hash_SetMessageSize(uint32_t size)352 void MXC_CTB_Hash_SetMessageSize(uint32_t size)
353 {
354 MXC_CTB_RevA_Hash_SetMessageSize((mxc_ctb_reva_regs_t *)MXC_CTB, size);
355 }
356
MXC_CTB_Hash_SetSource(mxc_ctb_hash_source_t source)357 void MXC_CTB_Hash_SetSource(mxc_ctb_hash_source_t source)
358 {
359 MXC_CTB_RevA_Hash_SetSource((mxc_ctb_reva_regs_t *)MXC_CTB, source);
360 }
361
MXC_CTB_Hash_GetSource(void)362 mxc_ctb_hash_source_t MXC_CTB_Hash_GetSource(void)
363 {
364 return MXC_CTB_RevA_Hash_GetSource((mxc_ctb_reva_regs_t *)MXC_CTB);
365 }
366
MXC_CTB_Hash_InitializeHash(void)367 void MXC_CTB_Hash_InitializeHash(void)
368 {
369 MXC_CTB_RevA_Hash_InitializeHash((mxc_ctb_reva_regs_t *)MXC_CTB);
370 }
371
372 /************************/
373 /* High Level Functions */
374 /************************/
375
MXC_CTB_Hash_Compute(mxc_ctb_hash_req_t * req)376 int MXC_CTB_Hash_Compute(mxc_ctb_hash_req_t *req)
377 {
378 return MXC_CTB_RevA_Hash_Compute((mxc_ctb_reva_hash_req_t *)req);
379 }
380
MXC_CTB_Hash_ComputeAsync(mxc_ctb_hash_req_t * req)381 void MXC_CTB_Hash_ComputeAsync(mxc_ctb_hash_req_t *req)
382 {
383 MXC_CTB_RevA_Hash_ComputeAsync((mxc_ctb_reva_hash_req_t *)req);
384 }
385
386 /* ************************************************************************* */
387 /* Cipher functions */
388 /* ************************************************************************* */
389
390 /************************/
391 /* Low Level Functions */
392 /************************/
393
MXC_CTB_Cipher_GetKeySize(mxc_ctb_cipher_t cipher)394 unsigned int MXC_CTB_Cipher_GetKeySize(mxc_ctb_cipher_t cipher)
395 {
396 return MXC_CTB_Common_Cipher_GetKeySize(cipher);
397 }
398
MXC_CTB_Cipher_GetBlockSize(mxc_ctb_cipher_t cipher)399 unsigned int MXC_CTB_Cipher_GetBlockSize(mxc_ctb_cipher_t cipher)
400 {
401 return MXC_CTB_Common_Cipher_GetBlockSize(cipher);
402 }
403
MXC_CTB_Cipher_SetMode(mxc_ctb_cipher_mode_t mode)404 void MXC_CTB_Cipher_SetMode(mxc_ctb_cipher_mode_t mode)
405 {
406 MXC_CTB_RevA_Cipher_SetMode((mxc_ctb_reva_regs_t *)MXC_CTB, mode);
407 }
408
MXC_CTB_Cipher_GetMode(void)409 mxc_ctb_cipher_mode_t MXC_CTB_Cipher_GetMode(void)
410 {
411 return MXC_CTB_RevA_Cipher_GetMode((mxc_ctb_reva_regs_t *)MXC_CTB);
412 }
413
MXC_CTB_Cipher_SetCipher(mxc_ctb_cipher_t cipher)414 void MXC_CTB_Cipher_SetCipher(mxc_ctb_cipher_t cipher)
415 {
416 MXC_CTB_RevA_Cipher_SetCipher((mxc_ctb_reva_regs_t *)MXC_CTB, cipher);
417 }
418
MXC_CTB_Cipher_GetCipher(void)419 mxc_ctb_cipher_t MXC_CTB_Cipher_GetCipher(void)
420 {
421 return MXC_CTB_RevA_Cipher_GetCipher((mxc_ctb_reva_regs_t *)MXC_CTB);
422 }
423
MXC_CTB_Cipher_SetKeySource(mxc_ctb_cipher_key_t source)424 void MXC_CTB_Cipher_SetKeySource(mxc_ctb_cipher_key_t source)
425 {
426 MXC_CTB_RevA_Cipher_SetKeySource((mxc_ctb_reva_regs_t *)MXC_CTB, source);
427 }
428
MXC_CTB_Cipher_GetKeySource(void)429 mxc_ctb_cipher_key_t MXC_CTB_Cipher_GetKeySource(void)
430 {
431 return MXC_CTB_RevA_Cipher_GetKeySource((mxc_ctb_reva_regs_t *)MXC_CTB);
432 }
433
MXC_CTB_Cipher_LoadKey(void)434 void MXC_CTB_Cipher_LoadKey(void)
435 {
436 MXC_CTB_RevA_Cipher_LoadKey((mxc_ctb_reva_regs_t *)MXC_CTB);
437 }
438
MXC_CTB_Cipher_SetOperation(mxc_ctb_cipher_operation_t operation)439 void MXC_CTB_Cipher_SetOperation(mxc_ctb_cipher_operation_t operation)
440 {
441 MXC_CTB_RevA_Cipher_SetOperation((mxc_ctb_reva_regs_t *)MXC_CTB, operation);
442 }
443
MXC_CTB_Cipher_SetKey(uint8_t * key,uint32_t len)444 void MXC_CTB_Cipher_SetKey(uint8_t *key, uint32_t len)
445 {
446 MXC_CTB_RevA_Cipher_SetKey((mxc_ctb_reva_regs_t *)MXC_CTB, key, len);
447 }
448
MXC_CTB_Cipher_SetIV(uint8_t * iv,uint32_t len)449 void MXC_CTB_Cipher_SetIV(uint8_t *iv, uint32_t len)
450 {
451 MXC_CTB_RevA_Cipher_SetIV((mxc_ctb_reva_regs_t *)MXC_CTB, iv, len);
452 }
453
MXC_CTB_Cipher_GetIV(uint8_t * ivOut,uint32_t len)454 void MXC_CTB_Cipher_GetIV(uint8_t *ivOut, uint32_t len)
455 {
456 MXC_CTB_RevA_Cipher_GetIV((mxc_ctb_reva_regs_t *)MXC_CTB, ivOut, len);
457 }
458
459 /************************/
460 /* High Level Functions */
461 /************************/
462
MXC_CTB_Cipher_Encrypt(mxc_ctb_cipher_req_t * req)463 int MXC_CTB_Cipher_Encrypt(mxc_ctb_cipher_req_t *req)
464 {
465 return MXC_CTB_RevA_Cipher_Encrypt((mxc_ctb_reva_cipher_req_t *)req);
466 }
467
MXC_CTB_Cipher_Decrypt(mxc_ctb_cipher_req_t * req)468 int MXC_CTB_Cipher_Decrypt(mxc_ctb_cipher_req_t *req)
469 {
470 return MXC_CTB_RevA_Cipher_Decrypt((mxc_ctb_reva_cipher_req_t *)req);
471 }
472
MXC_CTB_Cipher_EncryptAsync(mxc_ctb_cipher_req_t * req)473 void MXC_CTB_Cipher_EncryptAsync(mxc_ctb_cipher_req_t *req)
474 {
475 MXC_CTB_RevA_Cipher_EncryptAsync((mxc_ctb_reva_cipher_req_t *)req);
476 }
477
MXC_CTB_Cipher_DecryptAsync(mxc_ctb_cipher_req_t * req)478 void MXC_CTB_Cipher_DecryptAsync(mxc_ctb_cipher_req_t *req)
479 {
480 MXC_CTB_RevA_Cipher_DecryptAsync((mxc_ctb_reva_cipher_req_t *)req);
481 }
482