37 #if defined(CRYPTO_COUNT) && (CRYPTO_COUNT > 0)
196 #define CRYPTO_DATA_SIZE_IN_BITS (128)
197 #define CRYPTO_DATA_SIZE_IN_BYTES (CRYPTO_DATA_SIZE_IN_BITS/8)
198 #define CRYPTO_DATA_SIZE_IN_32BIT_WORDS (CRYPTO_DATA_SIZE_IN_BYTES/sizeof(uint32_t))
200 #define CRYPTO_KEYBUF_SIZE_IN_BITS (256)
201 #define CRYPTO_KEYBUF_SIZE_IN_BYTES (CRYPTO_DDATA_SIZE_IN_BITS/8)
202 #define CRYPTO_KEYBUF_SIZE_IN_32BIT_WORDS (CRYPTO_DDATA_SIZE_IN_BYTES/sizeof(uint32_t))
204 #define CRYPTO_DDATA_SIZE_IN_BITS (256)
205 #define CRYPTO_DDATA_SIZE_IN_BYTES (CRYPTO_DDATA_SIZE_IN_BITS/8)
206 #define CRYPTO_DDATA_SIZE_IN_32BIT_WORDS (CRYPTO_DDATA_SIZE_IN_BYTES/sizeof(uint32_t))
208 #define CRYPTO_QDATA_SIZE_IN_BITS (512)
209 #define CRYPTO_QDATA_SIZE_IN_BYTES (CRYPTO_QDATA_SIZE_IN_BITS/8)
210 #define CRYPTO_QDATA_SIZE_IN_32BIT_WORDS (CRYPTO_QDATA_SIZE_IN_BYTES/sizeof(uint32_t))
212 #define CRYPTO_DATA260_SIZE_IN_32BIT_WORDS (9)
215 #define CRYPTO_SHA1_DIGEST_SIZE_IN_BITS (160)
216 #define CRYPTO_SHA1_DIGEST_SIZE_IN_BYTES (CRYPTO_SHA1_DIGEST_SIZE_IN_BITS/8)
219 #define CRYPTO_SHA256_DIGEST_SIZE_IN_BITS (256)
220 #define CRYPTO_SHA256_DIGEST_SIZE_IN_BYTES (CRYPTO_SHA256_DIGEST_SIZE_IN_BITS/8)
225 #define CRYPTO_DDATA0_260_BITS_READ(crypto, bigint260) CRYPTO_DData0Read260(crypto, bigint260)
226 #define CRYPTO_DDATA0_260_BITS_WRITE(crypto, bigint260) CRYPTO_DData0Write260(crypto, bigint260)
235 #define CRYPTO_SEQ_LOAD_1(crypto, a1) { \
236 crypto->SEQ0 = a1 | (CRYPTO_CMD_INSTR_END<<8);}
237 #define CRYPTO_SEQ_LOAD_2(crypto, a1, a2) { \
238 crypto->SEQ0 = a1 | (a2<<8) | (CRYPTO_CMD_INSTR_END<<16);}
239 #define CRYPTO_SEQ_LOAD_3(crypto, a1, a2, a3) { \
240 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (CRYPTO_CMD_INSTR_END<<24);}
241 #define CRYPTO_SEQ_LOAD_4(crypto, a1, a2, a3, a4) { \
242 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
243 crypto->SEQ1 = CRYPTO_CMD_INSTR_END;}
244 #define CRYPTO_SEQ_LOAD_5(crypto, a1, a2, a3, a4, a5) { \
245 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
246 crypto->SEQ1 = a5 | (CRYPTO_CMD_INSTR_END<<8);}
247 #define CRYPTO_SEQ_LOAD_6(crypto, a1, a2, a3, a4, a5, a6) { \
248 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
249 crypto->SEQ1 = a5 | (a6<<8) | (CRYPTO_CMD_INSTR_END<<16);}
250 #define CRYPTO_SEQ_LOAD_7(crypto, a1, a2, a3, a4, a5, a6, a7) { \
251 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
252 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (CRYPTO_CMD_INSTR_END<<24);}
253 #define CRYPTO_SEQ_LOAD_8(crypto, a1, a2, a3, a4, a5, a6, a7, a8) { \
254 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
255 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
256 crypto->SEQ2 = CRYPTO_CMD_INSTR_END;}
257 #define CRYPTO_SEQ_LOAD_9(crypto, a1, a2, a3, a4, a5, a6, a7, a8, a9) { \
258 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
259 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
260 crypto->SEQ2 = a9 | (CRYPTO_CMD_INSTR_END<<8);}
261 #define CRYPTO_SEQ_LOAD_10(crypto, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) { \
262 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
263 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
264 crypto->SEQ2 = a9 | (a10<<8) | (CRYPTO_CMD_INSTR_END<<16);}
265 #define CRYPTO_SEQ_LOAD_11(crypto, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) { \
266 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
267 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
268 crypto->SEQ2 = a9 | (a10<<8) | (a11<<16) | (CRYPTO_CMD_INSTR_END<<24);}
269 #define CRYPTO_SEQ_LOAD_12(crypto, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) { \
270 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
271 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
272 crypto->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
273 crypto->SEQ3 = CRYPTO_CMD_INSTR_END;}
274 #define CRYPTO_SEQ_LOAD_13(crypto, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) { \
275 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
276 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
277 crypto->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
278 crypto->SEQ3 = a13 | (CRYPTO_CMD_INSTR_END<<8);}
279 #define CRYPTO_SEQ_LOAD_14(crypto, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) { \
280 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
281 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
282 crypto->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
283 crypto->SEQ3 = a13 | (a14<<8) | (CRYPTO_CMD_INSTR_END<<16);}
284 #define CRYPTO_SEQ_LOAD_15(crypto, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) { \
285 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
286 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
287 crypto->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
288 crypto->SEQ3 = a13 | (a14<<8) | (a15<<16) | (CRYPTO_CMD_INSTR_END<<24);}
289 #define CRYPTO_SEQ_LOAD_16(crypto, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) { \
290 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
291 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
292 crypto->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
293 crypto->SEQ3 = a13 | (a14<<8) | (a15<<16) | (a16<<24); \
294 crypto->SEQ4 = CRYPTO_CMD_INSTR_END;}
295 #define CRYPTO_SEQ_LOAD_17(crypto, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) { \
296 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
297 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
298 crypto->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
299 crypto->SEQ3 = a13 | (a14<<8) | (a15<<16) | (a16<<24); \
300 crypto->SEQ4 = a17 | (CRYPTO_CMD_INSTR_END<<8);}
301 #define CRYPTO_SEQ_LOAD_18(crypto, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18) { \
302 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
303 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
304 crypto->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
305 crypto->SEQ3 = a13 | (a14<<8) | (a15<<16) | (a16<<24); \
306 crypto->SEQ4 = a17 | (a18<<8) | (CRYPTO_CMD_INSTR_END<<16);}
307 #define CRYPTO_SEQ_LOAD_19(crypto, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19) { \
308 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
309 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
310 crypto->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
311 crypto->SEQ3 = a13 | (a14<<8) | (a15<<16) | (a16<<24); \
312 crypto->SEQ4 = a17 | (a18<<8) | (a19<<16) | (CRYPTO_CMD_INSTR_END<<24);}
313 #define CRYPTO_SEQ_LOAD_20(crypto, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) { \
314 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
315 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
316 crypto->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
317 crypto->SEQ3 = a13 | (a14<<8) | (a15<<16) | (a16<<24); \
318 crypto->SEQ4 = a17 | (a18<<8) | (a19<<16) | (a20<<24);}
327 #define CRYPTO_EXECUTE_1(crypto, a1) { \
328 crypto->SEQ0 = a1 | (CRYPTO_CMD_INSTR_EXEC<<8); }
329 #define CRYPTO_EXECUTE_2(crypto, a1, a2) { \
330 crypto->SEQ0 = a1 | (a2<<8) | (CRYPTO_CMD_INSTR_EXEC<<16); }
331 #define CRYPTO_EXECUTE_3(crypto, a1, a2, a3) { \
332 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (CRYPTO_CMD_INSTR_EXEC<<24); }
333 #define CRYPTO_EXECUTE_4(crypto, a1, a2, a3, a4) { \
334 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
335 crypto->SEQ1 = CRYPTO_CMD_INSTR_EXEC; }
336 #define CRYPTO_EXECUTE_5(crypto, a1, a2, a3, a4, a5) { \
337 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
338 crypto->SEQ1 = a5 | (CRYPTO_CMD_INSTR_EXEC<<8); }
339 #define CRYPTO_EXECUTE_6(crypto, a1, a2, a3, a4, a5, a6) { \
340 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
341 crypto->SEQ1 = a5 | (a6<<8) | (CRYPTO_CMD_INSTR_EXEC<<16); }
342 #define CRYPTO_EXECUTE_7(crypto, a1, a2, a3, a4, a5, a6, a7) { \
343 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
344 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (CRYPTO_CMD_INSTR_EXEC<<24); }
345 #define CRYPTO_EXECUTE_8(crypto, a1, a2, a3, a4, a5, a6, a7, a8) { \
346 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
347 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
348 crypto->SEQ2 = CRYPTO_CMD_INSTR_EXEC; }
349 #define CRYPTO_EXECUTE_9(crypto, a1, a2, a3, a4, a5, a6, a7, a8, a9) { \
350 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
351 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
352 crypto->SEQ2 = a9 | (CRYPTO_CMD_INSTR_EXEC<<8); }
353 #define CRYPTO_EXECUTE_10(crypto, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) { \
354 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
355 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
356 crypto->SEQ2 = a9 | (a10<<8) | (CRYPTO_CMD_INSTR_EXEC<<16); }
357 #define CRYPTO_EXECUTE_11(crypto, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) { \
358 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
359 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
360 crypto->SEQ2 = a9 | (a10<<8) | (a11<<16) | (CRYPTO_CMD_INSTR_EXEC<<24); }
361 #define CRYPTO_EXECUTE_12(crypto, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) { \
362 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
363 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
364 crypto->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
365 crypto->SEQ3 = CRYPTO_CMD_INSTR_EXEC; }
366 #define CRYPTO_EXECUTE_13(crypto, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) { \
367 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
368 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
369 crypto->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
370 crypto->SEQ3 = a13 | (CRYPTO_CMD_INSTR_EXEC<<8); }
371 #define CRYPTO_EXECUTE_14(crypto, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) { \
372 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
373 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
374 crypto->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
375 crypto->SEQ3 = a13 | (a14<<8) | (CRYPTO_CMD_INSTR_EXEC<<16); }
376 #define CRYPTO_EXECUTE_15(crypto, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) { \
377 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
378 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
379 crypto->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
380 crypto->SEQ3 = a13 | (a14<<8) | (a15<<16) | (CRYPTO_CMD_INSTR_EXEC<<24); }
381 #define CRYPTO_EXECUTE_16(crypto, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) { \
382 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
383 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
384 crypto->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
385 crypto->SEQ3 = a13 | (a14<<8) | (a15<<16) | (a16<<24); \
386 crypto->SEQ4 = CRYPTO_CMD_INSTR_EXEC; }
387 #define CRYPTO_EXECUTE_17(crypto, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) { \
388 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
389 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
390 crypto->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
391 crypto->SEQ3 = a13 | (a14<<8) | (a15<<16) | (a16<<24); \
392 crypto->SEQ4 = a17 | (CRYPTO_CMD_INSTR_EXEC<<8); }
393 #define CRYPTO_EXECUTE_18(crypto, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18) { \
394 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
395 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
396 crypto->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
397 crypto->SEQ3 = a13 | (a14<<8) | (a15<<16) | (a16<<24); \
398 crypto->SEQ4 = a17 | (a18<<8) | (CRYPTO_CMD_INSTR_EXEC<<16); }
399 #define CRYPTO_EXECUTE_19(crypto, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19) { \
400 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
401 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
402 crypto->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
403 crypto->SEQ3 = a13 | (a14<<8) | (a15<<16) | (a16<<24); \
404 crypto->SEQ4 = a17 | (a18<<8) | (a19<<16) | (CRYPTO_CMD_INSTR_EXEC<<24); }
405 #define CRYPTO_EXECUTE_20(crypto, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) { \
406 crypto->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
407 crypto->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
408 crypto->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
409 crypto->SEQ3 = a13 | (a14<<8) | (a15<<16) | (a16<<24); \
410 crypto->SEQ4 = a17 | (a18<<8) | (a19<<16) | (a20<<24); \
411 CRYPTO_InstructionSequenceExecute();}
433 typedef uint32_t* CRYPTO_DDataPtr_TypeDef;
537 #define CRYPTO_MAX_SEQUENCE_INSTRUCTIONS (20)
552 #define CRYPTO_INSTRUCTIONSEQUENSE_DEFAULT \
553 {CRYPTO_CMD_INSTR_END, CRYPTO_CMD_INSTR_END, CRYPTO_CMD_INSTR_END, \
554 CRYPTO_CMD_INSTR_END, CRYPTO_CMD_INSTR_END, CRYPTO_CMD_INSTR_END, \
555 CRYPTO_CMD_INSTR_END, CRYPTO_CMD_INSTR_END, CRYPTO_CMD_INSTR_END, \
556 CRYPTO_CMD_INSTR_END, CRYPTO_CMD_INSTR_END, CRYPTO_CMD_INSTR_END, \
557 CRYPTO_CMD_INSTR_END, CRYPTO_CMD_INSTR_END, CRYPTO_CMD_INSTR_END, \
558 CRYPTO_CMD_INSTR_END, CRYPTO_CMD_INSTR_END, CRYPTO_CMD_INSTR_END, \
559 CRYPTO_CMD_INSTR_END, CRYPTO_CMD_INSTR_END}
620 crypto->
WAC = temp | mulOperandWidth;
641 crypto->
WAC = temp | resultWidth;
662 crypto->
CTRL = temp | incWidth;
683 const uint32_t * val)
686 register uint32_t v0 = val[0];
687 register uint32_t v1 = val[1];
688 register uint32_t v2 = val[2];
689 register uint32_t v3 = val[3];
717 register uint32_t v0 = *reg;
718 register uint32_t v1 = *reg;
719 register uint32_t v2 = *reg;
720 register uint32_t v3 = *reg;
741 const CRYPTO_Data_TypeDef val)
759 CRYPTO_Data_TypeDef val)
777 const CRYPTO_DData_TypeDef val)
796 CRYPTO_DData_TypeDef val)
815 CRYPTO_QData_TypeDef val)
836 CRYPTO_QData_TypeDef val)
861 CRYPTO_KeyBuf_TypeDef val,
880 CRYPTO_KeyBuf_TypeDef val,
897 const uint32_t * val)
958 CRYPTO_Data260_TypeDef val)
982 const CRYPTO_Data260_TypeDef val)
1028 const CRYPTO_InstructionSequence_TypeDef instructionSequence)
1030 const uint32_t * pas = (
const uint32_t *) instructionSequence;
1032 crypto->
SEQ0 = pas[0];
1033 crypto->
SEQ1 = pas[1];
1034 crypto->
SEQ2 = pas[2];
1035 crypto->
SEQ3 = pas[3];
1036 crypto->
SEQ4 = pas[4];
1115 CRYPTO_SHA1_Digest_TypeDef digest);
1120 CRYPTO_SHA256_Digest_TypeDef digest);
1123 uint32_t * A,
int aSize,
1124 uint32_t * B,
int bSize,
1125 uint32_t * R,
int rSize);
1131 const uint8_t * key,
1139 const uint8_t * key,
1147 const uint8_t * key,
1155 const uint8_t * key,
1163 const uint8_t * key,
1171 const uint8_t * key,
1183 const uint8_t * key,
1190 const uint8_t * key,
1197 const uint8_t * key,
1198 const uint8_t * iv);
1204 const uint8_t * key,
1205 const uint8_t * iv);
1220 crypto->
IFC = flags;
1236 crypto->
IEN &= ~(flags);
1257 crypto->
IEN |= flags;
1305 return crypto->
IF & tmp;
1321 crypto->
IFS = flags;
1341 const uint8_t * key,
1360 const uint8_t * key,
1378 const uint8_t * key,
1396 const uint8_t * key,
1414 const uint8_t * key,
1432 const uint8_t * key,
1492 const uint8_t * key,
1510 const uint8_t * key,
1527 const uint8_t * key,
1544 const uint8_t * key,
#define CRYPTO_WAC_MODULUS_ECCBIN163P
void CRYPTO_AES_OFB128(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, const uint8_t *iv)
AES Output feedback (OFB) cipher mode encryption/decryption, 128 bit key.
#define _CRYPTO_DSTATUS_CARRY_MASK
__STATIC_INLINE void CRYPTO_DData0Read260(CRYPTO_TypeDef *crypto, CRYPTO_Data260_TypeDef val)
Read 260 bits from the DDATA0 register.
#define CRYPTO_WAC_MODULUS_ECCPRIME256P
__STATIC_INLINE void CRYPTO_InstructionSequenceExecute(CRYPTO_TypeDef *crypto)
Execute the current programmed instruction sequence.
uint32_t CRYPTO_QData_TypeDef[CRYPTO_QDATA_SIZE_IN_32BIT_WORDS]
#define CRYPTO_WAC_RESULTWIDTH_260BIT
void CRYPTO_ModulusSet(CRYPTO_TypeDef *crypto, CRYPTO_ModulusId_TypeDef modType)
Set the modulus type used for wide arithmetic operations.
__STATIC_INLINE void CRYPTO_DataRead(CRYPTO_DataReg_TypeDef dataReg, CRYPTO_Data_TypeDef val)
Read 128 bits of data from a DATAX register in the CRYPTO module.
__STATIC_INLINE void CRYPTO_DData0Write260(CRYPTO_TypeDef *crypto, const CRYPTO_Data260_TypeDef val)
Write 260 bits to the DDATA0 register.
#define CRYPTO_STATUS_INSTRRUNNING
void CRYPTO_AES_CTRUpdate32Bit(uint8_t *ctr)
Update last 32 bits of 128 bit counter, by incrementing with 1.
#define _CRYPTO_DSTATUS_DDATA0MSBS_SHIFT
__STATIC_INLINE bool CRYPTO_InstructionSequenceDone(CRYPTO_TypeDef *crypto)
Check whether the execution of an instruction sequence has completed.
RAM and peripheral bit-field set and clear API.
__STATIC_INLINE void CRYPTO_InstructionSequenceLoad(CRYPTO_TypeDef *crypto, const CRYPTO_InstructionSequence_TypeDef instructionSequence)
Load a sequence of instructions to be executed on the current values in the data registers.
#define CRYPTO_WAC_MODULUS_ECCBIN233P
__STATIC_INLINE void CRYPTO_InstructionSequenceWait(CRYPTO_TypeDef *crypto)
Wait for completion of the current sequence of instructions.
#define CRYPTO_WAC_RESULTWIDTH_256BIT
#define _CRYPTO_CTRL_AES_AES128
#define CRYPTO_WAC_MODULUS_ECCPRIME224N
#define _CRYPTO_DSTATUS_DDATA1MSB_MASK
#define CRYPTO_WAC_MODULUS_ECCPRIME192N
void CRYPTO_AES_OFB256(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, const uint8_t *iv)
AES Output feedback (OFB) cipher mode encryption/decryption, 256 bit key.
#define CRYPTO_WAC_MODULUS_BIN256
__STATIC_INLINE void AES_CTR256(uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, uint8_t *ctr, CRYPTO_AES_CtrFuncPtr_TypeDef ctrFunc)
AES Counter (CTR) cipher mode encryption/decryption, 256 bit key.
__STATIC_INLINE bool CRYPTO_CarryIsSet(CRYPTO_TypeDef *crypto)
Quick read access of the Carry bit from arithmetic operations.
void CRYPTO_AES_CTR256(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, uint8_t *ctr, CRYPTO_AES_CtrFuncPtr_TypeDef ctrFunc)
AES Counter (CTR) cipher mode encryption/decryption, 256 bit key.
#define CRYPTO_CTRL_INCWIDTH_INCWIDTH2
#define CRYPTO_WAC_MODULUS_ECCPRIME192P
#define _CRYPTO_DSTATUS_CARRY_SHIFT
uint32_t CRYPTO_Data_TypeDef[CRYPTO_DATA_SIZE_IN_32BIT_WORDS]
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
void CRYPTO_AES_CBC128(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, const uint8_t *iv, bool encrypt)
AES Cipher-block chaining (CBC) cipher mode encryption/decryption, 128 bit key.
#define CRYPTO_IF_INSTRDONE
void CRYPTO_AES_CTR128(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, uint8_t *ctr, CRYPTO_AES_CtrFuncPtr_TypeDef ctrFunc)
AES Counter (CTR) cipher mode encryption/decryption, 128 bit key.
__STATIC_INLINE void AES_ECB128(uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, bool encrypt)
AES Electronic Codebook (ECB) cipher mode encryption/decryption, 128 bit key.
__STATIC_INLINE void CRYPTO_MulOperandWidthSet(CRYPTO_TypeDef *crypto, CRYPTO_MulOperandWidth_TypeDef mulOperandWidth)
Set the number of bits in the operands of the MUL instruction.
CRYPTO_MulOperandWidth_TypeDef
volatile uint32_t * CRYPTO_DataReg_TypeDef
__STATIC_INLINE void CRYPTO_ResultWidthSet(CRYPTO_TypeDef *crypto, CRYPTO_ResultWidth_TypeDef resultWidth)
Set the width of the results of the non-modulus instructions.
uint32_t CRYPTO_Data260_TypeDef[CRYPTO_DATA260_SIZE_IN_32BIT_WORDS]
__STATIC_INLINE void AES_CFB256(uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, const uint8_t *iv, bool encrypt)
AES Cipher feedback (CFB) cipher mode encryption/decryption, 256 bit key.
__STATIC_INLINE void CRYPTO_QDataWrite(CRYPTO_QDataReg_TypeDef qdataReg, CRYPTO_QData_TypeDef val)
Write 512 bits of data to a QDATAX register in the CRYPTO module.
#define _CRYPTO_CTRL_INCWIDTH_MASK
__STATIC_INLINE uint32_t CRYPTO_IntGetEnabled(CRYPTO_TypeDef *crypto)
Get enabled and pending CRYPTO interrupt flags. Useful for handling more interrupt sources in the sam...
#define CRYPTO_CTRL_INCWIDTH_INCWIDTH3
__STATIC_INLINE void CRYPTO_IntSet(CRYPTO_TypeDef *crypto, uint32_t flags)
Set one or more pending CRYPTO interrupts from SW.
#define CRYPTO_WAC_MODULUS_ECCBIN163N
void CRYPTO_AES_DecryptKey128(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in)
Generate 128 bit AES decryption key from 128 bit encryption key. The decryption key is used for some ...
#define _CRYPTO_WAC_RESULTWIDTH_MASK
void CRYPTO_SHA_256(CRYPTO_TypeDef *crypto, const uint8_t *msg, uint64_t msgLen, CRYPTO_SHA256_Digest_TypeDef digest)
Perform a SHA-256 hash operation on a message.
void CRYPTO_AES_ECB256(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, bool encrypt)
AES Electronic Codebook (ECB) cipher mode encryption/decryption, 256 bit key.
#define CRYPTO_WAC_MODULUS_GCMBIN128
#define CRYPTO_WAC_MODULUS_ECCPRIME256N
__STATIC_INLINE void CRYPTO_KeyBufWrite(CRYPTO_TypeDef *crypto, CRYPTO_KeyBuf_TypeDef val, CRYPTO_KeyWidth_TypeDef keyWidth)
Set the key value to be used by the CRYPTO module.
__STATIC_INLINE void CRYPTO_BurstFromCrypto(volatile uint32_t *reg, uint32_t *val)
Read a 128 bit value from a crypto register.
#define _CRYPTO_WAC_MULWIDTH_MASK
__STATIC_INLINE void CRYPTO_IntClear(CRYPTO_TypeDef *crypto, uint32_t flags)
Clear one or more pending CRYPTO interrupts.
__STATIC_INLINE void CRYPTO_DDataRead(CRYPTO_DDataReg_TypeDef ddataReg, CRYPTO_DData_TypeDef val)
Read 256 bits of data from a DDATAX register in the CRYPTO module.
__STATIC_INLINE void CRYPTO_QDataRead(CRYPTO_QDataReg_TypeDef qdataReg, CRYPTO_QData_TypeDef val)
Read 512 bits of data from a QDATAX register in the CRYPTO module.
#define CRYPTO_WAC_RESULTWIDTH_128BIT
uint32_t CRYPTO_DData_TypeDef[CRYPTO_DDATA_SIZE_IN_32BIT_WORDS]
__STATIC_INLINE void AES_CFB128(uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, const uint8_t *iv, bool encrypt)
AES Cipher feedback (CFB) cipher mode encryption/decryption, 128 bit key.
__STATIC_INLINE void AES_CBC128(uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, const uint8_t *iv, bool encrypt)
AES Cipher-block chaining (CBC) cipher mode encryption/decryption, 128 bit key.
__STATIC_INLINE void CRYPTO_IntEnable(CRYPTO_TypeDef *crypto, uint32_t flags)
Enable one or more CRYPTO interrupts.
__STATIC_INLINE void AES_OFB256(uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, const uint8_t *iv)
AES Output feedback (OFB) cipher mode encryption/decryption, 256 bit key.
void CRYPTO_AES_ECB128(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, bool encrypt)
AES Electronic Codebook (ECB) cipher mode encryption/decryption, 128 bit key.
#define CRYPTO_MAX_SEQUENCE_INSTRUCTIONS
#define CRYPTO_WAC_MODULUS_ECCBIN163KN
__STATIC_INLINE void AES_OFB128(uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, const uint8_t *iv)
AES Output feedback (OFB) cipher mode encryption/decryption, 128 bit key.
__STATIC_INLINE void CRYPTO_DataWrite(CRYPTO_DataReg_TypeDef dataReg, const CRYPTO_Data_TypeDef val)
Write 128 bits of data to a DATAX register in the CRYPTO module.
__STATIC_INLINE void CRYPTO_InstructionWait(CRYPTO_TypeDef *crypto)
Wait for completion of the current command.
void CRYPTO_KeyRead(CRYPTO_TypeDef *crypto, CRYPTO_KeyBuf_TypeDef val, CRYPTO_KeyWidth_TypeDef keyWidth)
Read the key value currently used by the CRYPTO module.
uint8_t CRYPTO_SHA1_Digest_TypeDef[CRYPTO_SHA1_DIGEST_SIZE_IN_BYTES]
__STATIC_INLINE void AES_CTRUpdate32Bit(uint8_t *ctr)
Update last 32 bits of 128 bit counter, by incrementing with 1.
__IOM uint32_t DDATA0BYTE32
void CRYPTO_Mul(CRYPTO_TypeDef *crypto, uint32_t *A, int aSize, uint32_t *B, int bSize, uint32_t *R, int rSize)
Multiply two big integers.
#define _CRYPTO_DSTATUS_DDATA0MSBS_MASK
#define CRYPTO_WAC_MULWIDTH_MUL256
#define _CRYPTO_CTRL_AES_AES256
#define _CRYPTO_DSTATUS_DDATA0LSBS_SHIFT
__STATIC_INLINE void CRYPTO_KeyBuf128Write(CRYPTO_TypeDef *crypto, const uint32_t *val)
Quick write 128 bit key to the CRYPTO module.
#define CRYPTO_WAC_MODULUS_BIN128
void CRYPTO_AES_CFB128(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, const uint8_t *iv, bool encrypt)
AES Cipher feedback (CFB) cipher mode encryption/decryption, 128 bit key.
#define _CRYPTO_DSTATUS_DDATA1MSB_SHIFT
#define CRYPTO_CTRL_INCWIDTH_INCWIDTH1
#define CRYPTO_CMD_SEQSTART
#define _CRYPTO_CTRL_AES_SHIFT
volatile uint32_t * CRYPTO_QDataReg_TypeDef
__STATIC_INLINE void CRYPTO_IntDisable(CRYPTO_TypeDef *crypto, uint32_t flags)
Disable one or more CRYPTO interrupts.
volatile uint32_t * CRYPTO_DDataReg_TypeDef
uint8_t CRYPTO_InstructionSequence_TypeDef[CRYPTO_MAX_SEQUENCE_INSTRUCTIONS]
void(* CRYPTO_AES_CtrFuncPtr_TypeDef)(uint8_t *ctr)
AES counter modification function pointer.
__STATIC_INLINE void CRYPTO_BurstToCrypto(volatile uint32_t *reg, const uint32_t *val)
Write a 128 bit value into a crypto register.
#define CRYPTO_STATUS_SEQRUNNING
uint32_t CRYPTO_KeyBuf_TypeDef[CRYPTO_KEYBUF_SIZE_IN_32BIT_WORDS]
#define CRYPTO_WAC_MULWIDTH_MULMOD
#define _CRYPTO_DSTATUS_DDATA0LSBS_MASK
#define _CRYPTO_DDATA0BYTE32_DDATA0BYTE32_MASK
__STATIC_INLINE void AES_ECB256(uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, bool encrypt)
AES Electronic Codebook (ECB) cipher mode encryption/decryption, 256 bit key.
__STATIC_INLINE void CRYPTO_DDataWrite(CRYPTO_DDataReg_TypeDef ddataReg, const CRYPTO_DData_TypeDef val)
Write 256 bits of data to a DDATAX register in the CRYPTO module.
__STATIC_INLINE void CRYPTO_IncWidthSet(CRYPTO_TypeDef *crypto, CRYPTO_IncWidth_TypeDef incWidth)
Set the width of the DATA1 increment instruction DATA1INC.
#define CRYPTO_WAC_MULWIDTH_MUL128
__STATIC_INLINE void AES_DecryptKey128(uint8_t *out, const uint8_t *in)
Generate 128 bit AES decryption key from 128 bit encryption key. The decryption key is used for some ...
void CRYPTO_AES_CFB256(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, const uint8_t *iv, bool encrypt)
AES Cipher feedback (CFB) cipher mode encryption/decryption, 256 bit key.
__STATIC_INLINE uint8_t CRYPTO_DData0_4LSBitsRead(CRYPTO_TypeDef *crypto)
Quick read access of the 4 LSbits of the DDATA0 register.
#define CRYPTO_WAC_MODULUS_ECCBIN233KN
__STATIC_INLINE void AES_DecryptKey256(uint8_t *out, const uint8_t *in)
Generate 256 bit AES decryption key from 256 bit encryption key. The decryption key is used for some ...
__STATIC_INLINE void BUS_RegBitWrite(volatile uint32_t *addr, unsigned int bit, unsigned int val)
Perform a single-bit write operation on a peripheral register.
void CRYPTO_AES_DecryptKey256(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in)
Generate 256 bit AES decryption key from 256 bit encryption key. The decryption key is used for some ...
__STATIC_INLINE uint32_t CRYPTO_IntGet(CRYPTO_TypeDef *crypto)
Get pending CRYPTO interrupt flags.
CRYPTO_ResultWidth_TypeDef
__STATIC_INLINE void AES_CTR128(uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, uint8_t *ctr, CRYPTO_AES_CtrFuncPtr_TypeDef ctrFunc)
AES Counter (CTR) cipher mode encryption/decryption, 128 bit key.
uint8_t CRYPTO_SHA256_Digest_TypeDef[CRYPTO_SHA256_DIGEST_SIZE_IN_BYTES]
void CRYPTO_AES_CBC256(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, const uint8_t *iv, bool encrypt)
AES Cipher-block chaining (CBC) cipher mode encryption/decryption, 256 bit key.
__STATIC_INLINE bool CRYPTO_DData1_MSBitRead(CRYPTO_TypeDef *crypto)
Quick read the MSbit of the DDATA1 register.
#define CRYPTO_WAC_MODULUS_ECCPRIME224P
#define CRYPTO_CTRL_INCWIDTH_INCWIDTH4
__STATIC_INLINE void AES_CBC256(uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, const uint8_t *iv, bool encrypt)
AES Cipher-block chaining (CBC) cipher mode encryption/decryption, 256 bit key.
void CRYPTO_SHA_1(CRYPTO_TypeDef *crypto, const uint8_t *msg, uint64_t msgLen, CRYPTO_SHA1_Digest_TypeDef digest)
Perform a SHA-1 hash operation on a message.
#define CRYPTO_WAC_MODULUS_ECCBIN233N