Skip to content

Commit

Permalink
[refactor] move _compat23.rb left-overs to native
Browse files Browse the repository at this point in the history
  • Loading branch information
kares committed Dec 13, 2024
1 parent 53901e5 commit 888eb19
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 32 deletions.
30 changes: 0 additions & 30 deletions lib/jopenssl/_compat23.rb

This file was deleted.

2 changes: 0 additions & 2 deletions lib/jopenssl/load.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,3 @@ def self.secure_compare(a, b)
OpenSSL.fixed_length_secure_compare(hashed_a, hashed_b) && a == b
end
end

load 'jopenssl/_compat23.rb'
17 changes: 17 additions & 0 deletions src/main/java/org/jruby/ext/openssl/PKeyDH.java
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,16 @@ public IRubyObject q(final ThreadContext context) {
return context.nil;
}

@JRubyMethod
public IRubyObject set_pqg(final ThreadContext context, IRubyObject p, IRubyObject q, IRubyObject g) {
set_p(p);
if (!q.isNil()) {
OpenSSL.warn(context, "JRuby-OpenSSL does not support setting q param on " + inspect());
}
set_g(g);
return this;
}

// don't need synchronized as value is volatile
@JRubyMethod(name = "pub_key")
public IRubyObject pub_key() {
Expand Down Expand Up @@ -421,6 +431,13 @@ public synchronized IRubyObject set_priv_key(IRubyObject arg) {
return arg;
}

@JRubyMethod
public IRubyObject set_key(final ThreadContext context, IRubyObject pub_key, IRubyObject priv_key) {
set_pub_key(pub_key);
set_priv_key(priv_key);
return this;
}

private IRubyObject newBN(BigInteger value) {
if (value == null) return getRuntime().getNil();
return BN.newBN(getRuntime(), value);
Expand Down

0 comments on commit 888eb19

Please sign in to comment.