@@ -55,35 +55,35 @@ struct ecb_param {
5555#endif /* NRF54L_SERIES */
5656} __packed ;
5757
58- static void do_ecb (struct ecb_param * ecb )
58+ static void do_ecb (struct ecb_param * ep )
5959{
6060 do {
6161 nrf_ecb_task_trigger (NRF_ECB , NRF_ECB_TASK_STOPECB );
6262
6363#if defined(NRF54L_SERIES )
64- NRF_ECB -> KEY .VALUE [3 ] = sys_get_be32 (& ecb -> key [0 ]);
65- NRF_ECB -> KEY .VALUE [2 ] = sys_get_be32 (& ecb -> key [4 ]);
66- NRF_ECB -> KEY .VALUE [1 ] = sys_get_be32 (& ecb -> key [8 ]);
67- NRF_ECB -> KEY .VALUE [0 ] = sys_get_be32 (& ecb -> key [12 ]);
68-
69- ecb -> in [0 ].ptr = ecb -> clear_text ;
70- ecb -> in [0 ].length = sizeof (ecb -> clear_text );
71- ecb -> in [0 ].attribute = ECB_JOB_PTR_ATTRIBUTE ;
72- ecb -> in [1 ].ptr = NULL ;
73- ecb -> in [1 ].length = 0U ;
74- ecb -> in [1 ].attribute = 0U ;
75-
76- ecb -> out [0 ].ptr = ecb -> cipher_text ;
77- ecb -> out [0 ].length = sizeof (ecb -> cipher_text );
78- ecb -> out [0 ].attribute = ECB_JOB_PTR_ATTRIBUTE ;
79- ecb -> out [1 ].ptr = NULL ;
80- ecb -> out [1 ].length = 0U ;
81- ecb -> out [1 ].attribute = 0U ;
82-
83- NRF_ECB -> IN .PTR = (uint32_t )ecb -> in ;
84- NRF_ECB -> OUT .PTR = (uint32_t )ecb -> out ;
64+ NRF_ECB -> KEY .VALUE [3 ] = sys_get_be32 (& ep -> key [0 ]);
65+ NRF_ECB -> KEY .VALUE [2 ] = sys_get_be32 (& ep -> key [4 ]);
66+ NRF_ECB -> KEY .VALUE [1 ] = sys_get_be32 (& ep -> key [8 ]);
67+ NRF_ECB -> KEY .VALUE [0 ] = sys_get_be32 (& ep -> key [12 ]);
68+
69+ ep -> in [0 ].ptr = ep -> clear_text ;
70+ ep -> in [0 ].length = sizeof (ep -> clear_text );
71+ ep -> in [0 ].attribute = ECB_JOB_PTR_ATTRIBUTE ;
72+ ep -> in [1 ].ptr = NULL ;
73+ ep -> in [1 ].length = 0U ;
74+ ep -> in [1 ].attribute = 0U ;
75+
76+ ep -> out [0 ].ptr = ep -> cipher_text ;
77+ ep -> out [0 ].length = sizeof (ep -> cipher_text );
78+ ep -> out [0 ].attribute = ECB_JOB_PTR_ATTRIBUTE ;
79+ ep -> out [1 ].ptr = NULL ;
80+ ep -> out [1 ].length = 0U ;
81+ ep -> out [1 ].attribute = 0U ;
82+
83+ NRF_ECB -> IN .PTR = (uint32_t )ep -> in ;
84+ NRF_ECB -> OUT .PTR = (uint32_t )ep -> out ;
8585#else /* !NRF54L_SERIES */
86- NRF_ECB -> ECBDATAPTR = (uint32_t )ecb ;
86+ NRF_ECB -> ECBDATAPTR = (uint32_t )ep ;
8787#endif /* !NRF54L_SERIES */
8888
8989 NRF_ECB -> EVENTS_ENDECB = 0 ;
@@ -141,38 +141,36 @@ void ecb_encrypt(uint8_t const *const key_le, uint8_t const *const clear_text_le
141141 }
142142}
143143
144- void ecb_encrypt_nonblocking (struct ecb * ecb )
144+ void ecb_encrypt_nonblocking (struct ecb * e )
145145{
146146 /* prepare to be used in a BE AES h/w */
147- if (ecb -> in_key_le ) {
148- mem_rcopy (& ecb -> in_key_be [0 ], ecb -> in_key_le ,
149- sizeof (ecb -> in_key_be ));
147+ if (e -> in_key_le ) {
148+ mem_rcopy (& e -> in_key_be [0 ], e -> in_key_le , sizeof (e -> in_key_be ));
150149 }
151- if (ecb -> in_clear_text_le ) {
152- mem_rcopy (& ecb -> in_clear_text_be [0 ],
153- ecb -> in_clear_text_le ,
154- sizeof (ecb -> in_clear_text_be ));
150+ if (e -> in_clear_text_le ) {
151+ mem_rcopy (& e -> in_clear_text_be [0 ], e -> in_clear_text_le ,
152+ sizeof (e -> in_clear_text_be ));
155153 }
156154
157155 /* setup the encryption h/w */
158156#if defined(NRF54L_SERIES )
159- NRF_ECB -> KEY .VALUE [3 ] = sys_get_be32 (& ecb -> in_key_be [0 ]);
160- NRF_ECB -> KEY .VALUE [2 ] = sys_get_be32 (& ecb -> in_key_be [4 ]);
161- NRF_ECB -> KEY .VALUE [1 ] = sys_get_be32 (& ecb -> in_key_be [8 ]);
162- NRF_ECB -> KEY .VALUE [0 ] = sys_get_be32 (& ecb -> in_key_be [12 ]);
157+ NRF_ECB -> KEY .VALUE [3 ] = sys_get_be32 (& e -> in_key_be [0 ]);
158+ NRF_ECB -> KEY .VALUE [2 ] = sys_get_be32 (& e -> in_key_be [4 ]);
159+ NRF_ECB -> KEY .VALUE [1 ] = sys_get_be32 (& e -> in_key_be [8 ]);
160+ NRF_ECB -> KEY .VALUE [0 ] = sys_get_be32 (& e -> in_key_be [12 ]);
163161
164- struct ecb_job_ptr * in = (void * )((uint8_t * )ecb + sizeof (* ecb ));
162+ struct ecb_job_ptr * in = (void * )((uint8_t * )e + sizeof (* e ));
165163 struct ecb_job_ptr * out = (void * )((uint8_t * )in + 16U );
166164
167- in [0 ].ptr = ecb -> in_clear_text_be ;
168- in [0 ].length = sizeof (ecb -> in_clear_text_be );
165+ in [0 ].ptr = e -> in_clear_text_be ;
166+ in [0 ].length = sizeof (e -> in_clear_text_be );
169167 in [0 ].attribute = ECB_JOB_PTR_ATTRIBUTE ;
170168 in [1 ].ptr = NULL ;
171169 in [1 ].length = 0U ;
172170 in [1 ].attribute = 0U ;
173171
174- out [0 ].ptr = ecb -> out_cipher_text_be ;
175- out [0 ].length = sizeof (ecb -> out_cipher_text_be );
172+ out [0 ].ptr = e -> out_cipher_text_be ;
173+ out [0 ].length = sizeof (e -> out_cipher_text_be );
176174 out [0 ].attribute = ECB_JOB_PTR_ATTRIBUTE ;
177175 out [1 ].ptr = NULL ;
178176 out [1 ].length = 0U ;
@@ -181,7 +179,7 @@ void ecb_encrypt_nonblocking(struct ecb *ecb)
181179 NRF_ECB -> IN .PTR = (uint32_t )in ;
182180 NRF_ECB -> OUT .PTR = (uint32_t )out ;
183181#else /* !NRF54L_SERIES */
184- NRF_ECB -> ECBDATAPTR = (uint32_t )ecb ;
182+ NRF_ECB -> ECBDATAPTR = (uint32_t )e ;
185183#endif /* !NRF54L_SERIES */
186184 NRF_ECB -> EVENTS_ENDECB = 0 ;
187185 NRF_ECB -> EVENTS_ERRORECB = 0 ;
@@ -199,10 +197,10 @@ void ecb_encrypt_nonblocking(struct ecb *ecb)
199197static void isr_ecb (const void * arg )
200198{
201199#if defined(NRF54L_SERIES )
202- struct ecb * ecb = (void * )((uint8_t * )NRF_ECB -> ECBDATAPTR -
203- sizeof (struct ecb ));
200+ struct ecb * e = (void * )((uint8_t * )NRF_ECB -> ECBDATAPTR -
201+ sizeof (struct ecb ));
204202#else /* !NRF54L_SERIES */
205- struct ecb * ecb = (void * )NRF_ECB -> ECBDATAPTR ;
203+ struct ecb * e = (void * )NRF_ECB -> ECBDATAPTR ;
206204#endif /* !NRF54L_SERIES */
207205
208206 ARG_UNUSED (arg );
@@ -216,14 +214,14 @@ static void isr_ecb(const void *arg)
216214 if (NRF_ECB -> EVENTS_ERRORECB ) {
217215 NRF_ECB -> EVENTS_ERRORECB = 0U ;
218216
219- ecb -> fp_ecb (1U , NULL , ecb -> context );
217+ e -> fp_ecb (1U , NULL , e -> context );
220218 }
221219
222220 else if (NRF_ECB -> EVENTS_ENDECB ) {
223221 NRF_ECB -> EVENTS_ENDECB = 0U ;
224222
225- ecb -> fp_ecb (0U , & ecb -> out_cipher_text_be [0 ],
226- ecb -> context );
223+ e -> fp_ecb (0U , & e -> out_cipher_text_be [0 ],
224+ e -> context );
227225 }
228226
229227 else {
@@ -283,15 +281,15 @@ int ecb_ut(void)
283281#endif /* !CONFIG_BT_CTLR_DYNAMIC_INTERRUPTS */
284282
285283 uint8_t ecb_mem [sizeof (struct ecb ) + 32U ];
286- struct ecb * ecb = (void * )ecb_mem ;
284+ struct ecb * e = (void * )ecb_mem ;
287285 struct ecb_ut_context context ;
288286
289287 (void )memset (& context , 0 , sizeof (context ));
290- ecb -> in_key_le = key ;
291- ecb -> in_clear_text_le = clear_text ;
292- ecb -> fp_ecb = ecb_cb ;
293- ecb -> context = & context ;
294- ecb_encrypt_nonblocking (ecb );
288+ e -> in_key_le = key ;
289+ e -> in_clear_text_le = clear_text ;
290+ e -> fp_ecb = ecb_cb ;
291+ e -> context = & context ;
292+ ecb_encrypt_nonblocking (e );
295293 do {
296294#if defined(CONFIG_SOC_SERIES_BSIM_NRFXX )
297295 k_busy_wait (10 );
0 commit comments