Skip to content

Commit 28ccc83

Browse files
committed
Adding a means to distinguish asymmetric algorithms.
1 parent 1958c19 commit 28ccc83

File tree

1 file changed

+13
-0
lines changed
  • shared/cryptography/codeql/cryptography

1 file changed

+13
-0
lines changed

shared/cryptography/codeql/cryptography/Model.qll

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2122,6 +2122,12 @@ module CryptographyBase<LocationSig Location, InputSig<Location> Input> {
21222122
*/
21232123
KeyOpAlg::Algorithm getAlgorithmType() { result = instance.asAlg().getAlgorithmType() }
21242124

2125+
predicate isAsymmetric() {
2126+
this.getAlgorithmType() instanceof KeyOpAlg::TAsymmetricCipher
2127+
or
2128+
this.getAlgorithmType() instanceof KeyOpAlg::TSignature
2129+
}
2130+
21252131
/**
21262132
* Gets the mode of operation of this cipher, e.g., "GCM" or "CBC".
21272133
*/
@@ -2442,4 +2448,11 @@ module CryptographyBase<LocationSig Location, InputSig<Location> Input> {
24422448
location = this.getLocation()
24432449
}
24442450
}
2451+
2452+
predicate isAsymmetricAlgorithm(AlgorithmNode node) {
2453+
node instanceof EllipticCurveNode
2454+
or
2455+
node instanceof KeyOperationAlgorithmNode and node.(KeyOperationAlgorithmNode).isAsymmetric()
2456+
// TODO: get unknown algorithms from known asymmetric operations
2457+
}
24452458
}

0 commit comments

Comments
 (0)