Skip to content

Commit 0a0be41

Browse files
committed
Intermediate progress towards getting hashing upgraded. Still need to handle the final and update mechanics, matching the JCA. Similarly need to update cipher to follow the JCA for update/final as well.
1 parent 9463293 commit 0a0be41

File tree

11 files changed

+37
-254
lines changed

11 files changed

+37
-254
lines changed

cpp/ql/lib/experimental/Quantum/OpenSSL/AlgorithmInstances/OpenSSLAlgorithmInstances.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ import OpenSSLAlgorithmInstanceBase
22
import CipherAlgorithmInstance
33
import PaddingAlgorithmInstance
44
import BlockAlgorithmInstance
5+
import HashAlgorithmInstance

cpp/ql/lib/experimental/Quantum/OpenSSL/AlgorithmValueConsumers/OpenSSLAlgorithmValueConsumers.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ import OpenSSLAlgorithmValueConsumerBase
22
import CipherAlgorithmValueConsumer
33
import DirectAlgorithmValueConsumer
44
import PaddingAlgorithmValueConsumer
5+
import HashAlgorithmValueConsumer

cpp/ql/lib/experimental/Quantum/OpenSSL/EVPCipherConsumers.qll

Lines changed: 0 additions & 25 deletions
This file was deleted.

cpp/ql/lib/experimental/Quantum/OpenSSL/EVPHashAlgorithmSource.qll

Lines changed: 0 additions & 81 deletions
This file was deleted.

cpp/ql/lib/experimental/Quantum/OpenSSL/EVPHashConsumers.qll

Lines changed: 0 additions & 30 deletions
This file was deleted.

cpp/ql/lib/experimental/Quantum/OpenSSL/EVPHashInitializer.qll

Lines changed: 0 additions & 25 deletions
This file was deleted.

cpp/ql/lib/experimental/Quantum/OpenSSL/EVPHashOperation.qll

Lines changed: 0 additions & 83 deletions
This file was deleted.

cpp/ql/lib/experimental/Quantum/OpenSSL/Operations/EVPCipherOperation.qll

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import EVPCipherInitializer
44
import OpenSSLOperationBase
55
import experimental.Quantum.OpenSSL.AlgorithmValueConsumers.OpenSSLAlgorithmValueConsumers
66

7-
// import experimental.Quantum.OpenSSL.AlgorithmValueConsumers.AlgorithmValueConsumers
8-
// import OpenSSLOperation
9-
module AlgGetterToAlgConsumerConfig implements DataFlow::ConfigSig {
7+
private module AlgGetterToAlgConsumerConfig implements DataFlow::ConfigSig {
108
predicate isSource(DataFlow::Node source) {
119
exists(OpenSSLAlgorithmValueConsumer c | c.getResultNode() = source)
1210
}
@@ -16,8 +14,10 @@ module AlgGetterToAlgConsumerConfig implements DataFlow::ConfigSig {
1614
}
1715
}
1816

19-
module AlgGetterToAlgConsumerFlow = DataFlow::Global<AlgGetterToAlgConsumerConfig>;
17+
private module AlgGetterToAlgConsumerFlow = DataFlow::Global<AlgGetterToAlgConsumerConfig>;
2018

19+
// import experimental.Quantum.OpenSSL.AlgorithmValueConsumers.AlgorithmValueConsumers
20+
// import OpenSSLOperation
2121
// class EVPCipherOutput extends CipherOutputArtifact {
2222
// EVPCipherOutput() { exists(EVP_Cipher_Operation op | op.getOutputArg() = this) }
2323
// override DataFlow::Node getOutputNode() { result.asDefiningArgument() = this }
@@ -81,6 +81,8 @@ class EVP_Cipher_Call extends EVP_Cipher_Operation {
8181
override Expr getInputArg() { result = this.(Call).getArgument(2) }
8282
}
8383

84+
// ******* TODO NEED to model UPDATE but not as the coree operation, rather a step towards final,
85+
// see the JCA
8486
// class EVP_Encrypt_Decrypt_or_Cipher_Update_Call extends EVP_Update_Call {
8587
// EVP_Encrypt_Decrypt_or_Cipher_Update_Call() {
8688
// this.(Call).getTarget().getName() in [
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
import OpenSSLOperationBase
12
import EVPCipherOperation
3+
import EVPHashOperation

java/ql/lib/experimental/Quantum/JCA.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ module JCAModel {
386386

387387
override Crypto::THashType getHashFamily() { result = hash_name_to_type_known(hashName, _) }
388388

389-
override int getDigestLength() { exists(hash_name_to_type_known(hashName, result)) }
389+
override int getFixedDigestLength() { exists(hash_name_to_type_known(hashName, result)) }
390390
}
391391

392392
class OAEPPaddingAlgorithmInstance extends Crypto::OAEPPaddingAlgorithmInstance,
@@ -829,7 +829,7 @@ module JCAModel {
829829
result = hash_name_to_type_known(this.getRawHashAlgorithmName(), _)
830830
}
831831

832-
override int getDigestLength() {
832+
override int getFixedDigestLength() {
833833
exists(hash_name_to_type_known(this.getRawHashAlgorithmName(), result))
834834
}
835835
}
@@ -1237,7 +1237,7 @@ module JCAModel {
12371237
result = hash_name_to_type_known(this.getRawHashAlgorithmName(), _)
12381238
}
12391239

1240-
override int getDigestLength() {
1240+
override int getFixedDigestLength() {
12411241
exists(hash_name_to_type_known(this.getRawHashAlgorithmName(), result))
12421242
}
12431243

0 commit comments

Comments
 (0)