32 #ifndef __SILICON_LABS_EM_CRYPTO_H__
33 #define __SILICON_LABS_EM_CRYPTO_H__
37 #if defined(CRYPTO_COUNT) && (CRYPTO_COUNT > 0)
62 #define CRYPTO_DATA_SIZE_IN_BITS (128)
63 #define CRYPTO_DATA_SIZE_IN_BYTES (CRYPTO_DATA_SIZE_IN_BITS/8)
64 #define CRYPTO_DATA_SIZE_IN_32BIT_WORDS (CRYPTO_DATA_SIZE_IN_BYTES/sizeof(uint32_t))
66 #define CRYPTO_KEYBUF_SIZE_IN_BITS (256)
67 #define CRYPTO_KEYBUF_SIZE_IN_BYTES (CRYPTO_DDATA_SIZE_IN_BITS/8)
68 #define CRYPTO_KEYBUF_SIZE_IN_32BIT_WORDS (CRYPTO_DDATA_SIZE_IN_BYTES/sizeof(uint32_t))
70 #define CRYPTO_DDATA_SIZE_IN_BITS (256)
71 #define CRYPTO_DDATA_SIZE_IN_BYTES (CRYPTO_DDATA_SIZE_IN_BITS/8)
72 #define CRYPTO_DDATA_SIZE_IN_32BIT_WORDS (CRYPTO_DDATA_SIZE_IN_BYTES/sizeof(uint32_t))
74 #define CRYPTO_QDATA_SIZE_IN_BITS (512)
75 #define CRYPTO_QDATA_SIZE_IN_BYTES (CRYPTO_QDATA_SIZE_IN_BITS/8)
76 #define CRYPTO_QDATA_SIZE_IN_32BIT_WORDS (CRYPTO_QDATA_SIZE_IN_BYTES/sizeof(uint32_t))
78 #define CRYPTO_DATA260_SIZE_IN_32BIT_WORDS (9)
81 #define CRYPTO_SHA1_DIGEST_SIZE_IN_BITS (160)
82 #define CRYPTO_SHA1_DIGEST_SIZE_IN_BYTES (CRYPTO_SHA1_DIGEST_SIZE_IN_BITS/8)
85 #define CRYPTO_SHA256_DIGEST_SIZE_IN_BITS (256)
86 #define CRYPTO_SHA256_DIGEST_SIZE_IN_BYTES (CRYPTO_SHA256_DIGEST_SIZE_IN_BITS/8)
91 #define CRYPTO_DDATA0_260_BITS_READ(bigint260) CRYPTO_DData0Read260(bigint260)
92 #define CRYPTO_DDATA0_260_BITS_WRITE(bigint260) CRYPTO_DData0Write260(bigint260)
101 #define CRYPTO_SEQ_LOAD_1(a1) { \
102 CRYPTO->SEQ0 = a1 | (CRYPTO_CMD_INSTR_END<<8);}
103 #define CRYPTO_SEQ_LOAD_2(a1, a2) { \
104 CRYPTO->SEQ0 = a1 | (a2<<8) | (CRYPTO_CMD_INSTR_END<<16);}
105 #define CRYPTO_SEQ_LOAD_3(a1, a2, a3) { \
106 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (CRYPTO_CMD_INSTR_END<<24);}
107 #define CRYPTO_SEQ_LOAD_4(a1, a2, a3, a4) { \
108 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
109 CRYPTO->SEQ1 = CRYPTO_CMD_INSTR_END;}
110 #define CRYPTO_SEQ_LOAD_5(a1, a2, a3, a4, a5) { \
111 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
112 CRYPTO->SEQ1 = a5 | (CRYPTO_CMD_INSTR_END<<8);}
113 #define CRYPTO_SEQ_LOAD_6(a1, a2, a3, a4, a5, a6) { \
114 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
115 CRYPTO->SEQ1 = a5 | (a6<<8) | (CRYPTO_CMD_INSTR_END<<16);}
116 #define CRYPTO_SEQ_LOAD_7(a1, a2, a3, a4, a5, a6, a7) { \
117 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
118 CRYPTO->SEQ1 = a5 | (a6<<8) | (a7<<16) | (CRYPTO_CMD_INSTR_END<<24);}
119 #define CRYPTO_SEQ_LOAD_8(a1, a2, a3, a4, a5, a6, a7, a8) { \
120 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
121 CRYPTO->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
122 CRYPTO->SEQ2 = CRYPTO_CMD_INSTR_END;}
123 #define CRYPTO_SEQ_LOAD_9(a1, a2, a3, a4, a5, a6, a7, a8, a9) { \
124 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
125 CRYPTO->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
126 CRYPTO->SEQ2 = a9 | (CRYPTO_CMD_INSTR_END<<8);}
127 #define CRYPTO_SEQ_LOAD_10(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) { \
128 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
129 CRYPTO->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
130 CRYPTO->SEQ2 = a9 | (a10<<8) | (CRYPTO_CMD_INSTR_END<<16);}
131 #define CRYPTO_SEQ_LOAD_11(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) { \
132 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
133 CRYPTO->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
134 CRYPTO->SEQ2 = a9 | (a10<<8) | (a11<<16) | (CRYPTO_CMD_INSTR_END<<24);}
135 #define CRYPTO_SEQ_LOAD_12(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) { \
136 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
137 CRYPTO->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
138 CRYPTO->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
139 CRYPTO->SEQ3 = CRYPTO_CMD_INSTR_END;}
140 #define CRYPTO_SEQ_LOAD_13(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) { \
141 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
142 CRYPTO->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
143 CRYPTO->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
144 CRYPTO->SEQ3 = a13 | (CRYPTO_CMD_INSTR_END<<8);}
145 #define CRYPTO_SEQ_LOAD_14(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) { \
146 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
147 CRYPTO->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
148 CRYPTO->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
149 CRYPTO->SEQ3 = a13 | (a14<<8) | (CRYPTO_CMD_INSTR_END<<16);}
150 #define CRYPTO_SEQ_LOAD_15(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) { \
151 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
152 CRYPTO->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
153 CRYPTO->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
154 CRYPTO->SEQ3 = a13 | (a14<<8) | (a15<<16) | (CRYPTO_CMD_INSTR_END<<24);}
155 #define CRYPTO_SEQ_LOAD_16(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) { \
156 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
157 CRYPTO->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
158 CRYPTO->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
159 CRYPTO->SEQ3 = a13 | (a14<<8) | (a15<<16) | (a16<<24); \
160 CRYPTO->SEQ4 = CRYPTO_CMD_INSTR_END;}
161 #define CRYPTO_SEQ_LOAD_17(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) { \
162 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
163 CRYPTO->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
164 CRYPTO->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
165 CRYPTO->SEQ3 = a13 | (a14<<8) | (a15<<16) | (a16<<24); \
166 CRYPTO->SEQ4 = a17 | (CRYPTO_CMD_INSTR_END<<8);}
167 #define CRYPTO_SEQ_LOAD_18(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18) { \
168 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
169 CRYPTO->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
170 CRYPTO->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
171 CRYPTO->SEQ3 = a13 | (a14<<8) | (a15<<16) | (a16<<24); \
172 CRYPTO->SEQ4 = a17 | (a18<<8) | (CRYPTO_CMD_INSTR_END<<16);}
173 #define CRYPTO_SEQ_LOAD_19(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19) { \
174 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
175 CRYPTO->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
176 CRYPTO->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
177 CRYPTO->SEQ3 = a13 | (a14<<8) | (a15<<16) | (a16<<24); \
178 CRYPTO->SEQ4 = a17 | (a18<<8) | (a19<<16) | (CRYPTO_CMD_INSTR_END<<24);}
179 #define CRYPTO_SEQ_LOAD_20(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) { \
180 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
181 CRYPTO->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
182 CRYPTO->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
183 CRYPTO->SEQ3 = a13 | (a14<<8) | (a15<<16) | (a16<<24); \
184 CRYPTO->SEQ4 = a17 | (a18<<8) | (a19<<16) | (a20<<24);}
193 #define CRYPTO_EXECUTE_1(a1) { \
194 CRYPTO->SEQ0 = a1 | (CRYPTO_CMD_INSTR_EXEC<<8); }
195 #define CRYPTO_EXECUTE_2(a1, a2) { \
196 CRYPTO->SEQ0 = a1 | (a2<<8) | (CRYPTO_CMD_INSTR_EXEC<<16); }
197 #define CRYPTO_EXECUTE_3(a1, a2, a3) { \
198 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (CRYPTO_CMD_INSTR_EXEC<<24); }
199 #define CRYPTO_EXECUTE_4(a1, a2, a3, a4) { \
200 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
201 CRYPTO->SEQ1 = CRYPTO_CMD_INSTR_EXEC; }
202 #define CRYPTO_EXECUTE_5(a1, a2, a3, a4, a5) { \
203 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
204 CRYPTO->SEQ1 = a5 | (CRYPTO_CMD_INSTR_EXEC<<8); }
205 #define CRYPTO_EXECUTE_6(a1, a2, a3, a4, a5, a6) { \
206 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
207 CRYPTO->SEQ1 = a5 | (a6<<8) | (CRYPTO_CMD_INSTR_EXEC<<16); }
208 #define CRYPTO_EXECUTE_7(a1, a2, a3, a4, a5, a6, a7) { \
209 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
210 CRYPTO->SEQ1 = a5 | (a6<<8) | (a7<<16) | (CRYPTO_CMD_INSTR_EXEC<<24); }
211 #define CRYPTO_EXECUTE_8(a1, a2, a3, a4, a5, a6, a7, a8) { \
212 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
213 CRYPTO->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
214 CRYPTO->SEQ2 = CRYPTO_CMD_INSTR_EXEC; }
215 #define CRYPTO_EXECUTE_9(a1, a2, a3, a4, a5, a6, a7, a8, a9) { \
216 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
217 CRYPTO->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
218 CRYPTO->SEQ2 = a9 | (CRYPTO_CMD_INSTR_EXEC<<8); }
219 #define CRYPTO_EXECUTE_10(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) { \
220 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
221 CRYPTO->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
222 CRYPTO->SEQ2 = a9 | (a10<<8) | (CRYPTO_CMD_INSTR_EXEC<<16); }
223 #define CRYPTO_EXECUTE_11(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) { \
224 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
225 CRYPTO->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
226 CRYPTO->SEQ2 = a9 | (a10<<8) | (a11<<16) | (CRYPTO_CMD_INSTR_EXEC<<24); }
227 #define CRYPTO_EXECUTE_12(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) { \
228 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
229 CRYPTO->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
230 CRYPTO->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
231 CRYPTO->SEQ3 = CRYPTO_CMD_INSTR_EXEC; }
232 #define CRYPTO_EXECUTE_13(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) { \
233 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
234 CRYPTO->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
235 CRYPTO->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
236 CRYPTO->SEQ3 = a13 | (CRYPTO_CMD_INSTR_EXEC<<8); }
237 #define CRYPTO_EXECUTE_14(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) { \
238 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
239 CRYPTO->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
240 CRYPTO->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
241 CRYPTO->SEQ3 = a13 | (a14<<8) | (CRYPTO_CMD_INSTR_EXEC<<16); }
242 #define CRYPTO_EXECUTE_15(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) { \
243 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
244 CRYPTO->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
245 CRYPTO->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
246 CRYPTO->SEQ3 = a13 | (a14<<8) | (a15<<16) | (CRYPTO_CMD_INSTR_EXEC<<24); }
247 #define CRYPTO_EXECUTE_16(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) { \
248 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
249 CRYPTO->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
250 CRYPTO->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
251 CRYPTO->SEQ3 = a13 | (a14<<8) | (a15<<16) | (a16<<24); \
252 CRYPTO->SEQ4 = CRYPTO_CMD_INSTR_EXEC; }
253 #define CRYPTO_EXECUTE_17(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) { \
254 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
255 CRYPTO->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
256 CRYPTO->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
257 CRYPTO->SEQ3 = a13 | (a14<<8) | (a15<<16) | (a16<<24); \
258 CRYPTO->SEQ4 = a17 | (CRYPTO_CMD_INSTR_EXEC<<8); }
259 #define CRYPTO_EXECUTE_18(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18) { \
260 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
261 CRYPTO->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
262 CRYPTO->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
263 CRYPTO->SEQ3 = a13 | (a14<<8) | (a15<<16) | (a16<<24); \
264 CRYPTO->SEQ4 = a17 | (a18<<8) | (CRYPTO_CMD_INSTR_EXEC<<16); }
265 #define CRYPTO_EXECUTE_19(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19) { \
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) | (a12<<24); \
269 CRYPTO->SEQ3 = a13 | (a14<<8) | (a15<<16) | (a16<<24); \
270 CRYPTO->SEQ4 = a17 | (a18<<8) | (a19<<16) | (CRYPTO_CMD_INSTR_EXEC<<24); }
271 #define CRYPTO_EXECUTE_20(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) { \
272 CRYPTO->SEQ0 = a1 | (a2<<8) | (a3<<16) | (a4<<24); \
273 CRYPTO->SEQ1 = a5 | (a6<<8) | (a7<<16) | (a8<<24); \
274 CRYPTO->SEQ2 = a9 | (a10<<8) | (a11<<16) | (a12<<24); \
275 CRYPTO->SEQ3 = a13 | (a14<<8) | (a15<<16) | (a16<<24); \
276 CRYPTO->SEQ4 = a17 | (a18<<8) | (a19<<16) | (a20<<24); \
277 CRYPTO_InstructionSequenceExecute();}
299 typedef uint32_t* CRYPTO_DDataPtr_TypeDef;
423 #define CRYPTO_MAX_SEQUENCE_INSTRUCTIONS (20)
438 #define CRYPTO_INSTRUCTIONSEQUENSE_DEFAULT \
439 {CRYPTO_CMD_INSTR_END, CRYPTO_CMD_INSTR_END, CRYPTO_CMD_INSTR_END, \
440 CRYPTO_CMD_INSTR_END, CRYPTO_CMD_INSTR_END, CRYPTO_CMD_INSTR_END, \
441 CRYPTO_CMD_INSTR_END, CRYPTO_CMD_INSTR_END, CRYPTO_CMD_INSTR_END, \
442 CRYPTO_CMD_INSTR_END, CRYPTO_CMD_INSTR_END, CRYPTO_CMD_INSTR_END, \
443 CRYPTO_CMD_INSTR_END, CRYPTO_CMD_INSTR_END, CRYPTO_CMD_INSTR_END, \
444 CRYPTO_CMD_INSTR_END, CRYPTO_CMD_INSTR_END, CRYPTO_CMD_INSTR_END, \
445 CRYPTO_CMD_INSTR_END, CRYPTO_CMD_INSTR_END}
495 CRYPTO->WAC = temp | mulOperandWidth;
510 CRYPTO->WAC = temp | resultWidth;
526 CRYPTO->CTRL = temp | incWidth;
549 register uint32_t v0 = val[0];
550 register uint32_t v1 = val[1];
551 register uint32_t v2 = val[2];
552 register uint32_t v3 = val[3];
580 register uint32_t v0 = *reg;
581 register uint32_t v1 = *reg;
582 register uint32_t v2 = *reg;
583 register uint32_t v3 = *reg;
604 const CRYPTO_Data_TypeDef val)
622 CRYPTO_Data_TypeDef val)
640 const CRYPTO_DData_TypeDef val)
659 CRYPTO_DData_TypeDef val)
678 CRYPTO_QData_TypeDef val)
699 CRYPTO_QData_TypeDef val)
855 const uint32_t * pas = (
const uint32_t *) instructionSequence;
927 CRYPTO_SHA1_Digest_TypeDef digest);
931 CRYPTO_SHA256_Digest_TypeDef digest);
934 uint32_t * B,
int bSize,
935 uint32_t * R,
int rSize);
1004 const uint8_t * key,
1005 const uint8_t * iv);
1116 const uint8_t * key,
1135 const uint8_t * key,
1153 const uint8_t * key,
1171 const uint8_t * key,
1189 const uint8_t * key,
1207 const uint8_t * key,
1267 const uint8_t * key,
1285 const uint8_t * key,
1302 const uint8_t * key,
1319 const uint8_t * key,
#define CRYPTO_WAC_MODULUS_ECCPRIME256N
#define CRYPTO_WAC_MODULUS_ECCBIN163N
__STATIC_INLINE uint8_t CRYPTO_DData0_4LSBitsRead(void)
Quick read access of the 4 LSbits of the DDATA0 register.
#define CRYPTO_WAC_RESULTWIDTH_128BIT
#define CRYPTO_WAC_RESULTWIDTH_256BIT
void CRYPTO_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.
void CRYPTO_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.
uint32_t CRYPTO_QData_TypeDef[CRYPTO_QDATA_SIZE_IN_32BIT_WORDS]
#define CRYPTO_WAC_MODULUS_ECCPRIME192N
__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.
#define CRYPTO_CTRL_INCWIDTH_INCWIDTH3
#define CRYPTO_WAC_RESULTWIDTH_260BIT
void CRYPTO_AES_CTRUpdate32Bit(uint8_t *ctr)
Update last 32 bits of 128 bit counter, by incrementing with 1.
__STATIC_INLINE void CRYPTO_IntSet(uint32_t flags)
Set one or more pending CRYPTO interrupts from SW.
__STATIC_INLINE void CRYPTO_IntEnable(uint32_t flags)
Enable one or more CRYPTO interrupts.
RAM and peripheral bit-field set and clear API.
#define _CRYPTO_DSTATUS_CARRY_SHIFT
#define CRYPTO_WAC_MULWIDTH_MUL256
#define CRYPTO_WAC_MODULUS_ECCPRIME224N
#define _CRYPTO_DSTATUS_DDATA1MSB_SHIFT
#define CRYPTO_CTRL_INCWIDTH_INCWIDTH1
#define CRYPTO_WAC_MODULUS_BIN128
__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_DData1_MSBitRead(void)
Quick read the MSbit of the DDATA1 register.
#define _CRYPTO_WAC_RESULTWIDTH_MASK
#define _CRYPTO_CTRL_INCWIDTH_MASK
__STATIC_INLINE void CRYPTO_InstructionSequenceLoad(const CRYPTO_InstructionSequence_TypeDef instructionSequence)
Load a sequence of instructions to be executed on the current values in the data registers.
uint32_t CRYPTO_Data_TypeDef[CRYPTO_DATA_SIZE_IN_32BIT_WORDS]
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
#define CRYPTO_CMD_SEQSTART
void CRYPTO_ModulusSet(CRYPTO_ModulusType_TypeDef modType)
Set the modulus type used for wide arithmetic operations.
__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 uint32_t CRYPTO_IntGet(void)
Get pending CRYPTO interrupt flags.
void CRYPTO_KeyRead(CRYPTO_KeyBuf_TypeDef val, CRYPTO_KeyWidth_TypeDef keyWidth)
Read the key value currently used by the CRYPTO module.
CRYPTO_MulOperandWidth_TypeDef
#define CRYPTO_IF_INSTRDONE
void CRYPTO_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.
uint32_t CRYPTO_Data260_TypeDef[CRYPTO_DATA260_SIZE_IN_32BIT_WORDS]
#define _CRYPTO_WAC_MULWIDTH_MASK
__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_WAC_MODULUS_BIN256
__STATIC_INLINE bool CRYPTO_InstructionSequenceDone(void)
Check whether the execution of an instruction sequence has completed.
#define _CRYPTO_DSTATUS_DDATA0MSBS_SHIFT
CRYPTO_ModulusType_TypeDef
__STATIC_INLINE void CRYPTO_IntClear(uint32_t flags)
Clear one or more pending CRYPTO interrupts.
void CRYPTO_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_InstructionWait(void)
Wait for completion of the current command.
__STATIC_INLINE void CRYPTO_BurstFromCrypto(volatile uint32_t *reg, uint32_t *val)
Read a 128 bit value from a crypto register.
__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.
uint32_t CRYPTO_DData_TypeDef[CRYPTO_DDATA_SIZE_IN_32BIT_WORDS]
__STATIC_INLINE void CRYPTO_DData0Write260(const CRYPTO_Data260_TypeDef val)
Write 260 bits to the DDATA0 register.
void CRYPTO_SHA_256(const uint8_t *msg, uint64_t msgLen, CRYPTO_SHA256_Digest_TypeDef digest)
Perform a SHA-256 hash operation on a message.
__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.
void CRYPTO_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 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.
#define CRYPTO_STATUS_INSTRRUNNING
#define _CRYPTO_DSTATUS_DDATA0LSBS_SHIFT
__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.
#define CRYPTO_MAX_SEQUENCE_INSTRUCTIONS
#define CRYPTO_CTRL_INCWIDTH_INCWIDTH2
__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_IncWidthSet(CRYPTO_IncWidth_TypeDef incWidth)
Set the width of the DATA1 increment instruction DATA1INC.
__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.
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.
#define CRYPTO_WAC_MODULUS_ECCBIN233KN
#define CRYPTO_WAC_MODULUS_ECCBIN163KN
#define CRYPTO_WAC_MODULUS_ECCPRIME192P
__STATIC_INLINE void CRYPTO_IntDisable(uint32_t flags)
Disable one or more CRYPTO interrupts.
__STATIC_INLINE void CRYPTO_InstructionSequenceWait(void)
Wait for completion of the current sequence of instructions.
__STATIC_INLINE void CRYPTO_MulOperandWidthSet(CRYPTO_MulOperandWidth_TypeDef mulOperandWidth)
Set the number of bits in the operands of the MUL instruction.
#define _CRYPTO_DDATA0BYTE32_DDATA0BYTE32_MASK
void CRYPTO_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.
#define CRYPTO_WAC_MODULUS_ECCPRIME256P
#define CRYPTO_WAC_MODULUS_ECCBIN233N
uint8_t CRYPTO_InstructionSequence_TypeDef[CRYPTO_MAX_SEQUENCE_INSTRUCTIONS]
__STATIC_INLINE void CRYPTO_KeyBufWrite(CRYPTO_KeyBuf_TypeDef val, CRYPTO_KeyWidth_TypeDef keyWidth)
Set the key value to be used by the CRYPTO module.
#define _CRYPTO_DSTATUS_DDATA0MSBS_MASK
void(* CRYPTO_AES_CtrFuncPtr_TypeDef)(uint8_t *ctr)
AES counter modification function pointer.
#define _CRYPTO_DSTATUS_CARRY_MASK
__STATIC_INLINE void CRYPTO_BurstToCrypto(volatile uint32_t *reg, const uint32_t *val)
Write a 128 bit value into a crypto register.
void CRYPTO_SHA_1(const uint8_t *msg, uint64_t msgLen, CRYPTO_SHA1_Digest_TypeDef digest)
Perform a SHA-1 hash operation on a message.
#define CRYPTO_WAC_MULWIDTH_MUL128
__STATIC_INLINE uint32_t CRYPTO_IntGetEnabled(void)
Get enabled and pending CRYPTO interrupt flags. Useful for handling more interrupt sources in the sam...
uint32_t CRYPTO_KeyBuf_TypeDef[CRYPTO_KEYBUF_SIZE_IN_32BIT_WORDS]
void CRYPTO_Mul(uint32_t *A, int aSize, uint32_t *B, int bSize, uint32_t *R, int rSize)
Multiply two big integers.
__STATIC_INLINE void CRYPTO_ResultWidthSet(CRYPTO_ResultWidth_TypeDef resultWidth)
Set the width of the results of the non-modulus instructions.
#define _CRYPTO_CTRL_AES_AES256
#define CRYPTO_STATUS_SEQRUNNING
#define _CRYPTO_CTRL_AES_SHIFT
#define CRYPTO_WAC_MODULUS_ECCBIN233P
#define CRYPTO_WAC_MODULUS_ECCPRIME224P
__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.
void CRYPTO_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.
#define CRYPTO_WAC_MODULUS_GCMBIN128
__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.
#define CRYPTO_WAC_MULWIDTH_MULMOD
__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 ...
__STATIC_INLINE bool CRYPTO_CarryIsSet(void)
Quick read access of the Carry bit from arithmetic operations.
#define CRYPTO_WAC_MODULUS_ECCBIN163P
void CRYPTO_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.
#define _CRYPTO_CTRL_AES_AES128
#define _CRYPTO_DSTATUS_DDATA1MSB_MASK
__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 ...
void CRYPTO_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.
__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.
#define _CRYPTO_DSTATUS_DDATA0LSBS_MASK
void CRYPTO_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.
CRYPTO_ResultWidth_TypeDef
__STATIC_INLINE void CRYPTO_InstructionSequenceExecute(void)
Execute the current programmed instruction sequence.
__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.
__STATIC_INLINE void CRYPTO_DData0Read260(CRYPTO_Data260_TypeDef val)
Read 260 bits from the DDATA0 register.
uint8_t CRYPTO_SHA256_Digest_TypeDef[CRYPTO_SHA256_DIGEST_SIZE_IN_BYTES]
void CRYPTO_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 ...
__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.
__STATIC_INLINE void CRYPTO_KeyBuf128Write(const uint32_t *val)
Quick write 128 bit key to the CRYPTO module.
#define CRYPTO_CTRL_INCWIDTH_INCWIDTH4
void CRYPTO_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.