@@ -5,11 +5,11 @@ private import experimental.quantum.OpenSSL.AlgorithmValueConsumers.OpenSSLAlgor
55private import experimental.quantum.OpenSSL.AlgorithmInstances.OpenSSLAlgorithmInstanceBase
66private import AlgToAVCFlow
77
8- predicate knownOpenSSLConstantToHashFamilyType (
9- KnownOpenSSLHashAlgorithmConstant e , Crypto:: THashType type
8+ predicate knownOpenSslConstantToHashFamilyType (
9+ KnownOpenSslHashAlgorithmExpr e , Crypto:: THashType type
1010) {
1111 exists ( string name |
12- name = e .getNormalizedName ( ) and
12+ name = e .( KnownOpenSslAlgorithmExpr ) . getNormalizedName ( ) and
1313 (
1414 name .matches ( "BLAKE2B" ) and type instanceof Crypto:: BLAKE2B
1515 or
@@ -29,7 +29,7 @@ predicate knownOpenSSLConstantToHashFamilyType(
2929 or
3030 name .matches ( [ "SHA" , "SHA1" ] ) and type instanceof Crypto:: SHA1
3131 or
32- name .matches ( "SHA+ %" ) and not name .matches ( [ "SHA1" , "SHA3-" ] ) and type instanceof Crypto:: SHA2
32+ name .matches ( "SHA_ %" ) and not name .matches ( [ "SHA1" , "SHA3-" ] ) and type instanceof Crypto:: SHA2
3333 or
3434 name .matches ( "SHA3-%" ) and type instanceof Crypto:: SHA3
3535 or
@@ -44,36 +44,37 @@ predicate knownOpenSSLConstantToHashFamilyType(
4444 )
4545}
4646
47- class KnownOpenSSLHashConstantAlgorithmInstance extends OpenSSLAlgorithmInstance ,
48- Crypto:: HashAlgorithmInstance instanceof KnownOpenSSLHashAlgorithmConstant
47+ class KnownOpenSslHashConstantAlgorithmInstance extends OpenSslAlgorithmInstance ,
48+ Crypto:: HashAlgorithmInstance instanceof KnownOpenSslHashAlgorithmExpr
4949{
50- OpenSSLAlgorithmValueConsumer getterCall ;
50+ OpenSslAlgorithmValueConsumer getterCall ;
5151
52- KnownOpenSSLHashConstantAlgorithmInstance ( ) {
52+ KnownOpenSslHashConstantAlgorithmInstance ( ) {
5353 // Two possibilities:
5454 // 1) The source is a literal and flows to a getter, then we know we have an instance
55- // 2) The source is a KnownOpenSSLAlgorithm is call, and we know we have an instance immediately from that
55+ // 2) The source is a KnownOpenSslAlgorithm is call, and we know we have an instance immediately from that
5656 // Possibility 1:
57- this instanceof Literal and
57+ this instanceof OpenSslAlgorithmLiteral and
5858 exists ( DataFlow:: Node src , DataFlow:: Node sink |
5959 // Sink is an argument to a CipherGetterCall
60- sink = getterCall .( OpenSSLAlgorithmValueConsumer ) . getInputNode ( ) and
60+ sink = getterCall .getInputNode ( ) and
6161 // Source is `this`
6262 src .asExpr ( ) = this and
6363 // This traces to a getter
64- KnownOpenSSLAlgorithmToAlgorithmValueConsumerFlow :: flow ( src , sink )
64+ KnownOpenSslAlgorithmToAlgorithmValueConsumerFlow :: flow ( src , sink )
6565 )
6666 or
6767 // Possibility 2:
68- this instanceof DirectAlgorithmValueConsumer and getterCall = this
68+ this instanceof OpenSslAlgorithmCall and
69+ getterCall = this
6970 }
7071
71- override OpenSSLAlgorithmValueConsumer getAVC ( ) { result = getterCall }
72+ override OpenSslAlgorithmValueConsumer getAvc ( ) { result = getterCall }
7273
7374 override Crypto:: THashType getHashFamily ( ) {
74- knownOpenSSLConstantToHashFamilyType ( this , result )
75+ knownOpenSslConstantToHashFamilyType ( this , result )
7576 or
76- not knownOpenSSLConstantToHashFamilyType ( this , _) and result = Crypto:: OtherHashType ( )
77+ not knownOpenSslConstantToHashFamilyType ( this , _) and result = Crypto:: OtherHashType ( )
7778 }
7879
7980 override string getRawHashAlgorithmName ( ) {
@@ -83,6 +84,6 @@ class KnownOpenSSLHashConstantAlgorithmInstance extends OpenSSLAlgorithmInstance
8384 }
8485
8586 override int getFixedDigestLength ( ) {
86- this .( KnownOpenSSLHashAlgorithmConstant ) .getExplicitDigestLength ( ) = result
87+ this .( KnownOpenSslHashAlgorithmExpr ) .getExplicitDigestLength ( ) = result
8788 }
8889}
0 commit comments