Lines Matching refs:ctx

39 EC_KEY *EC_KEY_new_ex(OSSL_LIB_CTX *ctx, const char *propq)
41 return ossl_ec_key_new_method_int(ctx, propq, NULL);
44 EC_KEY *EC_KEY_new_by_curve_name_ex(OSSL_LIB_CTX *ctx, const char *propq,
47 EC_KEY *ret = EC_KEY_new_ex(ctx, propq);
50 ret->group = EC_GROUP_new_by_curve_name_ex(ctx, propq, nid);
259 BN_CTX *ctx = BN_CTX_secure_new_ex(eckey->libctx);
262 if (ctx == NULL)
303 if (!BN_priv_rand_range_ex(priv_key, order, 0, ctx))
315 if (!EC_POINT_mul(group, pub_key, priv_key, NULL, NULL, ctx))
348 BN_CTX_free(ctx);
361 BN_CTX *ctx = BN_CTX_new_ex(eckey->libctx);
363 if (ctx == NULL)
371 NULL, ctx);
373 BN_CTX_free(ctx);
404 static int ec_key_public_range_check(BN_CTX *ctx, const EC_KEY *key)
409 BN_CTX_start(ctx);
410 x = BN_CTX_get(ctx);
411 y = BN_CTX_get(ctx);
415 if (!EC_POINT_get_affine_coordinates(key->group, key->pub_key, x, y, ctx))
433 BN_CTX_end(ctx);
441 int ossl_ec_key_public_check_quick(const EC_KEY *eckey, BN_CTX *ctx)
455 if (!ec_key_public_range_check(ctx, eckey)) {
461 if (EC_POINT_is_on_curve(eckey->group, eckey->pub_key, ctx) <= 0) {
472 int ossl_ec_key_public_check(const EC_KEY *eckey, BN_CTX *ctx)
478 if (!ossl_ec_key_public_check_quick(eckey, ctx))
491 if (!EC_POINT_mul(eckey->group, point, NULL, eckey->pub_key, order, ctx)) {
529 int ossl_ec_key_pairwise_check(const EC_KEY *eckey, BN_CTX *ctx)
547 if (!EC_POINT_mul(eckey->group, point, eckey->priv_key, NULL, NULL, ctx)) {
551 if (EC_POINT_cmp(eckey->group, point, eckey->pub_key, ctx) != 0) {
575 BN_CTX *ctx = NULL;
581 if ((ctx = BN_CTX_new_ex(eckey->libctx)) == NULL)
584 if (!ossl_ec_key_public_check(eckey, ctx))
589 || !ossl_ec_key_pairwise_check(eckey, ctx))
594 BN_CTX_free(ctx);
601 BN_CTX *ctx = NULL;
610 ctx = BN_CTX_new_ex(key->libctx);
611 if (ctx == NULL)
614 BN_CTX_start(ctx);
620 tx = BN_CTX_get(ctx);
621 ty = BN_CTX_get(ctx);
625 if (!EC_POINT_set_affine_coordinates(key->group, point, x, y, ctx))
627 if (!EC_POINT_get_affine_coordinates(key->group, point, tx, ty, ctx))
649 BN_CTX_end(ctx);
650 BN_CTX_free(ctx);
835 int EC_KEY_precompute_mult(EC_KEY *key, BN_CTX *ctx)
839 return EC_GROUP_precompute_mult(key->group, ctx);
868 unsigned char **pbuf, BN_CTX *ctx)
872 return EC_POINT_point2buf(key->group, key->pub_key, form, pbuf, ctx);
876 BN_CTX *ctx)
884 if (EC_POINT_oct2point(key->group, key->pub_key, buf, len, ctx) == 0)