Skip to content

Commit fe52351

Browse files
committed
Stubbing out hash operation node, borrowing from cipher operaiton node
1 parent 73368ea commit fe52351

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

  • shared/cryptography/codeql/cryptography

shared/cryptography/codeql/cryptography/Model.qll

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,8 +1031,29 @@ module CryptographyBase<LocationSig Location, InputSig<Location> Input> {
10311031
* This operation takes an input message of arbitrary content and length and produces a fixed-size
10321032
* hash value as the output using a specified hashing algorithm.
10331033
*/
1034-
abstract class HashOperationNode extends OperationNode, THashOperation {
1035-
abstract HashAlgorithmNode getAlgorithm();
1034+
class HashOperationNode extends OperationNode, THashOperation {
1035+
HashAlgorithmInstance instance;
1036+
1037+
HashOperationNode() { this = THashOperation(instance) }
1038+
1039+
override string getInternalType() { result = "HashOperation" }
1040+
1041+
override LocatableElement asElement() { result = instance }
1042+
1043+
/**
1044+
* Gets the algorithm or unknown source nodes consumed as an algorithm associated with this operation.
1045+
*/
1046+
NodeBase getACipherAlgorithmOrUnknown() {
1047+
result = this.getAKnownCipherAlgorithm() or
1048+
result = this.asElement().(OperationElement).getAlgorithmConsumer().getAnUnknownSourceNode()
1049+
}
1050+
1051+
/**
1052+
* Gets a known algorithm associated with this operation
1053+
*/
1054+
HashAlgorithmNode getAKnownCipherAlgorithm() {
1055+
result = this.asElement().(OperationElement).getAlgorithmConsumer().getAKnownSourceNode()
1056+
}
10361057
}
10371058

10381059
newtype THashType =

0 commit comments

Comments
 (0)