Skip to content

Commit 103796d

Browse files
committed
C++: respond to PR comments on InsufficientKeySize
1 parent cfd9c9d commit 103796d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

cpp/ql/src/Security/CWE/CWE-326/InsufficientKeySize.ql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @name Use of a cryptographic algorithm with insufficient key size
33
* @description Using cryptographic algorithms with too small a key size can
44
* allow an attacker to compromise security.
5-
* @kind problem
5+
* @kind path-problem
66
* @problem.severity error
77
* @precision high
88
* @id cpp/insufficient-key-size
@@ -43,13 +43,13 @@ class KeyStrengthFlow extends DataFlow::Configuration {
4343
}
4444

4545
from
46-
DataFlow::PathNode source, DataFlow::PathNode sink, KeyStrengthFlow conf, FunctionCall fc,
46+
DataFlow::PathNode source, DataFlow::PathNode sink, KeyStrengthFlow conf, FunctionCall fc, int param,
4747
string name, int bits
4848
where
4949
conf.hasFlowPath(source, sink) and
50-
sink.getNode().asExpr() = fc.getArgument(1) and
50+
sink.getNode().asExpr() = fc.getArgument(param) and
5151
fc.getTarget().hasGlobalName(name) and
52-
bits = getMinimumKeyStrength(name, _) and
52+
bits = getMinimumKeyStrength(name, param) and
5353
source.getNode().asInstruction().(ConstantValueInstruction).getValue().toInt() < bits
5454
select fc, source, sink,
5555
"The key size $@ is less than the recommended key size of " + bits.toString() + " bits.", source,
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
| test.cpp:32:5:32:38 | call to EVP_PKEY_CTX_set_dsa_paramgen_bits | test.cpp:32:45:32:48 | 1024 | test.cpp:32:45:32:48 | 1024 | The key size $@ is insufficient for security | test.cpp:32:45:32:48 | 1024 | 1024 |
2-
| test.cpp:33:5:33:42 | call to EVP_PKEY_CTX_set_dh_paramgen_prime_len | test.cpp:33:49:33:52 | 1024 | test.cpp:33:49:33:52 | 1024 | The key size $@ is insufficient for security | test.cpp:33:49:33:52 | 1024 | 1024 |
3-
| test.cpp:35:5:35:36 | call to EVP_PKEY_CTX_set_rsa_keygen_bits | test.cpp:35:43:35:46 | 1024 | test.cpp:35:43:35:46 | 1024 | The key size $@ is insufficient for security | test.cpp:35:43:35:46 | 1024 | 1024 |
1+
| test.cpp:34:5:34:38 | call to EVP_PKEY_CTX_set_dsa_paramgen_bits | test.cpp:34:45:34:48 | 1024 | test.cpp:34:45:34:48 | 1024 | The key size $@ is less than the recommended key size of 2048 bits. | test.cpp:34:45:34:48 | 1024 | 1024 |
2+
| test.cpp:35:5:35:42 | call to EVP_PKEY_CTX_set_dh_paramgen_prime_len | test.cpp:35:49:35:52 | 1024 | test.cpp:35:49:35:52 | 1024 | The key size $@ is less than the recommended key size of 2048 bits. | test.cpp:35:49:35:52 | 1024 | 1024 |
3+
| test.cpp:37:5:37:36 | call to EVP_PKEY_CTX_set_rsa_keygen_bits | test.cpp:37:43:37:46 | 1024 | test.cpp:37:43:37:46 | 1024 | The key size $@ is less than the recommended key size of 2048 bits. | test.cpp:37:43:37:46 | 1024 | 1024 |

0 commit comments

Comments
 (0)