@@ -17,7 +17,9 @@ abstract class InsufficientKeySizeSink extends DataFlow::Node {
17
17
18
18
/** A source for an insufficient key size used in RSA, DSA, and DH algorithms. */
19
19
private class AsymmetricNonEcSource extends InsufficientKeySizeSource {
20
- AsymmetricNonEcSource ( ) { getNodeIntValue ( this ) < getMinAsymNonEcKeySize ( ) }
20
+ AsymmetricNonEcSource ( ) {
21
+ this .asExpr ( ) .( IntegerLiteral ) .getIntValue ( ) < getMinAsymNonEcKeySize ( )
22
+ }
21
23
22
24
override predicate hasState ( DataFlow:: FlowState state ) {
23
25
state = getMinAsymNonEcKeySize ( ) .toString ( )
@@ -27,7 +29,7 @@ private class AsymmetricNonEcSource extends InsufficientKeySizeSource {
27
29
/** A source for an insufficient key size used in elliptic curve (EC) algorithms. */
28
30
private class AsymmetricEcSource extends InsufficientKeySizeSource {
29
31
AsymmetricEcSource ( ) {
30
- getNodeIntValue ( this ) < getMinAsymEcKeySize ( )
32
+ this . asExpr ( ) . ( IntegerLiteral ) . getIntValue ( ) < getMinAsymEcKeySize ( )
31
33
or
32
34
// the below is needed for cases when the key size is embedded in the curve name
33
35
getEcKeySize ( this .asExpr ( ) .( StringLiteral ) .getValue ( ) ) < getMinAsymEcKeySize ( )
@@ -40,7 +42,7 @@ private class AsymmetricEcSource extends InsufficientKeySizeSource {
40
42
41
43
/** A source for an insufficient key size used in AES algorithms. */
42
44
private class SymmetricSource extends InsufficientKeySizeSource {
43
- SymmetricSource ( ) { getNodeIntValue ( this ) < getMinSymKeySize ( ) }
45
+ SymmetricSource ( ) { this . asExpr ( ) . ( IntegerLiteral ) . getIntValue ( ) < getMinSymKeySize ( ) }
44
46
45
47
override predicate hasState ( DataFlow:: FlowState state ) { state = getMinSymKeySize ( ) .toString ( ) }
46
48
}
@@ -54,11 +56,6 @@ private int getMinAsymEcKeySize() { result = 256 }
54
56
/** Returns the minimum recommended key size for AES algorithms. */
55
57
private int getMinSymKeySize ( ) { result = 128 }
56
58
57
- /** Returns the integer value of a given DataFlow::Node. */
58
- private int getNodeIntValue ( DataFlow:: Node node ) {
59
- result = node .asExpr ( ) .( IntegerLiteral ) .getIntValue ( )
60
- }
61
-
62
59
/** Returns the key size from an EC algorithm's curve name string */
63
60
bindingset [ algorithm]
64
61
private int getEcKeySize ( string algorithm ) {
0 commit comments