Lines Matching refs:psm2ctx
92 static int sm2sig_set_mdname(PROV_SM2_CTX *psm2ctx, const char *mdname) in sm2sig_set_mdname() argument
94 if (psm2ctx->md == NULL) /* We need an SM3 md to compare with */ in sm2sig_set_mdname()
95 psm2ctx->md = EVP_MD_fetch(psm2ctx->libctx, psm2ctx->mdname, in sm2sig_set_mdname()
96 psm2ctx->propq); in sm2sig_set_mdname()
97 if (psm2ctx->md == NULL) in sm2sig_set_mdname()
101 if (EVP_MD_xof(psm2ctx->md)) { in sm2sig_set_mdname()
109 if (strlen(mdname) >= sizeof(psm2ctx->mdname) in sm2sig_set_mdname()
110 || !EVP_MD_is_a(psm2ctx->md, mdname)) { in sm2sig_set_mdname()
116 OPENSSL_strlcpy(psm2ctx->mdname, mdname, sizeof(psm2ctx->mdname)); in sm2sig_set_mdname()
140 PROV_SM2_CTX *psm2ctx = (PROV_SM2_CTX *)vpsm2ctx; in sm2sig_signature_init() local
143 || psm2ctx == NULL) in sm2sig_signature_init()
146 if (ec == NULL && psm2ctx->ec == NULL) { in sm2sig_signature_init()
154 EC_KEY_free(psm2ctx->ec); in sm2sig_signature_init()
155 psm2ctx->ec = ec; in sm2sig_signature_init()
158 return sm2sig_set_ctx_params(psm2ctx, params); in sm2sig_signature_init()
282 PROV_SM2_CTX *psm2ctx = (PROV_SM2_CTX *)vpsm2ctx; in sm2sig_digest_signverify_update() local
284 if (psm2ctx == NULL || psm2ctx->mdctx == NULL) in sm2sig_digest_signverify_update()
287 return sm2sig_compute_z_digest(psm2ctx) in sm2sig_digest_signverify_update()
288 && EVP_DigestUpdate(psm2ctx->mdctx, data, datalen); in sm2sig_digest_signverify_update()
294 PROV_SM2_CTX *psm2ctx = (PROV_SM2_CTX *)vpsm2ctx; in sm2sig_digest_sign_final() local
298 if (psm2ctx == NULL || psm2ctx->mdctx == NULL) in sm2sig_digest_sign_final()
306 if (!(sm2sig_compute_z_digest(psm2ctx) in sm2sig_digest_sign_final()
307 && EVP_DigestFinal_ex(psm2ctx->mdctx, digest, &dlen))) in sm2sig_digest_sign_final()
318 PROV_SM2_CTX *psm2ctx = (PROV_SM2_CTX *)vpsm2ctx; in sm2sig_digest_verify_final() local
323 if (psm2ctx == NULL || psm2ctx->mdctx == NULL) in sm2sig_digest_verify_final()
326 md_size = EVP_MD_get_size(psm2ctx->md); in sm2sig_digest_verify_final()
330 if (!(sm2sig_compute_z_digest(psm2ctx) in sm2sig_digest_verify_final()
331 && EVP_DigestFinal_ex(psm2ctx->mdctx, digest, &dlen))) in sm2sig_digest_verify_final()
401 PROV_SM2_CTX *psm2ctx = (PROV_SM2_CTX *)vpsm2ctx; in sm2sig_get_ctx_params() local
404 if (psm2ctx == NULL) in sm2sig_get_ctx_params()
410 psm2ctx->aid_len == 0 ? NULL : psm2ctx->aid_buf, in sm2sig_get_ctx_params()
411 psm2ctx->aid_len)) in sm2sig_get_ctx_params()
415 if (p != NULL && !OSSL_PARAM_set_size_t(p, psm2ctx->mdsize)) in sm2sig_get_ctx_params()
419 if (p != NULL && !OSSL_PARAM_set_utf8_string(p, psm2ctx->md == NULL in sm2sig_get_ctx_params()
420 ? psm2ctx->mdname in sm2sig_get_ctx_params()
421 : EVP_MD_get0_name(psm2ctx->md))) in sm2sig_get_ctx_params()
442 PROV_SM2_CTX *psm2ctx = (PROV_SM2_CTX *)vpsm2ctx; in sm2sig_set_ctx_params() local
446 if (psm2ctx == NULL) in sm2sig_set_ctx_params()
459 if (!psm2ctx->flag_compute_z_digest) in sm2sig_set_ctx_params()
465 OPENSSL_free(psm2ctx->id); in sm2sig_set_ctx_params()
466 psm2ctx->id = tmp_id; in sm2sig_set_ctx_params()
467 psm2ctx->id_len = tmp_idlen; in sm2sig_set_ctx_params()
478 || mdsize != psm2ctx->mdsize)) in sm2sig_set_ctx_params()
487 if (!sm2sig_set_mdname(psm2ctx, mdname)) { in sm2sig_set_ctx_params()
512 PROV_SM2_CTX *psm2ctx = (PROV_SM2_CTX *)vpsm2ctx; in sm2sig_get_ctx_md_params() local
514 if (psm2ctx->mdctx == NULL) in sm2sig_get_ctx_md_params()
517 return EVP_MD_CTX_get_params(psm2ctx->mdctx, params); in sm2sig_get_ctx_md_params()
522 PROV_SM2_CTX *psm2ctx = (PROV_SM2_CTX *)vpsm2ctx; in sm2sig_gettable_ctx_md_params() local
524 if (psm2ctx->md == NULL) in sm2sig_gettable_ctx_md_params()
527 return EVP_MD_gettable_ctx_params(psm2ctx->md); in sm2sig_gettable_ctx_md_params()
532 PROV_SM2_CTX *psm2ctx = (PROV_SM2_CTX *)vpsm2ctx; in sm2sig_set_ctx_md_params() local
534 if (psm2ctx->mdctx == NULL) in sm2sig_set_ctx_md_params()
537 return EVP_MD_CTX_set_params(psm2ctx->mdctx, params); in sm2sig_set_ctx_md_params()
542 PROV_SM2_CTX *psm2ctx = (PROV_SM2_CTX *)vpsm2ctx; in sm2sig_settable_ctx_md_params() local
544 if (psm2ctx->md == NULL) in sm2sig_settable_ctx_md_params()
547 return EVP_MD_settable_ctx_params(psm2ctx->md); in sm2sig_settable_ctx_md_params()