Clean up consumer and instance interfaces

This commit is contained in:
Nicolas Will
2025-03-03 19:06:53 +01:00
parent cf33cf7653
commit 627790f98b
3 changed files with 57 additions and 59 deletions

View File

@@ -493,7 +493,7 @@ module JCAModel {
}
}
class CipherInitCallNonceArgConsumer extends NonceArtifactConsumer instanceof Expr {
class CipherInitCallNonceArgConsumer extends Crypto::NonceArtifactConsumer instanceof Expr {
CipherInitCallNonceArgConsumer() { this = any(CipherInitCall call).getNonceArg() }
override DataFlow::Node getInputNode() { result.asExpr() = this }

View File

@@ -83,8 +83,6 @@ class ConstantDataSource extends Crypto::GenericConstantOrAllocationSource insta
abstract class RandomnessInstance extends Crypto::RandomNumberGenerationInstance {
override DataFlow::Node getOutputNode() { result.asExpr() = this }
override DataFlow::Node getInputNode() { none() } // TODO: add seed
override predicate flowsTo(Crypto::FlowAwareElement other) {
ArtifactUniversalFlow::flow(this.getOutputNode(), other.getInputNode())
}
@@ -113,40 +111,10 @@ abstract class AdditionalFlowInputStep extends DataFlow::Node {
module ArtifactUniversalFlow = DataFlow::Global<ArtifactUniversalFlowConfig>;
class NonceArtifactConsumer extends Crypto::NonceArtifactInstance instanceof Crypto::NonceArtifactConsumer
{
override predicate flowsTo(Crypto::FlowAwareElement other) {
ArtifactUniversalFlow::flow(this.getOutputNode(), other.getInputNode())
}
override DataFlow::Node getOutputNode() {
result = this.(Crypto::NonceArtifactConsumer).getOutputNode()
}
override DataFlow::Node getInputNode() {
result = this.(Crypto::NonceArtifactConsumer).getInputNode()
}
}
class CipherInputConsumer extends Crypto::CipherInputArtifactInstance instanceof Crypto::CipherInputConsumer
{
override predicate flowsTo(Crypto::FlowAwareElement other) {
ArtifactUniversalFlow::flow(this.getOutputNode(), other.getInputNode())
}
override DataFlow::Node getOutputNode() { none() }
override DataFlow::Node getInputNode() {
result = this.(Crypto::CipherInputArtifactInstance).getInputNode()
}
}
abstract class CipherOutputArtifact extends Crypto::CipherOutputArtifactInstance {
override predicate flowsTo(Crypto::FlowAwareElement other) {
ArtifactUniversalFlow::flow(this.getOutputNode(), other.getInputNode())
}
override DataFlow::Node getInputNode() { none() }
}
/**