Skip to content

Commit 43760b6

Browse files
committed
Misc. compartmentalization and naming changes.
1 parent 1e9c2b3 commit 43760b6

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import cpp
1515
import DataFlow::PathGraph
1616
import WindowsCng
17-
import WindowsCngPQCVAsymmetricKeyUsage
17+
import WindowsCngPQCVulnerableUsage
1818

1919
// CNG-specific DataFlow configuration
2020
class BCryptConfiguration extends DataFlow::Configuration {
@@ -30,7 +30,7 @@ class BCryptConfiguration extends DataFlow::Configuration {
3030
}
3131

3232
override predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
33-
isWindowsCngAsymmetricKeyAdditionalTaintStep( node1, node2)
33+
isWindowsCngAdditionalTaintStep( node1, node2)
3434
}
3535
}
3636

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@ import WindowsCng
33

44
predicate vulnerableCngFunctionName(string name) { name in ["BCryptSignHash", "BCryptEncrypt"] }
55

6+
predicate keyGenAndImportFunctionName(string name) { name in ["BCryptImportKeyPair", "BCryptGenerateKeyPair"] }
7+
68
predicate vulnerableCngFunction(Function f) {
79
exists(string name | f.hasGlobalName(name) and vulnerableCngFunctionName(name))
810
}
911

12+
predicate keyGenAndImportFunction(Function f){
13+
exists(string name | f.hasGlobalName(name) and keyGenAndImportFunctionName(name))
14+
}
15+
1016
//TODO: Verify NCrypt calls (parameters) & find all other APIs that should be included (i.e. decrypt, etc.)
1117
predicate isExprKeyHandleForBCryptSignHash(Expr e) {
1218
exists(FunctionCall call |
@@ -42,15 +48,12 @@ predicate stepOpenAlgorithmProvider(DataFlow::Node node1, DataFlow::Node node2)
4248
predicate stepImportGenerateKeyPair(DataFlow::Node node1, DataFlow::Node node2) {
4349
exists(FunctionCall call |
4450
node1.asExpr() = call.getArgument(0) and
45-
(
46-
call.getTarget().hasGlobalName("BCryptImportKeyPair") or
47-
call.getTarget().hasGlobalName("BCryptGenerateKeyPair")
48-
) and
51+
keyGenAndImportFunction(call.getTarget()) and
4952
node2.asDefiningArgument() = call.getArgument(1)
5053
)
5154
}
5255

53-
predicate isWindowsCngAsymmetricKeyAdditionalTaintStep(DataFlow::Node node1, DataFlow::Node node2) {
56+
predicate isWindowsCngAdditionalTaintStep(DataFlow::Node node1, DataFlow::Node node2) {
5457
stepOpenAlgorithmProvider(node1, node2)
5558
or
5659
stepImportGenerateKeyPair(node1, node2)

0 commit comments

Comments
 (0)