@@ -228,11 +228,7 @@ private module CryptographyModel {
228228 /** Gets a reference to the encryptor of a Cipher instance using algorithm with `algorithmName`. */
229229 DataFlow:: LocalSourceNode cipherEncryptor ( DataFlow:: TypeTracker t , string algorithmName ) {
230230 t .start ( ) and
231- exists ( DataFlow:: AttrRead attr |
232- result .( DataFlow:: CallCfgNode ) .getFunction ( ) = attr and
233- attr .getAttributeName ( ) = "encryptor" and
234- attr .getObject ( ) = cipherInstance ( algorithmName )
235- )
231+ result .( DataFlow:: MethodCallNode ) .calls ( cipherInstance ( algorithmName ) , "encryptor" )
236232 or
237233 exists ( DataFlow:: TypeTracker t2 | result = cipherEncryptor ( t2 , algorithmName ) .track ( t2 , t ) )
238234 }
@@ -249,11 +245,7 @@ private module CryptographyModel {
249245 /** Gets a reference to the dncryptor of a Cipher instance using algorithm with `algorithmName`. */
250246 DataFlow:: LocalSourceNode cipherDecryptor ( DataFlow:: TypeTracker t , string algorithmName ) {
251247 t .start ( ) and
252- exists ( DataFlow:: AttrRead attr |
253- result .( DataFlow:: CallCfgNode ) .getFunction ( ) = attr and
254- attr .getAttributeName ( ) = "decryptor" and
255- attr .getObject ( ) = cipherInstance ( algorithmName )
256- )
248+ result .( DataFlow:: MethodCallNode ) .calls ( cipherInstance ( algorithmName ) , "decryptor" )
257249 or
258250 exists ( DataFlow:: TypeTracker t2 | result = cipherDecryptor ( t2 , algorithmName ) .track ( t2 , t ) )
259251 }
@@ -271,19 +263,12 @@ private module CryptographyModel {
271263 * An encrypt or decrypt operation from `cryptography.hazmat.primitives.ciphers`.
272264 */
273265 class CryptographyGenericCipherOperation extends Cryptography:: CryptographicOperation:: Range ,
274- DataFlow:: CallCfgNode {
266+ DataFlow:: MethodCallNode {
275267 string algorithmName ;
276268
277269 CryptographyGenericCipherOperation ( ) {
278- exists ( DataFlow:: AttrRead attr |
279- this .getFunction ( ) = attr and
280- attr .getAttributeName ( ) = [ "update" , "update_into" ] and
281- (
282- attr .getObject ( ) = cipherEncryptor ( algorithmName )
283- or
284- attr .getObject ( ) = cipherDecryptor ( algorithmName )
285- )
286- )
270+ this .getMethodName ( ) in [ "update" , "update_into" ] and
271+ this .getReceiver ( ) in [ cipherEncryptor ( algorithmName ) , cipherDecryptor ( algorithmName ) ]
287272 }
288273
289274 override Cryptography:: CryptographicAlgorithm getAlgorithm ( ) {
@@ -337,16 +322,10 @@ private module CryptographyModel {
337322 * An hashing operation from `cryptography.hazmat.primitives.hashes`.
338323 */
339324 class CryptographyGenericHashOperation extends Cryptography:: CryptographicOperation:: Range ,
340- DataFlow:: CallCfgNode {
325+ DataFlow:: MethodCallNode {
341326 string algorithmName ;
342327
343- CryptographyGenericHashOperation ( ) {
344- exists ( DataFlow:: AttrRead attr |
345- this .getFunction ( ) = attr and
346- attr .getAttributeName ( ) = "update" and
347- attr .getObject ( ) = hashInstance ( algorithmName )
348- )
349- }
328+ CryptographyGenericHashOperation ( ) { this .calls ( hashInstance ( algorithmName ) , "update" ) }
350329
351330 override Cryptography:: CryptographicAlgorithm getAlgorithm ( ) {
352331 result .matchesName ( algorithmName )
0 commit comments