Lines Matching full:c
3 * Copyright (c) 2022 Huawei Technologies Co., Ltd
39 struct sm4_xts_ctx *c = to_sm4_xts_ctx(ctx); in sm4_xts_init() local
41 if (key1_len != 16 || key2_len != 16 || iv_len != sizeof(c->iv)) in sm4_xts_init()
45 memcpy(c->iv, iv, sizeof(c->iv)); in sm4_xts_init()
48 sm4_setkey_enc(&c->state, key1); in sm4_xts_init()
50 sm4_setkey_dec(&c->state, key1); in sm4_xts_init()
52 sm4_setkey_enc(&c->state_ek, key2); in sm4_xts_init()
53 sm4_setkey_dec(&c->state_dk, key2); in sm4_xts_init()
62 struct sm4_xts_ctx *c = to_sm4_xts_ctx(ctx); in sm4_xts_update() local
64 sm4_crypt_xts(&c->state, &c->state_ek, &c->state_dk, in sm4_xts_update()
65 len, c->iv, data, dst); in sm4_xts_update()
72 struct sm4_xts_ctx *c = to_sm4_xts_ctx(ctx); in sm4_xts_final() local
74 memzero_explicit(&c->state, sizeof(c->state)); in sm4_xts_final()
75 memzero_explicit(&c->state_ek, sizeof(c->state_ek)); in sm4_xts_final()
76 memzero_explicit(&c->state_dk, sizeof(c->state_dk)); in sm4_xts_final()
77 memzero_explicit(&c->iv, sizeof(c->iv)); in sm4_xts_final()
107 struct sm4_xts_ctx *c = NULL; in crypto_sm4_xts_alloc_ctx() local
109 c = calloc(1, sizeof(*c)); in crypto_sm4_xts_alloc_ctx()
110 if (!c) in crypto_sm4_xts_alloc_ctx()
113 c->ctx.ops = &sm4_xts_ops; in crypto_sm4_xts_alloc_ctx()
114 *ctx_ret = &c->ctx; in crypto_sm4_xts_alloc_ctx()