Lines Matching full:c
3 * Copyright (c) 2021-2025, STMicroelectronics - All Rights Reserved
43 struct stm32_hmac_ctx *c = to_stm32_hmac_ctx(ctx); in do_hmac_init() local
49 if (c->key) in do_hmac_init()
50 free(c->key); in do_hmac_init()
52 c->key = malloc(len); in do_hmac_init()
53 if (!c->key) { in do_hmac_init()
54 c->key_len = 0; in do_hmac_init()
57 memcpy(c->key, key, len); in do_hmac_init()
58 c->key_len = len; in do_hmac_init()
60 return stm32_hash_init(&c->hash, c->key, c->key_len); in do_hmac_init()
73 struct stm32_hmac_ctx *c = to_stm32_hmac_ctx(ctx); in do_hmac_update() local
75 if (!c->key) { in do_hmac_update()
80 return stm32_hash_update(&c->hash, data, len); in do_hmac_update()
93 struct stm32_hmac_ctx *c = to_stm32_hmac_ctx(ctx); in do_hmac_final() local
98 if (!c->key) { in do_hmac_final()
103 if (len < stm32_hash_digest_size(&c->hash)) in do_hmac_final()
106 res = stm32_hash_final(&c->hash, tmp_digest, c->key, c->key_len); in do_hmac_final()
108 if (res == TEE_SUCCESS && len < stm32_hash_digest_size(&c->hash)) in do_hmac_final()
121 struct stm32_hmac_ctx *c = to_stm32_hmac_ctx(ctx); in do_hmac_free() local
123 free(c->key); in do_hmac_free()
124 stm32_hash_free(&c->hash); in do_hmac_free()
125 free(c); in do_hmac_free()
176 struct stm32_hmac_ctx *c = NULL; in stm32_hmac_allocate() local
201 c = calloc(1, sizeof(*c)); in stm32_hmac_allocate()
202 if (!c) in stm32_hmac_allocate()
205 res = stm32_hash_alloc(&c->hash, STM32_HMAC_MODE, stm32_algo); in stm32_hmac_allocate()
207 free(c); in stm32_hmac_allocate()
212 c->mac_ctx.ops = &hmac_ops; in stm32_hmac_allocate()
213 *ctx = &c->mac_ctx; in stm32_hmac_allocate()