Lines Matching refs:gctx
378 struct mac_gen_ctx *gctx = NULL; in mac_gen_init_common() local
383 if ((gctx = OPENSSL_zalloc(sizeof(*gctx))) != NULL) { in mac_gen_init_common()
384 gctx->libctx = libctx; in mac_gen_init_common()
385 gctx->selection = selection; in mac_gen_init_common()
387 return gctx; in mac_gen_init_common()
393 struct mac_gen_ctx *gctx = mac_gen_init_common(provctx, selection); in mac_gen_init() local
395 if (gctx != NULL && !mac_gen_set_params(gctx, params)) { in mac_gen_init()
396 OPENSSL_free(gctx); in mac_gen_init()
397 gctx = NULL; in mac_gen_init()
399 return gctx; in mac_gen_init()
405 struct mac_gen_ctx *gctx = mac_gen_init_common(provctx, selection); in cmac_gen_init() local
407 if (gctx != NULL && !cmac_gen_set_params(gctx, params)) { in cmac_gen_init()
408 OPENSSL_free(gctx); in cmac_gen_init()
409 gctx = NULL; in cmac_gen_init()
411 return gctx; in cmac_gen_init()
416 struct mac_gen_ctx *gctx = genctx; in mac_gen_set_params() local
419 if (gctx == NULL) in mac_gen_set_params()
428 gctx->priv_key = OPENSSL_secure_malloc(p->data_size); in mac_gen_set_params()
429 if (gctx->priv_key == NULL) in mac_gen_set_params()
431 memcpy(gctx->priv_key, p->data, p->data_size); in mac_gen_set_params()
432 gctx->priv_key_len = p->data_size; in mac_gen_set_params()
440 struct mac_gen_ctx *gctx = genctx; in cmac_gen_set_params() local
445 if (!ossl_prov_cipher_load_from_params(&gctx->cipher, params, in cmac_gen_set_params()
446 gctx->libctx)) { in cmac_gen_set_params()
477 struct mac_gen_ctx *gctx = genctx; in mac_gen() local
480 if (!ossl_prov_is_running() || gctx == NULL) in mac_gen()
483 if ((key = ossl_mac_key_new(gctx->libctx, 0)) == NULL) { in mac_gen()
489 if ((gctx->selection & OSSL_KEYMGMT_SELECT_KEYPAIR) == 0) in mac_gen()
492 if (gctx->priv_key == NULL) { in mac_gen()
504 if (!ossl_prov_cipher_copy(&key->cipher, &gctx->cipher)) { in mac_gen()
509 ossl_prov_cipher_reset(&gctx->cipher); in mac_gen()
510 key->priv_key = gctx->priv_key; in mac_gen()
511 key->priv_key_len = gctx->priv_key_len; in mac_gen()
512 gctx->priv_key_len = 0; in mac_gen()
513 gctx->priv_key = NULL; in mac_gen()
520 struct mac_gen_ctx *gctx = genctx; in mac_gen_cleanup() local
522 OPENSSL_secure_clear_free(gctx->priv_key, gctx->priv_key_len); in mac_gen_cleanup()
523 ossl_prov_cipher_reset(&gctx->cipher); in mac_gen_cleanup()
524 OPENSSL_free(gctx); in mac_gen_cleanup()