Lines Matching refs:ctx

17 	struct crypto_mac_ctx ctx;  member
24 static struct ltc_hmac_ctx *to_hmac_ctx(struct crypto_mac_ctx *ctx) in to_hmac_ctx() argument
26 assert(ctx && ctx->ops == &ltc_hmac_ops); in to_hmac_ctx()
28 return container_of(ctx, struct ltc_hmac_ctx, ctx); in to_hmac_ctx()
31 static TEE_Result ltc_hmac_init(struct crypto_mac_ctx *ctx, const uint8_t *key, in ltc_hmac_init() argument
34 struct ltc_hmac_ctx *hc = to_hmac_ctx(ctx); in ltc_hmac_init()
42 static TEE_Result ltc_hmac_update(struct crypto_mac_ctx *ctx, in ltc_hmac_update() argument
45 if (hmac_process(&to_hmac_ctx(ctx)->state, data, len) == CRYPT_OK) in ltc_hmac_update()
51 static TEE_Result ltc_hmac_final(struct crypto_mac_ctx *ctx, uint8_t *digest, in ltc_hmac_final() argument
56 if (hmac_done(&to_hmac_ctx(ctx)->state, digest, &l) == CRYPT_OK) in ltc_hmac_final()
62 static void ltc_hmac_free_ctx(struct crypto_mac_ctx *ctx) in ltc_hmac_free_ctx() argument
64 free(to_hmac_ctx(ctx)); in ltc_hmac_free_ctx()
88 struct ltc_hmac_ctx *ctx = NULL; in ltc_hmac_alloc_ctx() local
93 ctx = calloc(1, sizeof(*ctx)); in ltc_hmac_alloc_ctx()
94 if (!ctx) in ltc_hmac_alloc_ctx()
97 ctx->ctx.ops = &ltc_hmac_ops; in ltc_hmac_alloc_ctx()
98 ctx->hash_idx = hash_idx; in ltc_hmac_alloc_ctx()
99 *ctx_ret = &ctx->ctx; in ltc_hmac_alloc_ctx()
104 TEE_Result crypto_hmac_md5_alloc_ctx(struct crypto_mac_ctx **ctx) in crypto_hmac_md5_alloc_ctx() argument
106 return ltc_hmac_alloc_ctx(ctx, find_hash("md5")); in crypto_hmac_md5_alloc_ctx()
109 TEE_Result crypto_hmac_sha1_alloc_ctx(struct crypto_mac_ctx **ctx) in crypto_hmac_sha1_alloc_ctx() argument
111 return ltc_hmac_alloc_ctx(ctx, find_hash("sha1")); in crypto_hmac_sha1_alloc_ctx()
114 TEE_Result crypto_hmac_sha224_alloc_ctx(struct crypto_mac_ctx **ctx) in crypto_hmac_sha224_alloc_ctx() argument
116 return ltc_hmac_alloc_ctx(ctx, find_hash("sha224")); in crypto_hmac_sha224_alloc_ctx()
119 TEE_Result crypto_hmac_sha256_alloc_ctx(struct crypto_mac_ctx **ctx) in crypto_hmac_sha256_alloc_ctx() argument
121 return ltc_hmac_alloc_ctx(ctx, find_hash("sha256")); in crypto_hmac_sha256_alloc_ctx()
124 TEE_Result crypto_hmac_sha384_alloc_ctx(struct crypto_mac_ctx **ctx) in crypto_hmac_sha384_alloc_ctx() argument
126 return ltc_hmac_alloc_ctx(ctx, find_hash("sha384")); in crypto_hmac_sha384_alloc_ctx()
129 TEE_Result crypto_hmac_sha512_alloc_ctx(struct crypto_mac_ctx **ctx) in crypto_hmac_sha512_alloc_ctx() argument
131 return ltc_hmac_alloc_ctx(ctx, find_hash("sha512")); in crypto_hmac_sha512_alloc_ctx()