ext/x25519_ref10/x25519_ref10.c in x25519-0.2.0 vs ext/x25519_ref10/x25519_ref10.c in x25519-1.0.0

- old
+ new

@@ -5,27 +5,29 @@ #include "ruby.h" #include "x25519_ref10.h" static VALUE mX25519 = Qnil; -static VALUE mX25519_Ref10 = Qnil; +static VALUE mX25519_Provider = Qnil; +static VALUE mX25519_Provider_Ref10 = Qnil; -static VALUE mX25519_Scalar_multiply(VALUE self, VALUE scalar, VALUE montgomery_u); -static VALUE mX25519_Scalar_multiply_base(VALUE self, VALUE scalar); +static VALUE mX25519_Provider_Ref10_scalarmult(VALUE self, VALUE scalar, VALUE montgomery_u); +static VALUE mX25519_Provider_Ref10_scalarmult_base(VALUE self, VALUE scalar); /* Initialize the x25519_ref10 C extension */ void Init_x25519_ref10() { mX25519 = rb_define_module("X25519"); - mX25519_Ref10 = rb_define_module_under(mX25519, "Ref10"); + mX25519_Provider = rb_define_module_under(mX25519, "Provider"); + mX25519_Provider_Ref10 = rb_define_module_under(mX25519_Provider, "Ref10"); - rb_define_singleton_method(mX25519_Ref10, "multiply", mX25519_Scalar_multiply, 2); - rb_define_singleton_method(mX25519_Ref10, "multiply_base", mX25519_Scalar_multiply_base, 1); + rb_define_singleton_method(mX25519_Provider_Ref10, "scalarmult", mX25519_Provider_Ref10_scalarmult, 2); + rb_define_singleton_method(mX25519_Provider_Ref10, "scalarmult_base", mX25519_Provider_Ref10_scalarmult_base, 1); } /* Variable-base scalar multiplication */ -static VALUE mX25519_Scalar_multiply(VALUE self, VALUE scalar, VALUE montgomery_u) +static VALUE mX25519_Provider_Ref10_scalarmult(VALUE self, VALUE scalar, VALUE montgomery_u) { X25519_KEY product; StringValue(scalar); if(RSTRING_LEN(scalar) != X25519_KEYSIZE_BYTES) { @@ -55,10 +57,10 @@ return rb_str_new((const char *)product, X25519_KEYSIZE_BYTES); } /* Fixed-base scalar multiplication */ -static VALUE mX25519_Scalar_multiply_base(VALUE self, VALUE scalar) +static VALUE mX25519_Provider_Ref10_scalarmult_base(VALUE self, VALUE scalar) { X25519_KEY product; StringValue(scalar); if(RSTRING_LEN(scalar) != X25519_KEYSIZE_BYTES) {