Skip to content

Commit 4e93b0f

Browse files
committed
refactor fields + for now comment out ones that are not used with the inner Def class
1 parent 7e1b920 commit 4e93b0f

File tree

2 files changed

+27
-25
lines changed

2 files changed

+27
-25
lines changed

src/main/java/org/jruby/ext/openssl/CipherStrings.java

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -386,30 +386,30 @@ public class CipherStrings {
386386

387387
static final class Def implements Comparable<Def>, Cloneable {
388388

389-
final int valid;
389+
//private final byte valid;
390390
final String name;
391-
final long id;
391+
//private final long id;
392392
final long algorithms;
393-
final long algo_strength;
394-
final long algorithm2;
395-
final int strength_bits;
396-
final int alg_bits;
397-
final long mask;
398-
final long mask_strength;
393+
private final long algStrength;
394+
//final long algorithm2;
395+
final int algStrengthBits;
396+
final int algBits;
397+
private final long mask;
398+
private final long algStrengthMask;
399399

400400
private volatile String cipherSuite;
401401

402-
Def(int valid, String name, long id, long algorithms, long algo_strength, long algorithm2, int strength_bits, int alg_bits, long mask, long mask_strength) {
403-
this.valid = valid;
402+
Def(int valid, String name, long id, long algorithms, long algo_strength, long algorithm2, int strength_bits, int alg_bits, long mask, long maskStrength) {
403+
//this.valid = (byte) valid;
404404
this.name = name;
405-
this.id = id;
405+
//this.id = id;
406406
this.algorithms = algorithms;
407-
this.algo_strength = algo_strength;
408-
this.algorithm2 = algorithm2;
409-
this.strength_bits = strength_bits;
410-
this.alg_bits = alg_bits;
407+
this.algStrength = algo_strength;
408+
//this.algorithm2 = algorithm2;
409+
this.algStrengthBits = strength_bits;
410+
this.algBits = alg_bits;
411411
this.mask = mask;
412-
this.mask_strength = mask_strength;
412+
this.algStrengthMask = maskStrength;
413413
}
414414

415415
public String getCipherSuite() {
@@ -451,12 +451,14 @@ public boolean equals(Object other) {
451451

452452
@Override
453453
public int compareTo(final Def that) {
454-
return this.strength_bits - that.strength_bits;
454+
return this.algStrengthBits - that.algStrengthBits;
455455
}
456456

457457
@Override
458458
public String toString() {
459-
return "Cipher<" + name + ">";
459+
return getClass().getSimpleName() + '@' +
460+
Integer.toHexString(System.identityHashCode(this)) +
461+
'<' + name + '>';
460462
}
461463

462464
// from ssl_cipher_apply_rule
@@ -472,11 +474,11 @@ public boolean matches(Def current) {
472474
// ((ma_s & algo_strength) != ma_s))
473475
// continue; // does not apply
474476
// }
475-
long ma = mask & current.algorithms;
476-
long ma_s = mask_strength & current.algo_strength;
477-
if (((ma == 0) && (ma_s == 0)) ||
478-
((ma & algorithms) != ma) ||
479-
((ma_s & algo_strength) != ma_s)) {
477+
final long ma = this.mask & current.algorithms;
478+
final long ma_s = this.algStrengthMask & current.algStrength;
479+
if ( ( ma == 0 && ma_s == 0 ) ||
480+
( (ma & this.algorithms) != ma ) ||
481+
( (ma_s & this.algStrength) != ma_s) ) {
480482
return false;
481483
}
482484
return true;

src/main/java/org/jruby/ext/openssl/SSLContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,8 @@ private RubyArray matchedCiphers(final ThreadContext context) {
433433
final RubyArray cipher = runtime.newArray(4);
434434
cipher.store(0, newUTF8String(runtime, def.name));
435435
cipher.store(1, newUTF8String(runtime, sslVersionString(def.algorithms)));
436-
cipher.store(2, runtime.newFixnum(def.strength_bits));
437-
cipher.store(3, runtime.newFixnum(def.alg_bits));
436+
cipher.store(2, runtime.newFixnum(def.algStrengthBits));
437+
cipher.store(3, runtime.newFixnum(def.algBits));
438438

439439
cipherList.append(cipher);
440440
}

0 commit comments

Comments
 (0)