File tree Expand file tree Collapse file tree 3 files changed +35
-0
lines changed
cpp/ql/test/library-tests/security/encryption Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+ void des_function (); // insecure
3
+ void function_using_des (); // insecure
4
+ void EncryptWithDES (); // insecure
5
+
6
+ void aes_function (); // secure
7
+ void function_using_aes (); // secure
8
+ void EncryptionWithAES (); // secure
9
+
10
+ void abc_function ();
11
+ void function_using_abc ();
12
+ void EncryptionWithABC ();
Original file line number Diff line number Diff line change
1
+ | test.cpp:2:6:2:17 | des_function | getInsecureAlgorithmRegex |
2
+ | test.cpp:3:6:3:23 | function_using_des | getInsecureAlgorithmRegex |
3
+ | test.cpp:4:6:4:19 | EncryptWithDES | getInsecureAlgorithmRegex |
4
+ | test.cpp:6:6:6:17 | aes_function | getSecureAlgorithmRegex |
5
+ | test.cpp:7:6:7:23 | function_using_aes | getSecureAlgorithmRegex |
6
+ | test.cpp:8:6:8:22 | EncryptionWithAES | getSecureAlgorithmRegex |
7
+ | test.cpp:10:6:10:17 | abc_function | |
8
+ | test.cpp:11:6:11:23 | function_using_abc | |
9
+ | test.cpp:12:6:12:22 | EncryptionWithABC | |
Original file line number Diff line number Diff line change
1
+ import default
2
+ import semmle.code.cpp.security.Encryption
3
+
4
+ string describe ( Function f ) {
5
+ f .getName ( ) .regexpMatch ( getSecureAlgorithmRegex ( ) ) and
6
+ result = "getSecureAlgorithmRegex"
7
+ or
8
+ f .getName ( ) .regexpMatch ( getInsecureAlgorithmRegex ( ) ) and
9
+ result = "getInsecureAlgorithmRegex"
10
+ }
11
+
12
+ from Function f
13
+ where exists ( f .getLocation ( ) .getFile ( ) )
14
+ select f , concat ( describe ( f ) , ", " )
You can’t perform that action at this time.
0 commit comments