Skip to content

Commit e2efe42

Browse files
committed
Updated returned key sizes to be integers
1 parent 57f4c9d commit e2efe42

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

java/ql/lib/experimental/quantum/BouncyCastle.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ module Generators {
233233

234234
override Crypto::KeyArtifactType getOutputKeyType() { result = super.getKeyType() }
235235

236-
override string getKeySizeFixed() {
236+
override int getKeySizeFixed() {
237237
result = KeyGeneratorFlow::getNewFromUse(this, _, _).getKeySizeFixed()
238238
}
239239

java/ql/lib/experimental/quantum/BouncyCastle/AlgorithmInstances.qll

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@ abstract private class EllipticCurveAlgorithmInstance extends Crypto::EllipticCu
99
Crypto::ellipticCurveNameToKeySizeAndFamilyMapping(this.getRawEllipticCurveName(), _, result)
1010
}
1111

12-
override string getKeySize() {
13-
exists(int keySize |
14-
Crypto::ellipticCurveNameToKeySizeAndFamilyMapping(this.getRawEllipticCurveName(), keySize, _) and
15-
result = keySize.toString()
16-
)
12+
override int getKeySize() {
13+
Crypto::ellipticCurveNameToKeySizeAndFamilyMapping(this.getRawEllipticCurveName(), result, _)
1714
}
1815
}
1916

@@ -34,7 +31,7 @@ abstract class SignatureAlgorithmInstance extends Crypto::KeyOperationAlgorithmI
3431
signatureNameToKeySizeAndAlgorithmMapping(this.getRawAlgorithmName(), _, result)
3532
}
3633

37-
override string getKeySizeFixed() {
34+
override int getKeySizeFixed() {
3835
signatureNameToKeySizeAndAlgorithmMapping(this.getRawAlgorithmName(), result, _)
3936
}
4037

@@ -88,7 +85,7 @@ abstract class KeyGenerationAlgorithmInstance extends Crypto::KeyOperationAlgori
8885
generatorNameToKeySizeAndAlgorithmMapping(this.getRawAlgorithmName(), _, result)
8986
}
9087

91-
override string getKeySizeFixed() {
88+
override int getKeySizeFixed() {
9289
generatorNameToKeySizeAndAlgorithmMapping(this.getRawAlgorithmName(), result, _)
9390
}
9491

@@ -136,25 +133,25 @@ private predicate typeNameToRawAlgorithmName(string typeName, string algorithmNa
136133
}
137134

138135
private predicate signatureNameToKeySizeAndAlgorithmMapping(
139-
string name, string keySize, Crypto::KeyOpAlg::Algorithm algorithm
136+
string name, int keySize, Crypto::KeyOpAlg::Algorithm algorithm
140137
) {
141138
name = "ED25519" and
142-
keySize = "256" and
139+
keySize = 256 and
143140
algorithm = Crypto::KeyOpAlg::TSignature(Crypto::KeyOpAlg::Ed25519())
144141
or
145142
name = "ED448" and
146-
keySize = "448" and
143+
keySize = 448 and
147144
algorithm = Crypto::KeyOpAlg::TSignature(Crypto::KeyOpAlg::Ed448())
148145
}
149146

150147
private predicate generatorNameToKeySizeAndAlgorithmMapping(
151-
string name, string keySize, Crypto::KeyOpAlg::Algorithm algorithm
148+
string name, int keySize, Crypto::KeyOpAlg::Algorithm algorithm
152149
) {
153150
name = "ED25519" and
154-
keySize = "256" and
151+
keySize = 256 and
155152
algorithm = Crypto::KeyOpAlg::TSignature(Crypto::KeyOpAlg::Ed25519())
156153
or
157154
name = "ED448" and
158-
keySize = "448" and
155+
keySize = 448 and
159156
algorithm = Crypto::KeyOpAlg::TSignature(Crypto::KeyOpAlg::Ed448())
160157
}

0 commit comments

Comments
 (0)