Lines Matching refs:ctx
50 static rt_uint32_t swm_crc_update(struct hwcrypto_crc *ctx, const rt_uint8_t *in, rt_size_t length) in swm_crc_update() argument
53 …struct swm_hwcrypto_device *hwcrypto_dev = (struct swm_hwcrypto_device *)ctx->parent.device->user_… in swm_crc_update()
55 struct swm_crc_cfg *crc_cfg = (struct swm_crc_cfg *)(ctx->parent.contex); in swm_crc_update()
59 if (memcmp(&swm_crc_cfg, &ctx->crc_cfg, sizeof(struct hwcrypto_crc_cfg)) != 0) in swm_crc_update()
63 crc_cfg->inival = ctx->crc_cfg.last_val; in swm_crc_update()
65 switch (ctx->crc_cfg.poly) in swm_crc_update()
77 switch (ctx->crc_cfg.width) in swm_crc_update()
94 switch (ctx->crc_cfg.flags) in swm_crc_update()
109 memcpy(&swm_crc_cfg, &ctx->crc_cfg, sizeof(struct hwcrypto_crc_cfg)); in swm_crc_update()
116 ctx->crc_cfg.last_val = result; in swm_crc_update()
118 swm_crc_cfg.last_val = ctx->crc_cfg.last_val; in swm_crc_update()
119 result = (result ? result ^ (ctx->crc_cfg.xorout) : result); in swm_crc_update()
133 static rt_err_t swm_crypto_create(struct rt_hwcrypto_ctx *ctx) in swm_crypto_create() argument
137 switch (ctx->type & HWCRYPTO_MAIN_TYPE_MASK) in swm_crypto_create()
155 ctx->contex = crc_cfg; in swm_crypto_create()
156 ((struct hwcrypto_crc *)ctx)->ops = &swm_crc_ops; in swm_crypto_create()
167 static void swm_crypto_destroy(struct rt_hwcrypto_ctx *ctx) in swm_crypto_destroy() argument
169 struct swm_crc_cfg *crc_cfg = (struct swm_crc_cfg *)(ctx->contex); in swm_crypto_destroy()
170 switch (ctx->type & HWCRYPTO_MAIN_TYPE_MASK) in swm_crypto_destroy()
181 rt_free(ctx->contex); in swm_crypto_destroy()
205 static void swm_crypto_reset(struct rt_hwcrypto_ctx *ctx) in swm_crypto_reset() argument
207 struct swm_crc_cfg *crc_cfg = (struct swm_crc_cfg *)(ctx->contex); in swm_crypto_reset()
208 switch (ctx->type & HWCRYPTO_MAIN_TYPE_MASK) in swm_crypto_reset()