@@ -40,7 +40,6 @@ private module AlgorithmNames {
4040 name = "RIPEMD" or
4141 name = "RIPEMD128" or
4242 name = "RIPEMD256" or
43- name = "RIPEMD160" or
4443 name = "RIPEMD320" or
4544 name = "SHA0" or
4645 name = "SHA1"
@@ -122,7 +121,8 @@ abstract class CryptographicAlgorithm extends TCryptographicAlgorithm {
122121 */
123122 bindingset [ name]
124123 predicate matchesName ( string name ) {
125- name .toUpperCase ( ) .regexpReplaceAll ( "[-_ ]" , "" ) .regexpMatch ( ".*" + getName ( ) + ".*" )
124+ exists ( name .regexpReplaceAll ( "[-_]" , "" ) .regexpFind ( "(?i)\\Q" + getName ( ) + "\\E" , _, _) )
125+ // name.toUpperCase().regexpReplaceAll("[-_ ]", "").regexpMatch(".*" + getName() + ".*")
126126 }
127127
128128 /**
@@ -188,6 +188,10 @@ abstract class CryptographicOperation extends Expr {
188188 abstract CryptographicAlgorithm getAlgorithm ( ) ;
189189}
190190
191+ /**
192+ * Below are the cryptographic functions that have been implemented so far for this library.
193+ * Class that checks for use of Md5 package.
194+ */
191195class Md5 extends CryptographicOperation {
192196 Expr input ;
193197 CryptographicAlgorithm algorithm ;
@@ -207,16 +211,20 @@ class Md5 extends CryptographicOperation {
207211 override CryptographicAlgorithm getAlgorithm ( ) { result = algorithm }
208212}
209213
214+ /**
215+ * Class that checks for use of Des package.
216+ */
210217class Des extends CryptographicOperation {
211218 Expr input ;
212219 CryptographicAlgorithm algorithm ;
213- CallExpr call ;
214220 SelectorExpr sel ;
221+ CallExpr call ;
215222
216223 Des ( ) {
217224 this = call and
218- algorithm .matchesName ( call . getCalleeName ( ) ) and
225+ algorithm .matchesName ( sel . getBase ( ) . toString ( ) ) and
219226 algorithm .matchesName ( "DES" ) and
227+ sel .getSelector ( ) .toString ( ) = call .getCalleeName ( ) .toString ( ) and
220228 call .getArgument ( 0 ) = input
221229 }
222230
0 commit comments