@@ -17,7 +17,9 @@ abstract class InsufficientKeySizeSink extends DataFlow::Node {
1717
1818/** A source for an insufficient key size used in RSA, DSA, and DH algorithms. */
1919private class AsymmetricNonEcSource extends InsufficientKeySizeSource {
20- AsymmetricNonEcSource ( ) { getNodeIntValue ( this ) < getMinAsymNonEcKeySize ( ) }
20+ AsymmetricNonEcSource ( ) {
21+ this .asExpr ( ) .( IntegerLiteral ) .getIntValue ( ) < getMinAsymNonEcKeySize ( )
22+ }
2123
2224 override predicate hasState ( DataFlow:: FlowState state ) {
2325 state = getMinAsymNonEcKeySize ( ) .toString ( )
@@ -27,7 +29,7 @@ private class AsymmetricNonEcSource extends InsufficientKeySizeSource {
2729/** A source for an insufficient key size used in elliptic curve (EC) algorithms. */
2830private class AsymmetricEcSource extends InsufficientKeySizeSource {
2931 AsymmetricEcSource ( ) {
30- getNodeIntValue ( this ) < getMinAsymEcKeySize ( )
32+ this . asExpr ( ) . ( IntegerLiteral ) . getIntValue ( ) < getMinAsymEcKeySize ( )
3133 or
3234 // the below is needed for cases when the key size is embedded in the curve name
3335 getEcKeySize ( this .asExpr ( ) .( StringLiteral ) .getValue ( ) ) < getMinAsymEcKeySize ( )
@@ -40,7 +42,7 @@ private class AsymmetricEcSource extends InsufficientKeySizeSource {
4042
4143/** A source for an insufficient key size used in AES algorithms. */
4244private class SymmetricSource extends InsufficientKeySizeSource {
43- SymmetricSource ( ) { getNodeIntValue ( this ) < getMinSymKeySize ( ) }
45+ SymmetricSource ( ) { this . asExpr ( ) . ( IntegerLiteral ) . getIntValue ( ) < getMinSymKeySize ( ) }
4446
4547 override predicate hasState ( DataFlow:: FlowState state ) { state = getMinSymKeySize ( ) .toString ( ) }
4648}
@@ -54,11 +56,6 @@ private int getMinAsymEcKeySize() { result = 256 }
5456/** Returns the minimum recommended key size for AES algorithms. */
5557private int getMinSymKeySize ( ) { result = 128 }
5658
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-
6259/** Returns the key size from an EC algorithm's curve name string */
6360bindingset [ algorithm]
6461private int getEcKeySize ( string algorithm ) {
0 commit comments