Skip to content

Commit 0fc2427

Browse files
committed
Fixed missing symmetric algorithm type
1 parent e0193f8 commit 0fc2427

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

csharp/ql/lib/experimental/quantum/dotnet/AlgorithmInstances.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,10 @@ class AeadAlgorithmInstance extends Crypto::KeyOperationAlgorithmInstance,
213213
override Crypto::PaddingAlgorithmInstance getPaddingAlgorithm() { none() }
214214
}
215215

216+
bindingset[algorithmName]
216217
private Crypto::KeyOpAlg::Algorithm symmetricAlgorithmNameToType(string algorithmName) {
217-
algorithmName = "Aes%" and result = Crypto::KeyOpAlg::TSymmetricCipher(Crypto::KeyOpAlg::AES())
218+
algorithmName.matches("Aes%") and
219+
result = Crypto::KeyOpAlg::TSymmetricCipher(Crypto::KeyOpAlg::AES())
218220
or
219221
algorithmName = "DES" and result = Crypto::KeyOpAlg::TSymmetricCipher(Crypto::KeyOpAlg::DES())
220222
or

csharp/ql/lib/experimental/quantum/dotnet/Cryptography.qll

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -467,18 +467,13 @@ class SymmetricAlgorithmUse extends QualifiableExpr {
467467
this instanceof PropertyWrite and this.getQualifiedDeclaration().getName() = "Mode"
468468
}
469469

470-
predicate isCreationCall() {
471-
// TODO: Matching using `hasName` does not work here for some reason.
472-
this.getQualifiedDeclaration().getName().matches("Create%")
473-
}
470+
predicate isCreationCall() { this.getQualifiedDeclaration().getName().matches("Create%") }
474471

475472
predicate isEncryptionCall() {
476-
// TODO: Matching using `hasName` does not work here for some reason.
477473
this.getQualifiedDeclaration().getName().matches(["Encrypt%", "TryEncrypt%"])
478474
}
479475

480476
predicate isDecryptionCall() {
481-
// TODO: Matching using `hasName` does not work here for some reason.
482477
this.getQualifiedDeclaration().getName().matches(["Decrypt%", "TryDecrypt%"])
483478
}
484479

0 commit comments

Comments
 (0)