Skip to content

Commit 5975e19

Browse files
committed
sync identical files
1 parent 2a8807e commit 5975e19

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

python/ql/lib/semmle/python/concepts/CryptoAlgorithms.qll

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,30 @@ private module AlgorithmNames {
3131
}
3232

3333
predicate isStrongEncryptionAlgorithm(string name) {
34-
name = ["AES", "AES128", "AES192", "AES256", "AES512", "RSA", "RABBIT", "BLOWFISH"]
34+
name = [appendMode("AES"), "AES128", "AES192", "AES256", "AES512", "RSA", "RABBIT", "BLOWFISH"]
35+
}
36+
37+
/**
38+
* Gets the name with a mode of operation added as a suffix.
39+
*/
40+
bindingset[name]
41+
private string appendMode(string name) {
42+
result = name + ["", "CBC", "ECB", "CFB", "OFB", "CTR", "GCM"]
3543
}
3644

3745
predicate isWeakEncryptionAlgorithm(string name) {
3846
name =
3947
[
40-
"DES", "3DES", "TRIPLEDES", "TDEA", "TRIPLEDEA", "ARC2", "RC2", "ARC4", "RC4", "ARCFOUR",
41-
"ARC5", "RC5"
48+
appendMode("DES"), appendMode("3DES"), "TRIPLEDES", "TDEA", "TRIPLEDEA", "ARC2", "RC2",
49+
"ARC4", "RC4", "ARCFOUR", "ARC5", "RC5"
4250
]
4351
}
4452

4553
predicate isStrongPasswordHashingAlgorithm(string name) {
4654
name = ["ARGON2", "PBKDF2", "BCRYPT", "SCRYPT"]
4755
}
4856

49-
predicate isWeakPasswordHashingAlgorithm(string name) { none() }
57+
predicate isWeakPasswordHashingAlgorithm(string name) { name = "EVPKDF" }
5058
}
5159

5260
private import AlgorithmNames

0 commit comments

Comments
 (0)