mirror of
https://github.com/github/codeql.git
synced 2026-04-20 14:34:04 +02:00
Adding a means to distinguish asymmetric algorithms.
This commit is contained in:
@@ -2122,6 +2122,12 @@ module CryptographyBase<LocationSig Location, InputSig<Location> Input> {
|
||||
*/
|
||||
KeyOpAlg::Algorithm getAlgorithmType() { result = instance.asAlg().getAlgorithmType() }
|
||||
|
||||
predicate isAsymmetric() {
|
||||
this.getAlgorithmType() instanceof KeyOpAlg::TAsymmetricCipher
|
||||
or
|
||||
this.getAlgorithmType() instanceof KeyOpAlg::TSignature
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the mode of operation of this cipher, e.g., "GCM" or "CBC".
|
||||
*/
|
||||
@@ -2442,4 +2448,11 @@ module CryptographyBase<LocationSig Location, InputSig<Location> Input> {
|
||||
location = this.getLocation()
|
||||
}
|
||||
}
|
||||
|
||||
predicate isAsymmetricAlgorithm(AlgorithmNode node) {
|
||||
node instanceof EllipticCurveNode
|
||||
or
|
||||
node instanceof KeyOperationAlgorithmNode and node.(KeyOperationAlgorithmNode).isAsymmetric()
|
||||
// TODO: get unknown algorithms from known asymmetric operations
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user