@@ -5,15 +5,9 @@ private import OperationInstances
55private import Cryptography
66private import FlowAnalysis
77
8- class NamedCurveAlgorithmInstance extends Crypto:: EllipticCurveInstance instanceof SigningNamedCurvePropertyAccess
8+ class NamedCurveAlgorithmInstance extends Crypto:: EllipticCurveInstance instanceof NamedCurvePropertyAccess
99{
10- ECDsaAlgorithmValueConsumer consumer ;
11-
12- NamedCurveAlgorithmInstance ( ) {
13- SigningNamedCurveToSignatureCreateFlow:: flow ( DataFlow:: exprNode ( this ) , consumer .getInputNode ( ) )
14- }
15-
16- ECDsaAlgorithmValueConsumer getConsumer ( ) { result = consumer }
10+ NamedCurveAlgorithmInstance ( ) { this instanceof NamedCurvePropertyAccess }
1711
1812 override string getRawEllipticCurveName ( ) { result = super .getCurveName ( ) }
1913
@@ -26,30 +20,40 @@ class NamedCurveAlgorithmInstance extends Crypto::EllipticCurveInstance instance
2620 }
2721}
2822
29- class EcdsaAlgorithmInstance extends Crypto:: KeyOperationAlgorithmInstance instanceof ECDsaCreateCall
30- {
31- EcdsaAlgorithmInstance ( ) {
32- // SigningNamedCurveToSignatureCreateFlow::flow(DataFlow::exprNode(this), consumer.getInputNode())
33- this instanceof ECDsaCreateCall
34- }
35-
36- ECDsaAlgorithmValueConsumer getConsumer ( ) { result = super .getQualifier ( ) }
37-
38- override string getRawAlgorithmName ( ) { result = "ECDsa" }
39-
23+ abstract class SigningAlgorithmInstance extends Crypto:: KeyOperationAlgorithmInstance {
4024 override Crypto:: ModeOfOperationAlgorithmInstance getModeOfOperationAlgorithm ( ) { none ( ) }
4125
42- // TODO: PaddingAlgorithmInstance errors with "call to empty relation: class test for Model::CryptographyBase::PaddingAlgorithmInstance"
4326 override Crypto:: PaddingAlgorithmInstance getPaddingAlgorithm ( ) { none ( ) }
27+
4428 override Crypto:: ConsumerInputDataFlowNode getKeySizeConsumer ( ) { none ( ) }
4529
30+
4631 override int getKeySizeFixed ( ) { none ( ) }
32+ }
33+
34+ class EcdsaAlgorithmInstance extends SigningAlgorithmInstance instanceof SigningCreateCall {
35+ EcdsaAlgorithmInstance ( ) { this instanceof ECDsaCreateCall }
36+
37+ EcdsaAlgorithmValueConsumer getConsumer ( ) { result = super .getQualifier ( ) }
38+
39+ override string getRawAlgorithmName ( ) { result = "ECDsa" }
4740
4841 override Crypto:: KeyOpAlg:: Algorithm getAlgorithmType ( ) {
4942 result = Crypto:: KeyOpAlg:: TSignature ( Crypto:: KeyOpAlg:: ECDSA ( ) )
5043 }
5144}
5245
46+ class RsaAlgorithmInstance extends SigningAlgorithmInstance {
47+ RsaAlgorithmInstance ( ) { this = any ( RSACreateCall c ) .getQualifier ( ) }
48+
49+ override string getRawAlgorithmName ( ) { result = "RSA" }
50+
51+ override Crypto:: KeyOpAlg:: Algorithm getAlgorithmType ( ) {
52+ // TODO there is no RSA TSignature type, so we use OtherSignatureAlgorithmType
53+ result = Crypto:: KeyOpAlg:: TSignature ( Crypto:: KeyOpAlg:: OtherSignatureAlgorithmType ( ) )
54+ }
55+ }
56+
5357class HashAlgorithmNameInstance extends Crypto:: HashAlgorithmInstance instanceof HashAlgorithmName {
5458 HashAlgorithmNameConsumer consumer ;
5559
0 commit comments