Skip to content

Commit b3eaa46

Browse files
committed
Python: Use consistent abbreviations in weak-crypto query message.
1 parent 4f0a666 commit b3eaa46

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

python/ql/src/Security/CWE-326/WeakCrypto.ql

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ int minimumSecureKeySize(string algo) {
1616
or
1717
algo = "RSA" and result = 2048
1818
or
19-
algo = "elliptic curve" and result = 224
19+
algo = "ECC" and result = 224
2020
}
2121

2222
predicate dsaRsaKeySizeArg(FunctionObject obj, string algorithm, string arg) {
@@ -39,9 +39,6 @@ predicate dsaRsaKeySizeArg(FunctionObject obj, string algorithm, string arg) {
3939
or
4040
mod.getName() = "Cryptodome.PublicKey.RSA" and arg = "bits"
4141
)
42-
or
43-
algorithm = "elliptic curve" and
44-
mod.getName() = "cryptography.hazmat.primitives.asymmetric.ec" and arg = "curve"
4542
)
4643
}
4744

@@ -68,7 +65,7 @@ predicate algorithmAndKeysizeForCall(CallNode call, string algorithm, int keySiz
6865
exists(ClassObject curve |
6966
arg.refersTo(_, curve, keyOrigin) and
7067
ecKeySizeArg(func, argname) and
71-
algorithm = "elliptic curve" and
68+
algorithm = "ECC" and
7269
keySize = keySizeFromCurve(curve)
7370
)
7471
)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
| weak_crypto.py:67:1:67:30 | ControlFlowNode for dsa_gen_key() | Creation of an DSA key uses $@ bits, which is below 2048 and considered breakable. | weak_crypto.py:12:12:12:15 | ControlFlowNode for IntegerLiteral | 1024 |
2-
| weak_crypto.py:68:1:68:28 | ControlFlowNode for ec_gen_key() | Creation of an elliptic curve key uses $@ bits, which is below 224 and considered breakable. | weak_crypto.py:21:11:21:33 | ControlFlowNode for FakeWeakEllipticCurve() | 160 |
2+
| weak_crypto.py:68:1:68:28 | ControlFlowNode for ec_gen_key() | Creation of an ECC key uses $@ bits, which is below 224 and considered breakable. | weak_crypto.py:21:11:21:33 | ControlFlowNode for FakeWeakEllipticCurve() | 160 |
33
| weak_crypto.py:69:1:69:37 | ControlFlowNode for rsa_gen_key() | Creation of an RSA key uses $@ bits, which is below 2048 and considered breakable. | weak_crypto.py:12:12:12:15 | ControlFlowNode for IntegerLiteral | 1024 |
44
| weak_crypto.py:71:1:71:22 | ControlFlowNode for Attribute() | Creation of an DSA key uses $@ bits, which is below 2048 and considered breakable. | weak_crypto.py:12:12:12:15 | ControlFlowNode for IntegerLiteral | 1024 |
55
| weak_crypto.py:72:1:72:22 | ControlFlowNode for Attribute() | Creation of an RSA key uses $@ bits, which is below 2048 and considered breakable. | weak_crypto.py:12:12:12:15 | ControlFlowNode for IntegerLiteral | 1024 |

0 commit comments

Comments
 (0)