@@ -67,37 +67,42 @@ abstract class EVP_Cipher_Operation extends OpenSSLOperation, Crypto::KeyOperati
67
67
}
68
68
}
69
69
70
- // abstract class EVP_Update_Call extends EVP_Cipher_Operation { }
71
- abstract class EVP_Final_Call extends EVP_Cipher_Operation {
72
- override Expr getInputArg ( ) { none ( ) }
73
- }
74
-
75
- // TODO: only model Final (model final as operation and model update but not as an operation)
76
- // Updates are multiple input consumers (most important)
77
- // TODO: assuming update doesn't ouput, otherwise it outputs artifacts, but is not an operation
78
70
class EVP_Cipher_Call extends EVP_Cipher_Operation {
79
71
EVP_Cipher_Call ( ) { this .( Call ) .getTarget ( ) .getName ( ) = "EVP_Cipher" }
80
72
81
73
override Expr getInputArg ( ) { result = this .( Call ) .getArgument ( 2 ) }
82
74
}
83
75
84
- // ******* TODO: model UPDATE but not as the core operation, rather a step towards final
85
- // see the JCA
86
- // class EVP_Encrypt_Decrypt_or_Cipher_Update_Call extends EVP_Update_Call {
87
- // EVP_Encrypt_Decrypt_or_Cipher_Update_Call() {
88
- // this.(Call).getTarget().getName() in [
89
- // "EVP_EncryptUpdate", "EVP_DecryptUpdate", "EVP_CipherUpdate"
90
- // ]
91
- // }
92
- // override Expr getInputArg() { result = this.(Call).getArgument(3) }
93
- // }
94
- class EVP_Encrypt_Decrypt_or_Cipher_Final_Call extends EVP_Final_Call {
95
- EVP_Encrypt_Decrypt_or_Cipher_Final_Call ( ) {
76
+ // NOTE: not modeled as cipher operations, these are intermediate calls
77
+ class EVP_Update_Call extends Call {
78
+ EVP_Update_Call ( ) {
79
+ this .( Call ) .getTarget ( ) .getName ( ) in [
80
+ "EVP_EncryptUpdate" , "EVP_DecryptUpdate" , "EVP_CipherUpdate"
81
+ ]
82
+ }
83
+
84
+ Expr getInputArg ( ) { result = this .( Call ) .getArgument ( 3 ) }
85
+
86
+ DataFlow:: Node getInputNode ( ) { result .asExpr ( ) = this .getInputArg ( ) }
87
+
88
+ Expr getContextArg ( ) { result = this .( Call ) .getArgument ( 0 ) }
89
+ }
90
+
91
+ class EVP_Final_Call extends EVP_Cipher_Operation {
92
+ EVP_Final_Call ( ) {
96
93
this .( Call ) .getTarget ( ) .getName ( ) in [
97
94
"EVP_EncryptFinal_ex" , "EVP_DecryptFinal_ex" , "EVP_CipherFinal_ex" , "EVP_EncryptFinal" ,
98
95
"EVP_DecryptFinal" , "EVP_CipherFinal"
99
96
]
100
97
}
98
+
99
+ EVP_Update_Call getUpdateCalls ( ) {
100
+ CTXFlow:: ctxArgFlowsToCtxArg ( result .getContextArg ( ) , this .getContextArg ( ) )
101
+ }
102
+
103
+ override Expr getInputArg ( ) { result = this .getUpdateCalls ( ) .getInputArg ( ) }
104
+
105
+ override Crypto:: ConsumerInputDataFlowNode getInputConsumer ( ) { result = this .getInputNode ( ) }
101
106
}
102
107
103
108
class EVP_PKEY_Operation extends EVP_Cipher_Operation {
0 commit comments