13
13
import cpp
14
14
15
15
/**
16
- * A word that might be in the name of an encryption function.
16
+ * Gets a word that might be in the name of an encryption function.
17
17
*/
18
18
string encryptionWord ( ) {
19
19
exists ( string word |
20
- // `(?<!P)` is negative lookbehind, i.e. the match is not preceeded by `P`.
20
+ // `(?<!P)` is negative lookbehind, i.e. the match is not preceded by `P`.
21
21
// `(?!P)` is negative lookahead, i.e. the match is not followed by `P`.
22
22
word =
23
23
[
@@ -27,9 +27,8 @@ string encryptionWord() {
27
27
//"Asn[0-9]",
28
28
"Camellia" ,
29
29
//"(?<!Bit|Type)Cast",
30
- "Chacha" , "ChaCha" , "Idea" , "Poly[0-9]" , "Ripemd" , "Whirlpool" , "Sbox" , "SBox" , "Cblock" ,
31
- "CBlock" , "Sub.?Byte" , "Mix.?Column" , "ECDH" , "ECDSA" , "EdDSA" , "ECMQV" , "ECQV" ,
32
- "Curve[0-9][0-9]"
30
+ "Chacha" , "ChaCha" , "Poly[0-9]" , "Ripemd" , "Whirlpool" , "Sbox" , "SBox" , "Cblock" , "CBlock" ,
31
+ "Sub.?Byte" , "Mix.?Column" , "ECDH" , "ECDSA" , "EdDSA" , "ECMQV" , "ECQV" , "Curve[0-9][0-9]"
33
32
] and
34
33
(
35
34
result = word or
@@ -40,8 +39,8 @@ string encryptionWord() {
40
39
}
41
40
42
41
/**
43
- * A function whose name suggests it may be doing encryption (but may or may
44
- * not actually implement an encryption primitive itself).
42
+ * Holds if `f` is a function whose name suggests it may be doing encryption
43
+ * (but may or may not actually implement an encryption primitive itself).
45
44
*/
46
45
predicate likelyEncryptionFunction ( Function f ) {
47
46
exists ( string fName | fName = f .getName ( ) |
@@ -50,18 +49,19 @@ predicate likelyEncryptionFunction(Function f) {
50
49
}
51
50
52
51
/**
53
- * A type that is common in encryption-like computations. That is, an integral
54
- * type or array of integral type elements.
52
+ * Holds if `t` is a type that is common in encryption-like computations. That
53
+ * is, an integral type or array of integral type elements.
55
54
*/
56
55
predicate computeHeuristicType ( Type t ) {
57
56
t instanceof IntegralType or
58
57
computeHeuristicType ( t .( ArrayType ) .getBaseType ( ) .getUnspecifiedType ( ) )
59
58
}
60
59
61
60
/**
62
- * An operation that is common in encryption-like computations. Looking for
63
- * clusters of these tends to find things like encrpytion, compression, random
64
- * number generation, graphics processing and other compute heavy algoritms.
61
+ * Holds if `e` is an operation that is common in encryption-like computations.
62
+ * Looking for clusters of these tends to find things like encrpytion,
63
+ * compression, random number generation, graphics processing and other compute
64
+ * heavy algorithms.
65
65
*/
66
66
predicate computeHeuristic ( Expr e ) {
67
67
(
0 commit comments