Skip to content

Commit 300e48e

Browse files
committed
Java: Move $ Source annotations that were incorrectly placed.
1 parent f840f61 commit 300e48e

4 files changed

Lines changed: 4 additions & 11 deletions

File tree

java/ql/test/experimental/query-tests/quantum/examples/BadMacUse/BadMacOrderDecryptThenMac.expected

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,3 @@ nodes
2929
| BadMacUse.java:146:48:146:57 | ciphertext : byte[] | semmle.label | ciphertext : byte[] |
3030
| BadMacUse.java:152:42:152:51 | ciphertext | semmle.label | ciphertext |
3131
subpaths
32-
testFailures
33-
| BadMacUse.java:92:31:92:35 | bytes : byte[] | Unexpected result: Source |
34-
| BadMacUse.java:146:95:146:159 | // $ Source[java/quantum/examples/bad-mac-order-decrypt-then-mac] | Missing result: Source[java/quantum/examples/bad-mac-order-decrypt-then-mac] |

java/ql/test/experimental/query-tests/quantum/examples/BadMacUse/BadMacUse.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public byte[] cipherOperationWrapper(byte[] bytes, byte[] encryptionKeyBytes, by
8989

9090
IvParameterSpec ivParameterSpec = new IvParameterSpec(iv);
9191
cipher.init(mode, secretKeySpec, ivParameterSpec);
92-
return cipher.doFinal(bytes);
92+
return cipher.doFinal(bytes); // $ Source[java/quantum/examples/bad-mac-order-decrypt-then-mac]
9393
}
9494

9595
/**
@@ -143,7 +143,7 @@ public void decryptThenMac(byte[] encryptionKeyBytes, byte[] macKeyBytes, byte[]
143143
byte[] receivedMac = Arrays.copyOfRange(input, input.length - macLength, input.length);
144144

145145
// Decrypt first (unsafe)
146-
byte[] plaintext = decryptUsingWrapper(ciphertext, encryptionKeyBytes, new byte[16]); // $ Source[java/quantum/examples/bad-mac-order-decrypt-then-mac]
146+
byte[] plaintext = decryptUsingWrapper(ciphertext, encryptionKeyBytes, new byte[16]);
147147

148148
// Now verify MAC (too late)
149149
SecretKey macKey = new SecretKeySpec(macKeyBytes, "HmacSHA256");

java/ql/test/experimental/query-tests/quantum/examples/WeakOrUnknownKDFIterationCount/Test.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ public void pbkdf2LowIteration(String password) throws Exception {
4242
*/
4343
public void pbkdf2LowIteration(String password, int iterationCount) throws Exception { // $ Source[java/quantum/examples/unknown-kdf-iteration-count]
4444
byte[] salt = generateSalt(16);
45-
PBEKeySpec spec = new PBEKeySpec(password.toCharArray(), salt, iterationCount, 256); // $ Alert[java/quantum/examples/unknown-kdf-iteration-count]
45+
PBEKeySpec spec = new PBEKeySpec(password.toCharArray(), salt, iterationCount, 256);
4646
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256");
47-
byte[] key = factory.generateSecret(spec).getEncoded();
47+
byte[] key = factory.generateSecret(spec).getEncoded(); // $ Alert[java/quantum/examples/unknown-kdf-iteration-count]
4848
}
4949

5050
/**
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
#select
21
| Test.java:47:22:47:49 | KeyDerivation | Key derivation operation with unknown iteration: $@ | Test.java:43:53:43:70 | iterationCount | iterationCount |
3-
testFailures
4-
| Test.java:45:94:45:154 | // $ Alert[java/quantum/examples/unknown-kdf-iteration-count] | Missing result: Alert[java/quantum/examples/unknown-kdf-iteration-count] |
5-
| Test.java:47:22:47:49 | Key derivation operation with unknown iteration: $@ | Unexpected result: Alert |

0 commit comments

Comments
 (0)