Content-Length: 299928 | pFad | http://github.com/jruby/jruby-openssl/pull/307/commits/dd59f740e22a89a7963b793129a4448fc2cb3781

BB Implement Point#mul by headius · Pull Request #307 · jruby/jruby-openssl · GitHub
Skip to content

Implement Point#mul #307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 17, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add Point#mul
  • Loading branch information
headius committed Jun 11, 2024
commit dd59f740e22a89a7963b793129a4448fc2cb3781
26 changes: 26 additions & 0 deletions src/main/java/org/jruby/ext/openssl/PKeyEC.java
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,32 @@ public IRubyObject inspect() {
return ObjectSupport.inspect(this, (List) Collections.singletonList(entry));
}

@JRubyMethod(name = "add")
public IRubyObject add(final ThreadContext context, final IRubyObject other) {
Ruby runtime = context.runtime;

org.bouncycastle.math.ec.ECPoint pointSelf, pointOther, pointResult;

Group groupV = this.group;
Point result;

ECCurve selfCurve = EC5Util.convertCurve(groupV.getCurve());
pointSelf = EC5Util.convertPoint(selfCurve, asECPoint());

Point otherPoint = (Point) other;
ECCurve otherCurve = EC5Util.convertCurve(otherPoint.group.getCurve());
pointOther = EC5Util.convertPoint(otherCurve, otherPoint.asECPoint());

pointResult = pointSelf.add(pointOther);
if (pointResult == null) {
newECError(runtime, "EC_POINT_add");
}

result = new Point(runtime, EC5Util.convertPoint(pointResult), group);

return result;
}

@JRubyMethod(name = "mul", required = 1, optional = 2)
public IRubyObject mul(final ThreadContext context, final IRubyObject[] args) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is at least one other math operation on ECPoint that this change now makes it easy to support: add

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I'll do add in another PR!

Ruby runtime = context.runtime;
Expand Down








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/jruby/jruby-openssl/pull/307/commits/dd59f740e22a89a7963b793129a4448fc2cb3781

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy