mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
C++: Rearrange the library.
This commit is contained in:
@@ -18,7 +18,7 @@ abstract class InsecureCryptoSpec extends Locatable {
|
||||
}
|
||||
|
||||
Function getAnInsecureFunction() {
|
||||
result.getName().regexpMatch(getInsecureAlgorithmRegex()) and
|
||||
isInsecureEncryption(result.getName()) and
|
||||
exists(result.getACallToThisFunction())
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class InsecureFunctionCall extends InsecureCryptoSpec, FunctionCall {
|
||||
}
|
||||
|
||||
Macro getAnInsecureMacro() {
|
||||
result.getName().regexpMatch(getInsecureAlgorithmRegex()) and
|
||||
isInsecureEncryption(result.getName()) and
|
||||
exists(result.getAnInvocation())
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,13 @@ string getAnInsecureAlgorithmName() {
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of an algorithm that is known to be secure.
|
||||
*/
|
||||
string getASecureAlgorithmName() {
|
||||
result = ["RSA", "SHA256", "CCM", "GCM", "AES", "Blowfish", "ECIES"]
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of a hash algorithm that is insecure if it is being used for
|
||||
* encryption (but it is hard to know when that is happening).
|
||||
@@ -39,10 +46,11 @@ string getInsecureAlgorithmRegex() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of an algorithm that is known to be secure.
|
||||
* Holds if `name` looks like it might be related to operations with an
|
||||
* insecure encyption algorithm.
|
||||
*/
|
||||
string getASecureAlgorithmName() {
|
||||
result = ["RSA", "SHA256", "CCM", "GCM", "AES", "Blowfish", "ECIES"]
|
||||
bindingset[name] predicate isInsecureEncryption(string name) {
|
||||
name.regexpMatch(getInsecureAlgorithmRegex())
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user