Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby-openssl
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0045ab724b3b
Choose a base ref
...
head repository: jruby/jruby-openssl
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 45ee02a24352
Choose a head ref
  • 6 commits
  • 7 files changed
  • 1 contributor

Commits on Jul 26, 2017

  1. Copy the full SHA
    4d6a01c View commit details
  2. Copy the full SHA
    86132e0 View commit details
  3. support jruby.openssl.random property for switching a random backend

    we now default to a thread-local holder instance which will be re-using
    secure-random instances using JRuby's ThreadContext ('internals')
    
    **an attempt to 'fix' low-entropy systems** wating for /dev/random 
    
    ... also respect jruby.preferred.prng and use its default - effectively 
    likely avoids BC generator's constant attempts for seeding itself
    
    TO BE CONTINUED ...
    kares committed Jul 26, 2017
    Copy the full SHA
    472e1eb View commit details
  4. Copy the full SHA
    2e6f6a7 View commit details
  5. try tuning JRuby's SecureRandom preferred instance logic a bit

    - default to Windows-PRNG on Windows
    - empty setting will simply use `new SecureRandom()`
    - include some debug logging around fall-backs
    kares committed Jul 26, 2017
    Copy the full SHA
    06431cd View commit details
  6. Copy the full SHA
    45ee02a View commit details
6 changes: 3 additions & 3 deletions Mavenfile
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ plugin( 'org.codehaus.mojo:build-helper-maven-plugin', '1.9' ) do
end

