Lines Matching refs:cr
136 #define IS_CHAINING_MODE(mod, cr) \ argument
137 (((cr) & _SAES_CR_CHMOD_MASK) == (_SAES_CR_CHMOD_##mod << _SAES_CR_CHMOD_SHIFT))
139 #define SET_CHAINING_MODE(mod, cr) \ argument
140 mmio_clrsetbits_32((cr), _SAES_CR_CHMOD_MASK, _SAES_CR_CHMOD_##mod << _SAES_CR_CHMOD_SHIFT)
175 static bool does_chaining_mode_need_iv(uint32_t cr) in does_chaining_mode_need_iv() argument
177 return !(IS_CHAINING_MODE(ECB, cr)); in does_chaining_mode_need_iv()
180 static bool is_encrypt(uint32_t cr) in is_encrypt() argument
182 return (cr & _SAES_CR_MODE_MASK) == (_SAES_CR_MODE_ENC << _SAES_CR_MODE_SHIFT); in is_encrypt()
185 static bool is_decrypt(uint32_t cr) in is_decrypt() argument
187 return (cr & _SAES_CR_MODE_MASK) == (_SAES_CR_MODE_DEC << _SAES_CR_MODE_SHIFT); in is_decrypt()
245 if (does_chaining_mode_need_iv(ctx->cr)) { in saes_write_iv()
259 if ((ctx->cr & _SAES_CR_KEYSEL_MASK) == (_SAES_CR_KEYSEL_SOFT << _SAES_CR_KEYSEL_SHIFT)) { in saes_write_key()
266 if ((ctx->cr & _SAES_CR_KEYSIZE) == _SAES_CR_KEYSIZE) { in saes_write_key()
281 if ((ctx->cr & _SAES_CR_KEYSIZE) != 0U) { in saes_prepare_key()
290 if ((IS_CHAINING_MODE(ECB, ctx->cr) || IS_CHAINING_MODE(CBC, ctx->cr)) && in saes_prepare_key()
291 is_decrypt(ctx->cr)) { in saes_prepare_key()
325 ctx->cr = mmio_read_32(ctx->base + _SAES_CR); in save_context()
328 if (does_chaining_mode_need_iv(ctx->cr)) { in save_context()
358 mmio_write_32(ctx->base + _SAES_CR, ctx->cr); in restore_context()
427 ctx->cr = _SAES_CR_RESET_VALUE; in stm32_saes_init()
438 mmio_clrsetbits_32((uintptr_t)&(ctx->cr), _SAES_CR_MODE_MASK, in stm32_saes_init()
442 mmio_clrsetbits_32((uintptr_t)&(ctx->cr), _SAES_CR_MODE_MASK, in stm32_saes_init()
449 SET_CHAINING_MODE(ECB, (uintptr_t)&(ctx->cr)); in stm32_saes_init()
452 SET_CHAINING_MODE(CBC, (uintptr_t)&(ctx->cr)); in stm32_saes_init()
455 SET_CHAINING_MODE(CTR, (uintptr_t)&(ctx->cr)); in stm32_saes_init()
458 SET_CHAINING_MODE(GCM, (uintptr_t)&(ctx->cr)); in stm32_saes_init()
461 SET_CHAINING_MODE(CCM, (uintptr_t)&(ctx->cr)); in stm32_saes_init()
475 mmio_clrsetbits_32((uintptr_t)&(ctx->cr), _SAES_CR_DATATYPE_MASK, in stm32_saes_init()
481 mmio_clrbits_32((uintptr_t)&(ctx->cr), _SAES_CR_KEYSIZE); in stm32_saes_init()
484 mmio_setbits_32((uintptr_t)&(ctx->cr), _SAES_CR_KEYSIZE); in stm32_saes_init()
493 mmio_clrsetbits_32((uintptr_t)&(ctx->cr), _SAES_CR_KEYSEL_MASK, in stm32_saes_init()
520 mmio_clrsetbits_32((uintptr_t)&(ctx->cr), _SAES_CR_KEYSEL_MASK, in stm32_saes_init()
524 mmio_clrsetbits_32((uintptr_t)&(ctx->cr), _SAES_CR_KEYSEL_MASK, in stm32_saes_init()
528 mmio_clrsetbits_32((uintptr_t)&(ctx->cr), _SAES_CR_KEYSEL_MASK, in stm32_saes_init()
532 mmio_clrsetbits_32((uintptr_t)&(ctx->cr), _SAES_CR_KEYSEL_MASK, in stm32_saes_init()
841 if (last_block && IS_CHAINING_MODE(CBC, ctx->cr) && is_encrypt(ctx->cr) && in stm32_saes_update()