Skip to content

Commit 1d8a57e

Browse files
committed
Fix EVP Cipher class, predicate, and comment typos
1 parent e956d04 commit 1d8a57e

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

cpp/ql/lib/experimental/quantum/OpenSSL/Operations/EVPCipherInitializer.qll

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ module EncValToInitEncArgConfig implements DataFlow::ConfigSig {
1010
predicate isSource(DataFlow::Node source) { source.asExpr().getValue().toInt() in [0, 1] }
1111

1212
predicate isSink(DataFlow::Node sink) {
13-
exists(EVP_Cipher_Inititalizer initCall | sink.asExpr() = initCall.getOperataionSubtypeArg())
13+
exists(EVP_Cipher_Initializer initCall | sink.asExpr() = initCall.getOperationSubtypeArg())
1414
}
1515
}
1616

1717
module EncValToInitEncArgFlow = DataFlow::Global<EncValToInitEncArgConfig>;
1818

1919
int getEncConfigValue(Expr e) {
20-
exists(EVP_Cipher_Inititalizer initCall | e = initCall.getOperataionSubtypeArg()) and
20+
exists(EVP_Cipher_Initializer initCall | e = initCall.getOperationSubtypeArg()) and
2121
exists(DataFlow::Node a, DataFlow::Node b |
2222
EncValToInitEncArgFlow::flow(a, b) and b.asExpr() = e and result = a.asExpr().getValue().toInt()
2323
)
@@ -34,7 +34,7 @@ Crypto::KeyOperationSubtype intToCipherOperationSubtype(int i) {
3434
}
3535

3636
// TODO: need to add key consumer
37-
abstract class EVP_Cipher_Inititalizer extends Call {
37+
abstract class EVP_Cipher_Initializer extends Call {
3838
Expr getContextArg() { result = this.(Call).getArgument(0) }
3939

4040
Expr getAlgorithmArg() { result = this.(Call).getArgument(1) }
@@ -44,7 +44,7 @@ abstract class EVP_Cipher_Inititalizer extends Call {
4444
abstract Expr getIVArg();
4545

4646
// abstract Crypto::CipherOperationSubtype getCipherOperationSubtype();
47-
abstract Expr getOperataionSubtypeArg();
47+
abstract Expr getOperationSubtypeArg();
4848

4949
Crypto::KeyOperationSubtype getCipherOperationSubtype() {
5050
if this.(Call).getTarget().getName().toLowerCase().matches("%encrypt%")
@@ -53,19 +53,19 @@ abstract class EVP_Cipher_Inititalizer extends Call {
5353
if this.(Call).getTarget().getName().toLowerCase().matches("%decrypt%")
5454
then result instanceof Crypto::TDecryptMode
5555
else
56-
if exists(getEncConfigValue(this.getOperataionSubtypeArg()))
57-
then result = intToCipherOperationSubtype(getEncConfigValue(this.getOperataionSubtypeArg()))
56+
if exists(getEncConfigValue(this.getOperationSubtypeArg()))
57+
then result = intToCipherOperationSubtype(getEncConfigValue(this.getOperationSubtypeArg()))
5858
else result instanceof Crypto::TUnknownKeyOperationMode
5959
}
6060
}
6161

62-
abstract class EVP_EX_Initializer extends EVP_Cipher_Inititalizer {
62+
abstract class EVP_EX_Initializer extends EVP_Cipher_Initializer {
6363
override Expr getKeyArg() { result = this.(Call).getArgument(3) }
6464

6565
override Expr getIVArg() { result = this.(Call).getArgument(4) }
6666
}
6767

68-
abstract class EVP_EX2_Initializer extends EVP_Cipher_Inititalizer {
68+
abstract class EVP_EX2_Initializer extends EVP_Cipher_Initializer {
6969
override Expr getKeyArg() { result = this.(Call).getArgument(2) }
7070

7171
override Expr getIVArg() { result = this.(Call).getArgument(3) }
@@ -78,7 +78,7 @@ class EVP_Cipher_EX_Init_Call extends EVP_EX_Initializer {
7878
]
7979
}
8080

81-
override Expr getOperataionSubtypeArg() {
81+
override Expr getOperationSubtypeArg() {
8282
this.(Call).getTarget().getName().toLowerCase().matches("%cipherinit%") and
8383
result = this.(Call).getArgument(5)
8484
}
@@ -92,7 +92,7 @@ class EVP_Cipher_EX2_or_Simple_Init_Call extends EVP_EX2_Initializer {
9292
]
9393
}
9494

95-
override Expr getOperataionSubtypeArg() {
95+
override Expr getOperationSubtypeArg() {
9696
this.(Call).getTarget().getName().toLowerCase().matches("%cipherinit%") and
9797
result = this.(Call).getArgument(4)
9898
}
@@ -101,23 +101,23 @@ class EVP_Cipher_EX2_or_Simple_Init_Call extends EVP_EX2_Initializer {
101101
class EVP_CipherInit_SKEY_Call extends EVP_EX2_Initializer {
102102
EVP_CipherInit_SKEY_Call() { this.(Call).getTarget().getName() in ["EVP_CipherInit_SKEY"] }
103103

104-
override Expr getOperataionSubtypeArg() { result = this.(Call).getArgument(5) }
104+
override Expr getOperationSubtypeArg() { result = this.(Call).getArgument(5) }
105105
}
106106

107107
class EVPCipherInitializerAlgorithmArgument extends Expr {
108108
EVPCipherInitializerAlgorithmArgument() {
109-
exists(EVP_Cipher_Inititalizer initCall | this = initCall.getAlgorithmArg())
109+
exists(EVP_Cipher_Initializer initCall | this = initCall.getAlgorithmArg())
110110
}
111111
}
112112

113113
class EVPCipherInitializerKeyArgument extends Expr {
114114
EVPCipherInitializerKeyArgument() {
115-
exists(EVP_Cipher_Inititalizer initCall | this = initCall.getKeyArg())
115+
exists(EVP_Cipher_Initializer initCall | this = initCall.getKeyArg())
116116
}
117117
}
118118

119119
class EVPCipherInitializerIVArgument extends Expr {
120120
EVPCipherInitializerIVArgument() {
121-
exists(EVP_Cipher_Inititalizer initCall | this = initCall.getIVArg())
121+
exists(EVP_Cipher_Initializer initCall | this = initCall.getIVArg())
122122
}
123123
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ abstract class EVP_Cipher_Operation extends OpenSSLOperation, Crypto::KeyOperati
4545
this.(Call).getTarget().getName().toLowerCase().matches("%cipher%")
4646
}
4747

48-
EVP_Cipher_Inititalizer getInitCall() {
48+
EVP_Cipher_Initializer getInitCall() {
4949
CTXFlow::ctxArgFlowsToCtxArg(result.getContextArg(), this.getContextArg())
5050
}
5151

@@ -74,14 +74,14 @@ abstract class EVP_Final_Call extends EVP_Cipher_Operation {
7474

7575
// TODO: only model Final (model final as operation and model update but not as an operation)
7676
// Updates are multiple input consumers (most important)
77-
// PUNT assuming update doesn't ouput, otherwise it outputs arifacts, but is not an operation
77+
// TODO: assuming update doesn't ouput, otherwise it outputs artifacts, but is not an operation
7878
class EVP_Cipher_Call extends EVP_Cipher_Operation {
7979
EVP_Cipher_Call() { this.(Call).getTarget().getName() = "EVP_Cipher" }
8080

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,
84+
// ******* TODO: model UPDATE but not as the core operation, rather a step towards final
8585
// see the JCA
8686
// class EVP_Encrypt_Decrypt_or_Cipher_Update_Call extends EVP_Update_Call {
8787
// EVP_Encrypt_Decrypt_or_Cipher_Update_Call() {

0 commit comments

Comments
 (0)