Skip to content

Commit eceda7a

Browse files
committed
More cleanup
1 parent 43760b6 commit eceda7a

File tree

2 files changed

+10
-51
lines changed

2 files changed

+10
-51
lines changed

cpp/ql/src/experimental/campaigns/nccoe-pqc-migration/QuantumVulnerableDiscovery/WinCng/WinCng.ql

Lines changed: 0 additions & 39 deletions
This file was deleted.

cpp/ql/src/experimental/campaigns/nccoe-pqc-migration/QuantumVulnerableDiscovery/WinCng/WindowsCngPQCVulnerableUsage.qll

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
11
import cpp
22
import WindowsCng
33

4-
predicate vulnerableCngFunctionName(string name) { name in ["BCryptSignHash", "BCryptEncrypt"] }
5-
64
predicate keyGenAndImportFunctionName(string name) { name in ["BCryptImportKeyPair", "BCryptGenerateKeyPair"] }
75

8-
predicate vulnerableCngFunction(Function f) {
9-
exists(string name | f.hasGlobalName(name) and vulnerableCngFunctionName(name))
10-
}
11-
126
predicate keyGenAndImportFunction(Function f){
137
exists(string name | f.hasGlobalName(name) and keyGenAndImportFunctionName(name))
148
}
159

1610
//TODO: Verify NCrypt calls (parameters) & find all other APIs that should be included (i.e. decrypt, etc.)
17-
predicate isExprKeyHandleForBCryptSignHash(Expr e) {
18-
exists(FunctionCall call |
19-
e = call.getArgument(0) and
20-
vulnerableCngFunction(call.getTarget())
21-
)
11+
12+
13+
predicate isCallArgument(string funcGlobalName, Expr arg, int index){
14+
exists(Call c | c.getArgument(index) = arg and c.getTarget().hasGlobalName(funcGlobalName))
2215
}
2316

2417
class BCryptSignHashArgumentSink extends BCryptOpenAlgorithmProviderSink {
25-
BCryptSignHashArgumentSink() { isExprKeyHandleForBCryptSignHash(this.asExpr()) }
18+
BCryptSignHashArgumentSink() { isCallArgument("BCryptSignHash", this.asExpr(), 0) }
2619
}
2720

21+
class BCryptEncryptArgumentSink extends BCryptOpenAlgorithmProviderSink {
22+
BCryptEncryptArgumentSink() { isCallArgument("BCryptEncrypt", this.asExpr(), 0) }
23+
}
24+
25+
2826
class BCryptOpenAlgorithmProviderPqcVulnerableAlgorithmsSource extends BCryptOpenAlgorithmProviderSource {
2927
BCryptOpenAlgorithmProviderPqcVulnerableAlgorithmsSource() {
3028
this.asExpr() instanceof StringLiteral and

0 commit comments

Comments
 (0)