mirror of
https://github.com/github/codeql.git
synced 2026-02-17 23:43:42 +01:00
Rewrite handling of known unknowns and data-flow
This commit is contained in:
@@ -6,18 +6,16 @@
|
||||
import experimental.Quantum.Language
|
||||
import semmle.code.java.dataflow.DataFlow
|
||||
|
||||
Element getNonceOrigin(Crypto::NonceArtifactInstance nonce) {
|
||||
Crypto::NodeBase getNonceOrigin(Crypto::NonceNode nonce) {
|
||||
// TODO: this check is currently ultra hacky just for demoing
|
||||
result = nonce.getInput().asExpr().(VarAccess).getVariable()
|
||||
result = nonce.getSourceNode()
|
||||
}
|
||||
|
||||
from
|
||||
Crypto::CipherOperationInstance op, Crypto::NonceArtifactInstance nonce1,
|
||||
Crypto::NonceArtifactInstance nonce2
|
||||
from Crypto::CipherOperationNode op, Crypto::NonceNode nonce1, Crypto::NonceNode nonce2
|
||||
where
|
||||
op.(Expr).getEnclosingCallable().getName() = "encrypt" and
|
||||
nonce1 = op.getNonce() and
|
||||
nonce2 = op.getNonce() and
|
||||
op.asElement().(Expr).getEnclosingCallable().getName() = "encrypt" and
|
||||
nonce1 = op.getANonce() and
|
||||
nonce2 = op.getANonce() and
|
||||
not nonce1 = nonce2 and
|
||||
getNonceOrigin(nonce1) = getNonceOrigin(nonce2)
|
||||
select op, nonce1, nonce2
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
import experimental.Quantum.Language
|
||||
|
||||
from
|
||||
Crypto::CipherOperation op, Crypto::CipherAlgorithm a, Crypto::ModeOfOperationAlgorithm m,
|
||||
Crypto::PaddingAlgorithm p, Crypto::Nonce nonce
|
||||
Crypto::CipherOperationNode op, Crypto::CipherAlgorithmNode a,
|
||||
Crypto::ModeOfOperationAlgorithmNode m, Crypto::PaddingAlgorithmNode p, Crypto::NonceNode nonce
|
||||
where
|
||||
a = op.getAlgorithm() and
|
||||
a = op.getAKnownCipherAlgorithm() and
|
||||
m = a.getModeOfOperation() and
|
||||
p = a.getPadding() and
|
||||
nonce = op.getNonce()
|
||||
select op, op.getCipherOperationMode(), a, a.getRawAlgorithmName(), m, m.getRawAlgorithmName(), p,
|
||||
p.getRawAlgorithmName(), nonce
|
||||
p = a.getPaddingAlgorithm() and
|
||||
nonce = op.getANonce()
|
||||
select op, op.getCipherOperationSubtype(), a, a.getRawAlgorithmName(), m, m.getRawAlgorithmName(),
|
||||
p, p.getRawAlgorithmName(), nonce
|
||||
|
||||
Reference in New Issue
Block a user