instance method
OpenSSL::PKey::EC::Point#mul
(::OpenSSL::bn bn1, ?::OpenSSL::bn bn2) -> self
(::Array[::OpenSSL::bn] bns, ::Array[self], ?::OpenSSL::bn bn2) -> self
point.mul(bn1 [, bn2]) => point
ext/openssl/ossl_pkey_ec.c
View on GitHub ↗
static VALUE ossl_ec_point_mul(int argc, VALUE *argv, VALUE self)
{
EC_POINT *point_self, *point_result;
const EC_GROUP *group;
VALUE group_v = rb_attr_get(self, id_i_group);
VALUE arg1, arg2, arg3, result;
const BIGNUM *bn_g = NULL;
GetECPoint(self, point_self);
GetECGroup(group_v, group);
result = rb_obj_alloc(cEC_POINT);
ossl_ec_point_initialize(1, &group_v, result);
GetECPoint(result, point_result);
rb_scan_args(argc, argv, "12", &arg1, &arg2, &arg3);
if (RB_TYPE_P(arg1, T_ARRAY) || argc > 2)
rb_raise(rb_eNotImpError, "OpenSSL::PKey::EC::Point#mul with arrays " \
"is no longer supported");
BIGNUM *bn = GetBNPtr(arg1);
if (!NIL_P(arg2))
bn_g = GetBNPtr(arg2);
if (EC_POINT_mul(group, point_result, bn_g, point_self, bn, ossl_bn_ctx) != 1)
ossl_raise(eEC_POINT, NULL);
return result;
}
Performs elliptic curve point multiplication.
The first form calculates bn1 * point + bn2 * G, where G is the generator of the group of point. bn2 may be omitted, and in that case, the result is just bn1 * point.
Before version 4.0.0, and when compiled with OpenSSL 1.1.1 or older, this method allowed another form:
point.mul(bns, points [, bn2]) => point
See also
#make_affine!
#on_curve?
#invert!
#set_to_infinity!
also in
4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0