Lines Matching refs:psm2ctx
51 PROV_SM2_CTX *psm2ctx = OPENSSL_zalloc(sizeof(PROV_SM2_CTX)); in sm2_newctx() local
53 if (psm2ctx == NULL) in sm2_newctx()
55 psm2ctx->libctx = PROV_LIBCTX_OF(provctx); in sm2_newctx()
57 return psm2ctx; in sm2_newctx()
62 PROV_SM2_CTX *psm2ctx = (PROV_SM2_CTX *)vpsm2ctx; in sm2_init() local
64 if (psm2ctx == NULL || vkey == NULL || !EC_KEY_up_ref(vkey)) in sm2_init()
66 EC_KEY_free(psm2ctx->key); in sm2_init()
67 psm2ctx->key = vkey; in sm2_init()
69 return sm2_set_ctx_params(psm2ctx, params); in sm2_init()
72 static const EVP_MD *sm2_get_md(PROV_SM2_CTX *psm2ctx) in sm2_get_md() argument
74 const EVP_MD *md = ossl_prov_digest_md(&psm2ctx->md); in sm2_get_md()
77 md = ossl_prov_digest_fetch(&psm2ctx->md, psm2ctx->libctx, "SM3", NULL); in sm2_get_md()
86 PROV_SM2_CTX *psm2ctx = (PROV_SM2_CTX *)vpsm2ctx; in sm2_asym_encrypt() local
87 const EVP_MD *md = sm2_get_md(psm2ctx); in sm2_asym_encrypt()
93 if (!ossl_sm2_ciphertext_size(psm2ctx->key, md, inlen, outlen)) { in sm2_asym_encrypt()
100 return ossl_sm2_encrypt(psm2ctx->key, md, in, inlen, out, outlen); in sm2_asym_encrypt()
107 PROV_SM2_CTX *psm2ctx = (PROV_SM2_CTX *)vpsm2ctx; in sm2_asym_decrypt() local
108 const EVP_MD *md = sm2_get_md(psm2ctx); in sm2_asym_decrypt()
119 return ossl_sm2_decrypt(psm2ctx->key, md, in, inlen, out, outlen); in sm2_asym_decrypt()
124 PROV_SM2_CTX *psm2ctx = (PROV_SM2_CTX *)vpsm2ctx; in sm2_freectx() local
126 EC_KEY_free(psm2ctx->key); in sm2_freectx()
127 ossl_prov_digest_reset(&psm2ctx->md); in sm2_freectx()
129 OPENSSL_free(psm2ctx); in sm2_freectx()
159 PROV_SM2_CTX *psm2ctx = (PROV_SM2_CTX *)vpsm2ctx; in sm2_get_ctx_params() local
167 const EVP_MD *md = ossl_prov_digest_md(&psm2ctx->md); in sm2_get_ctx_params()
190 PROV_SM2_CTX *psm2ctx = (PROV_SM2_CTX *)vpsm2ctx; in sm2_set_ctx_params() local
192 if (psm2ctx == NULL) in sm2_set_ctx_params()
197 if (!ossl_prov_digest_load_from_params(&psm2ctx->md, params, in sm2_set_ctx_params()
198 psm2ctx->libctx)) in sm2_set_ctx_params()