Lines Matching +full:- +full:c
1 // SPDX-License-Identifier: BSD-2-Clause
3 * Copyright (c) 2019 Huawei Technologies Co., Ltd
27 assert(ctx && ctx->ops == &sm4_cbc_ops); in to_sm4_cbc_ctx()
38 struct sm4_cbc_ctx *c = to_sm4_cbc_ctx(ctx); in sm4_cbc_init() local
40 if (key1_len != 16 || iv_len != sizeof(c->iv)) in sm4_cbc_init()
44 sm4_setkey_enc(&c->state, key1); in sm4_cbc_init()
46 sm4_setkey_dec(&c->state, key1); in sm4_cbc_init()
48 memcpy(c->iv, iv, sizeof(c->iv)); in sm4_cbc_init()
57 struct sm4_cbc_ctx *c = to_sm4_cbc_ctx(ctx); in sm4_cbc_update() local
59 sm4_crypt_cbc(&c->state, len, c->iv, data, dst); in sm4_cbc_update()
66 struct sm4_cbc_ctx *c = to_sm4_cbc_ctx(ctx); in sm4_cbc_final() local
68 memzero_explicit(&c->state, sizeof(c->state)); in sm4_cbc_final()
69 memzero_explicit(&c->iv, sizeof(c->iv)); in sm4_cbc_final()
83 dst->state = src->state; in sm4_cbc_copy_state()
84 memcpy(dst->iv, src->iv, sizeof(src->iv)); in sm4_cbc_copy_state()
97 struct sm4_cbc_ctx *c = NULL; in crypto_sm4_cbc_alloc_ctx() local
99 c = calloc(1, sizeof(*c)); in crypto_sm4_cbc_alloc_ctx()
100 if (!c) in crypto_sm4_cbc_alloc_ctx()
103 c->ctx.ops = &sm4_cbc_ops; in crypto_sm4_cbc_alloc_ctx()
104 *ctx_ret = &c->ctx; in crypto_sm4_cbc_alloc_ctx()