Rust: Update for latest main, and autoformat.

This commit is contained in:
Geoffrey White
2024-12-05 18:54:15 +00:00
parent de042ea9d7
commit 4e418d3d4d

View File

@@ -22,14 +22,26 @@ class StreamCipherInit extends Cryptography::CryptographicOperation::Range, Data
StreamCipherInit() {
// a call to `cipher::KeyInit::new`, `cipher::KeyInit::new_from_slice`,
// `cipher::KeyIvInit::new`, `cipher::KeyIvInit::new_from_slices` or `rc2::Rc2::new_with_eff_key_len`.
exists(Path p, string rawAlgorithmName |
this.asExpr().getExpr().(CallExpr).getFunction().(PathExpr).getPath() = p and
exists(PathExpr p, string rawAlgorithmName |
this.asExpr().getExpr().(CallExpr).getFunction() = p and
p.getResolvedCrateOrigin().matches("%/RustCrypto%") and
p.getPart().getNameRef().getText() =
p.getPath().getPart().getNameRef().getText() =
["new", "new_from_slice", "new_from_slices", "new_with_eff_key_len"] and
(
rawAlgorithmName = p.getQualifier().getPart().getNameRef().getText() or
rawAlgorithmName = p.getQualifier().getPart().getGenericArgList().getGenericArg(0).(TypeArg).getTy().(PathType).getPath().getPart().getNameRef().getText()
rawAlgorithmName = p.getPath().getQualifier().getPart().getNameRef().getText() or
rawAlgorithmName =
p.getPath()
.getQualifier()
.getPart()
.getGenericArgList()
.getGenericArg(0)
.(TypeArg)
.getTypeRepr()
.(PathTypeRepr)
.getPath()
.getPart()
.getNameRef()
.getText()
) and
algorithmName = simplifyAlgorithmName(rawAlgorithmName)
)