1313import cpp
1414
1515/**
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.
1717 */
1818string encryptionWord ( ) {
1919 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`.
2121 // `(?!P)` is negative lookahead, i.e. the match is not followed by `P`.
2222 word =
2323 [
@@ -27,9 +27,8 @@ string encryptionWord() {
2727 //"Asn[0-9]",
2828 "Camellia" ,
2929 //"(?<!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]"
3332 ] and
3433 (
3534 result = word or
@@ -40,8 +39,8 @@ string encryptionWord() {
4039}
4140
4241/**
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).
4544 */
4645predicate likelyEncryptionFunction ( Function f ) {
4746 exists ( string fName | fName = f .getName ( ) |
@@ -50,18 +49,19 @@ predicate likelyEncryptionFunction(Function f) {
5049}
5150
5251/**
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.
5554 */
5655predicate computeHeuristicType ( Type t ) {
5756 t instanceof IntegralType or
5857 computeHeuristicType ( t .( ArrayType ) .getBaseType ( ) .getUnspecifiedType ( ) )
5958}
6059
6160/**
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.
6565 */
6666predicate computeHeuristic ( Expr e ) {
6767 (
0 commit comments