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()
247 if (does_chaining_mode_need_iv(ctx->cr)) { in saes_write_iv()
261 if ((ctx->cr & _SAES_CR_KEYSEL_MASK) == (_SAES_CR_KEYSEL_SOFT << _SAES_CR_KEYSEL_SHIFT)) { in saes_write_key()
268 if ((ctx->cr & _SAES_CR_KEYSIZE) == _SAES_CR_KEYSIZE) { in saes_write_key()
283 if ((ctx->cr & _SAES_CR_KEYSIZE) != 0U) { in saes_prepare_key()
292 if ((IS_CHAINING_MODE(ECB, ctx->cr) || IS_CHAINING_MODE(CBC, ctx->cr)) && in saes_prepare_key()
293 is_decrypt(ctx->cr)) { in saes_prepare_key()
327 ctx->cr = mmio_read_32(ctx->base + _SAES_CR); in save_context()
330 if (does_chaining_mode_need_iv(ctx->cr)) { in save_context()
360 mmio_write_32(ctx->base + _SAES_CR, ctx->cr); in restore_context()
429 ctx->cr = _SAES_CR_RESET_VALUE; in stm32_saes_init()
440 mmio_clrsetbits_32((uintptr_t)&(ctx->cr), _SAES_CR_MODE_MASK, in stm32_saes_init()
444 mmio_clrsetbits_32((uintptr_t)&(ctx->cr), _SAES_CR_MODE_MASK, in stm32_saes_init()
451 SET_CHAINING_MODE(ECB, (uintptr_t)&(ctx->cr)); in stm32_saes_init()
454 SET_CHAINING_MODE(CBC, (uintptr_t)&(ctx->cr)); in stm32_saes_init()
457 SET_CHAINING_MODE(CTR, (uintptr_t)&(ctx->cr)); in stm32_saes_init()
460 SET_CHAINING_MODE(GCM, (uintptr_t)&(ctx->cr)); in stm32_saes_init()
463 SET_CHAINING_MODE(CCM, (uintptr_t)&(ctx->cr)); in stm32_saes_init()
477 mmio_clrsetbits_32((uintptr_t)&(ctx->cr), _SAES_CR_DATATYPE_MASK, in stm32_saes_init()
483 mmio_clrbits_32((uintptr_t)&(ctx->cr), _SAES_CR_KEYSIZE); in stm32_saes_init()
486 mmio_setbits_32((uintptr_t)&(ctx->cr), _SAES_CR_KEYSIZE); in stm32_saes_init()
495 mmio_clrsetbits_32((uintptr_t)&(ctx->cr), _SAES_CR_KEYSEL_MASK, in stm32_saes_init()
522 mmio_clrsetbits_32((uintptr_t)&(ctx->cr), _SAES_CR_KEYSEL_MASK, in stm32_saes_init()
526 mmio_clrsetbits_32((uintptr_t)&(ctx->cr), _SAES_CR_KEYSEL_MASK, in stm32_saes_init()
530 mmio_clrsetbits_32((uintptr_t)&(ctx->cr), _SAES_CR_KEYSEL_MASK, in stm32_saes_init()
534 mmio_clrsetbits_32((uintptr_t)&(ctx->cr), _SAES_CR_KEYSEL_MASK, in stm32_saes_init()
843 if (last_block && IS_CHAINING_MODE(CBC, ctx->cr) && is_encrypt(ctx->cr) && in stm32_saes_update()