File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
cpp/ql/lib/experimental/quantum/OpenSSL/AlgorithmValueConsumers Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -30,3 +30,34 @@ class EVP_Q_Digest_Algorithm_Consumer extends OpenSSLAlgorithmValueConsumer {
3030 none ( )
3131 }
3232}
33+
34+ /**
35+ * EVP digest algorithm getters
36+ * https://docs.openssl.org/3.0/man3/EVP_DigestInit/#synopsis
37+ */
38+ class EVPDigestAlgorithmValueConsumer extends OpenSSLAlgorithmValueConsumer {
39+ DataFlow:: Node valueArgNode ;
40+ DataFlow:: Node resultNode ;
41+
42+ EVPDigestAlgorithmValueConsumer ( ) {
43+ resultNode .asExpr ( ) = this and
44+ isPossibleOpenSSLFunction ( this .( Call ) .getTarget ( ) ) and
45+ (
46+ this .( Call ) .getTarget ( ) .getName ( ) in [
47+ "EVP_get_digestbyname" , "EVP_get_digestbynid" , "EVP_get_digestbyobj"
48+ ] and
49+ valueArgNode .asExpr ( ) = this .( Call ) .getArgument ( 0 )
50+ or
51+ this .( Call ) .getTarget ( ) .getName ( ) = "EVP_MD_fetch" and
52+ valueArgNode .asExpr ( ) = this .( Call ) .getArgument ( 1 )
53+ )
54+ }
55+
56+ override DataFlow:: Node getResultNode ( ) { result = resultNode }
57+
58+ override Crypto:: ConsumerInputDataFlowNode getInputNode ( ) { result = valueArgNode }
59+
60+ override Crypto:: AlgorithmInstance getAKnownAlgorithmSource ( ) {
61+ exists ( OpenSSLAlgorithmInstance i | i .getAVC ( ) = this and result = i )
62+ }
63+ }
You can’t perform that action at this time.
0 commit comments