@@ -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,18 +263,14 @@ 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- )
270+ exists ( DataFlow:: Node object , string method |
271+ object in [ cipherEncryptor ( algorithmName ) , cipherDecryptor ( algorithmName ) ] and
272+ method in [ "update" , "update_into" ] and
273+ this .calls ( object , method )
286274 )
287275 }
288276
@@ -337,16 +325,10 @@ private module CryptographyModel {
337325 * An hashing operation from `cryptography.hazmat.primitives.hashes`.
338326 */
339327 class CryptographyGenericHashOperation extends Cryptography:: CryptographicOperation:: Range ,
340- DataFlow:: CallCfgNode {
328+ DataFlow:: MethodCallNode {
341329 string algorithmName ;
342330
343- CryptographyGenericHashOperation ( ) {
344- exists ( DataFlow:: AttrRead attr |
345- this .getFunction ( ) = attr and
346- attr .getAttributeName ( ) = "update" and
347- attr .getObject ( ) = hashInstance ( algorithmName )
348- )
349- }
331+ CryptographyGenericHashOperation ( ) { this .calls ( hashInstance ( algorithmName ) , "update" ) }
350332
351333 override Cryptography:: CryptographicAlgorithm getAlgorithm ( ) {
352334 result .matchesName ( algorithmName )
0 commit comments