Lines Matching +full:- +full:c

1 // SPDX-License-Identifier: BSD-2-Clause
3 * Copyright (c) 2014-2019, Linaro Limited
30 assert(ctx && ctx->ops == &ltc_xts_ops); in to_xts_ctx()
42 struct ltc_xts_ctx *c = to_xts_ctx(ctx); in ltc_xts_init() local
47 if (iv_len != sizeof(c->tweak)) in ltc_xts_init()
49 memcpy(c->tweak, iv, sizeof(c->tweak)); in ltc_xts_init()
51 memset(c->tweak, 0, sizeof(c->tweak)); in ltc_xts_init()
54 if ((int)iv_len != cipher_descriptor[c->cipher_idx]->block_length) in ltc_xts_init()
58 c->update = xts_encrypt; in ltc_xts_init()
60 c->update = xts_decrypt; in ltc_xts_init()
63 if (xts_start(c->cipher_idx, key1, key2, key1_len, 0, in ltc_xts_init()
64 &c->state) == CRYPT_OK) in ltc_xts_init()
74 struct ltc_xts_ctx *c = to_xts_ctx(ctx); in ltc_xts_update() local
76 if (c->update && c->update(data, len, dst, c->tweak, in ltc_xts_update()
77 &c->state) == CRYPT_OK) in ltc_xts_update()
85 xts_done(&to_xts_ctx(ctx)->state); in ltc_xts_final()
99 assert(src->cipher_idx == dst->cipher_idx); in ltc_xts_copy_state()
100 dst->update = src->update; in ltc_xts_copy_state()
101 memcpy(dst->tweak, src->tweak, sizeof(src->tweak)); in ltc_xts_copy_state()
102 dst->state = src->state; in ltc_xts_copy_state()
115 struct ltc_xts_ctx *c = NULL; in crypto_aes_xts_alloc_ctx() local
121 c = calloc(1, sizeof(*c)); in crypto_aes_xts_alloc_ctx()
122 if (!c) in crypto_aes_xts_alloc_ctx()
125 c->ctx.ops = &ltc_xts_ops; in crypto_aes_xts_alloc_ctx()
126 c->cipher_idx = cipher_idx; in crypto_aes_xts_alloc_ctx()
127 *ctx_ret = &c->ctx; in crypto_aes_xts_alloc_ctx()