Lines Matching refs:mctx
82 EVP_MD_CTX *mctx = NULL; in x9_62_tests() local
104 if (!TEST_ptr(mctx = EVP_MD_CTX_new()) in x9_62_tests()
107 || !TEST_true(EVP_DigestInit_ex(mctx, EVP_get_digestbynid(md_nid), NULL)) in x9_62_tests()
108 || !TEST_true(EVP_DigestUpdate(mctx, message, msg_len)) in x9_62_tests()
109 || !TEST_true(EVP_DigestFinal_ex(mctx, digest, &dgst_len)) in x9_62_tests()
154 EVP_MD_CTX_free(mctx); in x9_62_tests()
176 static int set_sm2_id(EVP_MD_CTX *mctx, EVP_PKEY *pkey) in set_sm2_id() argument
182 if (!TEST_ptr(pctx = EVP_MD_CTX_get_pkey_ctx(mctx)) in set_sm2_id()
194 EVP_MD_CTX *mctx = NULL; in test_builtin() local
224 if (!TEST_ptr(mctx = EVP_MD_CTX_new()) in test_builtin()
249 || !TEST_true(EVP_DigestSignInit(mctx, NULL, NULL, NULL, pkey)) in test_builtin()
250 || (as == EVP_PKEY_SM2 && !set_sm2_id(mctx, pkey)) in test_builtin()
251 || !TEST_true(EVP_DigestSign(mctx, sig, &sig_len, tbs, sizeof(tbs))) in test_builtin()
253 || !TEST_true(EVP_MD_CTX_reset(mctx)) in test_builtin()
255 || !TEST_true(EVP_DigestVerifyInit(mctx, NULL, NULL, NULL, pkey_neg)) in test_builtin()
256 || (as == EVP_PKEY_SM2 && !set_sm2_id(mctx, pkey_neg)) in test_builtin()
257 || !TEST_int_eq(EVP_DigestVerify(mctx, sig, sig_len, tbs, sizeof(tbs)), 0) in test_builtin()
258 || !TEST_true(EVP_MD_CTX_reset(mctx)) in test_builtin()
260 || !TEST_true(EVP_DigestVerifyInit(mctx, NULL, NULL, NULL, pkey)) in test_builtin()
261 || (as == EVP_PKEY_SM2 && !set_sm2_id(mctx, pkey)) in test_builtin()
262 || !TEST_int_eq(EVP_DigestVerify(mctx, sig, sig_len - 1, tbs, sizeof(tbs)), -1) in test_builtin()
263 || !TEST_true(EVP_MD_CTX_reset(mctx)) in test_builtin()
265 || !TEST_true(EVP_DigestVerifyInit(mctx, NULL, NULL, NULL, pkey)) in test_builtin()
266 || (as == EVP_PKEY_SM2 && !set_sm2_id(mctx, pkey)) in test_builtin()
267 || !TEST_int_eq(EVP_DigestVerify(mctx, sig, sig_len, tbs, sizeof(tbs)), 1) in test_builtin()
268 || !TEST_true(EVP_MD_CTX_reset(mctx))) in test_builtin()
273 if (!TEST_true(EVP_DigestVerifyInit(mctx, NULL, NULL, NULL, pkey)) in test_builtin()
274 || (as == EVP_PKEY_SM2 && !set_sm2_id(mctx, pkey)) in test_builtin()
275 || !TEST_int_eq(EVP_DigestVerify(mctx, sig, sig_len, tbs, sizeof(tbs)), 0) in test_builtin()
276 || !TEST_true(EVP_MD_CTX_reset(mctx))) in test_builtin()
280 if (!TEST_true(EVP_DigestVerifyInit(mctx, NULL, NULL, NULL, pkey)) in test_builtin()
281 || (as == EVP_PKEY_SM2 && !set_sm2_id(mctx, pkey)) in test_builtin()
282 || !TEST_int_eq(EVP_DigestVerify(mctx, sig, sig_len, tbs, sizeof(tbs)), 1) in test_builtin()
283 || !TEST_true(EVP_MD_CTX_reset(mctx))) in test_builtin()
315 if (!TEST_true(EVP_DigestVerifyInit(mctx, NULL, NULL, NULL, pkey)) in test_builtin()
316 || (as == EVP_PKEY_SM2 && !set_sm2_id(mctx, pkey)) in test_builtin()
317 || !TEST_int_ne(EVP_DigestVerify(mctx, sig, sig_len, tbs, sizeof(tbs)), 1) in test_builtin()
318 || !TEST_true(EVP_MD_CTX_reset(mctx))) in test_builtin()
322 if (!TEST_true(EVP_DigestVerifyInit(mctx, NULL, NULL, NULL, pkey)) in test_builtin()
323 || (as == EVP_PKEY_SM2 && !set_sm2_id(mctx, pkey)) in test_builtin()
324 || !TEST_int_eq(EVP_DigestVerify(mctx, sig, sig_len, tbs, sizeof(tbs)), 1) in test_builtin()
325 || !TEST_true(EVP_MD_CTX_reset(mctx))) in test_builtin()
333 EVP_MD_CTX_free(mctx); in test_builtin()