From 17846ed1f4e69677ee4ad963c8db6602fbc07e2d Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Fri, 20 Sep 2024 09:35:53 +0200 Subject: [PATCH] Bluetooth: Controller: nRF54L: Fix ecb tag name should be unique Fix ecb tag name for violation to rule 5.7 (Tag name should be unique) tag: ecb. Signed-off-by: Vinayak Kariappa Chettimada --- .../controller/ll_sw/nordic/hal/nrf5/ecb.c | 98 +++++++++---------- 1 file changed, 48 insertions(+), 50 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/ecb.c b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/ecb.c index 56191bf9b8d..2398bdc44fd 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/ecb.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/ecb.c @@ -55,35 +55,35 @@ struct ecb_param { #endif /* NRF54L_SERIES */ } __packed; -static void do_ecb(struct ecb_param *ecb) +static void do_ecb(struct ecb_param *ep) { do { nrf_ecb_task_trigger(NRF_ECB, NRF_ECB_TASK_STOPECB); #if defined(NRF54L_SERIES) - NRF_ECB->KEY.VALUE[3] = sys_get_be32(&ecb->key[0]); - NRF_ECB->KEY.VALUE[2] = sys_get_be32(&ecb->key[4]); - NRF_ECB->KEY.VALUE[1] = sys_get_be32(&ecb->key[8]); - NRF_ECB->KEY.VALUE[0] = sys_get_be32(&ecb->key[12]); + NRF_ECB->KEY.VALUE[3] = sys_get_be32(&ep->key[0]); + NRF_ECB->KEY.VALUE[2] = sys_get_be32(&ep->key[4]); + NRF_ECB->KEY.VALUE[1] = sys_get_be32(&ep->key[8]); + NRF_ECB->KEY.VALUE[0] = sys_get_be32(&ep->key[12]); - ecb->in[0].ptr = ecb->clear_text; - ecb->in[0].length = sizeof(ecb->clear_text); - ecb->in[0].attribute = ECB_JOB_PTR_ATTRIBUTE; - ecb->in[1].ptr = NULL; - ecb->in[1].length = 0U; - ecb->in[1].attribute = 0U; + ep->in[0].ptr = ep->clear_text; + ep->in[0].length = sizeof(ep->clear_text); + ep->in[0].attribute = ECB_JOB_PTR_ATTRIBUTE; + ep->in[1].ptr = NULL; + ep->in[1].length = 0U; + ep->in[1].attribute = 0U; - ecb->out[0].ptr = ecb->cipher_text; - ecb->out[0].length = sizeof(ecb->cipher_text); - ecb->out[0].attribute = ECB_JOB_PTR_ATTRIBUTE; - ecb->out[1].ptr = NULL; - ecb->out[1].length = 0U; - ecb->out[1].attribute = 0U; + ep->out[0].ptr = ep->cipher_text; + ep->out[0].length = sizeof(ep->cipher_text); + ep->out[0].attribute = ECB_JOB_PTR_ATTRIBUTE; + ep->out[1].ptr = NULL; + ep->out[1].length = 0U; + ep->out[1].attribute = 0U; - NRF_ECB->IN.PTR = (uint32_t)ecb->in; - NRF_ECB->OUT.PTR = (uint32_t)ecb->out; + NRF_ECB->IN.PTR = (uint32_t)ep->in; + NRF_ECB->OUT.PTR = (uint32_t)ep->out; #else /* !NRF54L_SERIES */ - NRF_ECB->ECBDATAPTR = (uint32_t)ecb; + NRF_ECB->ECBDATAPTR = (uint32_t)ep; #endif /* !NRF54L_SERIES */ 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 } } -void ecb_encrypt_nonblocking(struct ecb *ecb) +void ecb_encrypt_nonblocking(struct ecb *e) { /* prepare to be used in a BE AES h/w */ - if (ecb->in_key_le) { - mem_rcopy(&ecb->in_key_be[0], ecb->in_key_le, - sizeof(ecb->in_key_be)); + if (e->in_key_le) { + mem_rcopy(&e->in_key_be[0], e->in_key_le, sizeof(e->in_key_be)); } - if (ecb->in_clear_text_le) { - mem_rcopy(&ecb->in_clear_text_be[0], - ecb->in_clear_text_le, - sizeof(ecb->in_clear_text_be)); + if (e->in_clear_text_le) { + mem_rcopy(&e->in_clear_text_be[0], e->in_clear_text_le, + sizeof(e->in_clear_text_be)); } /* setup the encryption h/w */ #if defined(NRF54L_SERIES) - NRF_ECB->KEY.VALUE[3] = sys_get_be32(&ecb->in_key_be[0]); - NRF_ECB->KEY.VALUE[2] = sys_get_be32(&ecb->in_key_be[4]); - NRF_ECB->KEY.VALUE[1] = sys_get_be32(&ecb->in_key_be[8]); - NRF_ECB->KEY.VALUE[0] = sys_get_be32(&ecb->in_key_be[12]); + NRF_ECB->KEY.VALUE[3] = sys_get_be32(&e->in_key_be[0]); + NRF_ECB->KEY.VALUE[2] = sys_get_be32(&e->in_key_be[4]); + NRF_ECB->KEY.VALUE[1] = sys_get_be32(&e->in_key_be[8]); + NRF_ECB->KEY.VALUE[0] = sys_get_be32(&e->in_key_be[12]); - struct ecb_job_ptr *in = (void *)((uint8_t *)ecb + sizeof(*ecb)); + struct ecb_job_ptr *in = (void *)((uint8_t *)e + sizeof(*e)); struct ecb_job_ptr *out = (void *)((uint8_t *)in + 16U); - in[0].ptr = ecb->in_clear_text_be; - in[0].length = sizeof(ecb->in_clear_text_be); + in[0].ptr = e->in_clear_text_be; + in[0].length = sizeof(e->in_clear_text_be); in[0].attribute = ECB_JOB_PTR_ATTRIBUTE; in[1].ptr = NULL; in[1].length = 0U; in[1].attribute = 0U; - out[0].ptr = ecb->out_cipher_text_be; - out[0].length = sizeof(ecb->out_cipher_text_be); + out[0].ptr = e->out_cipher_text_be; + out[0].length = sizeof(e->out_cipher_text_be); out[0].attribute = ECB_JOB_PTR_ATTRIBUTE; out[1].ptr = NULL; out[1].length = 0U; @@ -181,7 +179,7 @@ void ecb_encrypt_nonblocking(struct ecb *ecb) NRF_ECB->IN.PTR = (uint32_t)in; NRF_ECB->OUT.PTR = (uint32_t)out; #else /* !NRF54L_SERIES */ - NRF_ECB->ECBDATAPTR = (uint32_t)ecb; + NRF_ECB->ECBDATAPTR = (uint32_t)e; #endif /* !NRF54L_SERIES */ NRF_ECB->EVENTS_ENDECB = 0; NRF_ECB->EVENTS_ERRORECB = 0; @@ -199,10 +197,10 @@ void ecb_encrypt_nonblocking(struct ecb *ecb) static void isr_ecb(const void *arg) { #if defined(NRF54L_SERIES) - struct ecb *ecb = (void *)((uint8_t *)NRF_ECB->ECBDATAPTR - - sizeof(struct ecb)); + struct ecb *e = (void *)((uint8_t *)NRF_ECB->ECBDATAPTR - + sizeof(struct ecb)); #else /* !NRF54L_SERIES */ - struct ecb *ecb = (void *)NRF_ECB->ECBDATAPTR; + struct ecb *e = (void *)NRF_ECB->ECBDATAPTR; #endif /* !NRF54L_SERIES */ ARG_UNUSED(arg); @@ -216,14 +214,14 @@ static void isr_ecb(const void *arg) if (NRF_ECB->EVENTS_ERRORECB) { NRF_ECB->EVENTS_ERRORECB = 0U; - ecb->fp_ecb(1U, NULL, ecb->context); + e->fp_ecb(1U, NULL, e->context); } else if (NRF_ECB->EVENTS_ENDECB) { NRF_ECB->EVENTS_ENDECB = 0U; - ecb->fp_ecb(0U, &ecb->out_cipher_text_be[0], - ecb->context); + e->fp_ecb(0U, &e->out_cipher_text_be[0], + e->context); } else { @@ -283,15 +281,15 @@ int ecb_ut(void) #endif /* !CONFIG_BT_CTLR_DYNAMIC_INTERRUPTS */ uint8_t ecb_mem[sizeof(struct ecb) + 32U]; - struct ecb *ecb = (void *)ecb_mem; + struct ecb *e = (void *)ecb_mem; struct ecb_ut_context context; (void)memset(&context, 0, sizeof(context)); - ecb->in_key_le = key; - ecb->in_clear_text_le = clear_text; - ecb->fp_ecb = ecb_cb; - ecb->context = &context; - ecb_encrypt_nonblocking(ecb); + e->in_key_le = key; + e->in_clear_text_le = clear_text; + e->fp_ecb = ecb_cb; + e->context = &context; + ecb_encrypt_nonblocking(e); do { #if defined(CONFIG_SOC_SERIES_BSIM_NRFXX) k_busy_wait(10);