plugin( :compiler, '3.1',
:source => java_target, :target => java_target,
:source => '1.6', :target => java_target,
:encoding => 'UTF-8', :debug => true,
:showWarnings => true, :showDeprecation => true,

@@ -158,7 +158,7 @@ profile :id => 'test-1.7.4' do
end

jruby_1_7_versions = %w{ 1.7.13 1.7.15 1.7.16 1.7.18 1.7.20 1.7.22 1.7.23 }
jruby_1_7_versions += %w{ 1.7.24 1.7.25 1.7.26 }
jruby_1_7_versions += %w{ 1.7.24 1.7.25 1.7.26 1.7.27 }

jruby_1_7_versions.each { |version|

@@ -172,7 +172,7 @@ end

}

jruby_9_K_versions = %w{ 9.0.1.0 9.0.5.0 9.1.0.0 9.1.1.0 9.1.2.0 9.1.5.0 }
jruby_9_K_versions = %w{ 9.0.1.0 9.0.5.0 9.1.2.0 9.1.5.0 9.1.8.0 9.1.12.0 }

jruby_9_K_versions.each { |version|
profile :id => "test-#{version}" do
62 changes: 50 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -829,6 +829,44 @@ DO NOT MODIFIY - GENERATED CODE
<jruby.versions>1.7.26</jruby.versions>
</properties>
</profile>
<profile>
<id>test-1.7.27</id>
<build>
<plugins>
<plugin>
<artifactId>maven-invoker-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<goals>
<goal>install</goal>
<goal>run</goal>
</goals>
<configuration>
<projectsDirectory>integration</projectsDirectory>
<pomIncludes>
<pomInclude>*/pom.xml</pomInclude>
</pomIncludes>
<streamLogs>true</streamLogs>
<properties>
<jruby.versions>${jruby.versions}</jruby.versions>
<jruby.modes>${jruby.modes}</jruby.modes>
<jruby.openssl.version>${project.version}</jruby.openssl.version>
<bc.versions>${bc.versions}</bc.versions>
<runit.dir>${runit.dir}</runit.dir>
</properties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<bc.versions>1.51,1.52,1.53,1.54</bc.versions>
<jruby.modes>1.8,1.9,2.0</jruby.modes>
<jruby.versions>1.7.27</jruby.versions>
</properties>
</profile>
<profile>
<id>test-9.0.1.0</id>
<build>
@@ -906,7 +944,7 @@ DO NOT MODIFIY - GENERATED CODE
</properties>
</profile>
<profile>
<id>test-9.1.0.0</id>
<id>test-9.1.2.0</id>
<build>
<plugins>
<plugin>
@@ -939,12 +977,12 @@ DO NOT MODIFIY - GENERATED CODE
</build>
<properties>
<bc.versions>1.51,1.52,1.53,1.54</bc.versions>
<jruby.version>9.1.0.0</jruby.version>
<jruby.versions>9.1.0.0</jruby.versions>
<jruby.version>9.1.2.0</jruby.version>
<jruby.versions>9.1.2.0</jruby.versions>
</properties>
</profile>
<profile>
<id>test-9.1.1.0</id>
<id>test-9.1.5.0</id>
<build>
<plugins>
<plugin>
@@ -977,12 +1015,12 @@ DO NOT MODIFIY - GENERATED CODE
</build>
<properties>
<bc.versions>1.51,1.52,1.53,1.54</bc.versions>
<jruby.version>9.1.1.0</jruby.version>
<jruby.versions>9.1.1.0</jruby.versions>
<jruby.version>9.1.5.0</jruby.version>
<jruby.versions>9.1.5.0</jruby.versions>
</properties>
</profile>
<profile>
<id>test-9.1.2.0</id>
<id>test-9.1.8.0</id>
<build>
<plugins>
<plugin>
@@ -1015,12 +1053,12 @@ DO NOT MODIFIY - GENERATED CODE
</build>
<properties>
<bc.versions>1.51,1.52,1.53,1.54</bc.versions>
<jruby.version>9.1.2.0</jruby.version>
<jruby.versions>9.1.2.0</jruby.versions>
<jruby.version>9.1.8.0</jruby.version>
<jruby.versions>9.1.8.0</jruby.versions>
</properties>
</profile>
<profile>
<id>test-9.1.5.0</id>
<id>test-9.1.12.0</id>
<build>
<plugins>
<plugin>
@@ -1053,8 +1091,8 @@ DO NOT MODIFIY - GENERATED CODE
</build>
<properties>
<bc.versions>1.51,1.52,1.53,1.54</bc.versions>
<jruby.version>9.1.5.0</jruby.version>
<jruby.versions>9.1.5.0</jruby.versions>
<jruby.version>9.1.12.0</jruby.version>
<jruby.versions>9.1.12.0</jruby.versions>
</properties>
</profile>
<profile>
4 changes: 2 additions & 2 deletions src/main/java/org/jruby/ext/openssl/Cipher.java
Original file line number Diff line number Diff line change
@@ -1321,7 +1321,7 @@ public IRubyObject random_key(final ThreadContext context) {
// str = OpenSSL::Random.random_bytes(self.key_len)
// self.key = str
// return str
RubyString str = Random.random_bytes(context.runtime, this.keyLength);
RubyString str = Random.random_bytes(context, this.keyLength);
this.set_key(context, str); return str;
}

@@ -1330,7 +1330,7 @@ public IRubyObject random_iv(final ThreadContext context) {
// str = OpenSSL::Random.random_bytes(self.iv_len)
// self.iv = str
// return str
RubyString str = Random.random_bytes(context.runtime, this.ivLength);
RubyString str = Random.random_bytes(context, this.ivLength);
this.set_iv(context, str); return str;
}

5 changes: 5 additions & 0 deletions src/main/java/org/jruby/ext/openssl/OpenSSL.java
Original file line number Diff line number Diff line change
@@ -259,6 +259,11 @@ public static String javaVersion(final String def) {
return javaVersionProperty;
}

static boolean javaVersion6(final boolean atLeast) {
final int gt = "1.6".compareTo( javaVersion("0.0").substring(0, 3) );
return atLeast ? gt <= 0 : gt == 0;
}

static boolean javaVersion7(final boolean atLeast) {
final int gt = "1.7".compareTo( javaVersion("0.0").substring(0, 3) );
return atLeast ? gt <= 0 : gt == 0;
Loading