summaryrefslogtreecommitdiffstats
path: root/security-utils
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@vespa.ai>2023-04-17 13:42:05 +0200
committerJon Bratseth <bratseth@vespa.ai>2023-04-17 13:42:05 +0200
commit2e2d9c57a39425273d12b49183b55b46b5c680b2 (patch)
treea43c07e48fa822c1c9330cdf3edd64cbfa2cbf4e /security-utils
parentb66f35888ad413800ac16f841582da5bf067cb7f (diff)
Build with jdk20
Diffstat (limited to 'security-utils')
-rw-r--r--security-utils/src/main/java/com/yahoo/security/SideChannelSafe.java2
-rw-r--r--security-utils/src/test/java/com/yahoo/security/SharedKeyTest.java6
2 files changed, 4 insertions, 4 deletions
diff --git a/security-utils/src/main/java/com/yahoo/security/SideChannelSafe.java b/security-utils/src/main/java/com/yahoo/security/SideChannelSafe.java
index 1f160d94c6a..bd085f6f624 100644
--- a/security-utils/src/main/java/com/yahoo/security/SideChannelSafe.java
+++ b/security-utils/src/main/java/com/yahoo/security/SideChannelSafe.java
@@ -46,7 +46,7 @@ public class SideChannelSafe {
// differed in any byte compared between the two arrays.
byte accu = 0;
for (int i = 0; i < lhs.length; ++i) {
- accu |= (lhs[i] ^ rhs[i]);
+ accu |= (byte)(lhs[i] ^ rhs[i]);
}
return (accu == 0);
}
diff --git a/security-utils/src/test/java/com/yahoo/security/SharedKeyTest.java b/security-utils/src/test/java/com/yahoo/security/SharedKeyTest.java
index 26627e9a5fa..90b8beb461f 100644
--- a/security-utils/src/test/java/com/yahoo/security/SharedKeyTest.java
+++ b/security-utils/src/test/java/com/yahoo/security/SharedKeyTest.java
@@ -285,12 +285,12 @@ public class SharedKeyTest {
String plaintext = "...hello world?";
byte[] encrypted = streamEncryptString(plaintext, myShared);
// Corrupt MAC tag in ciphertext
- encrypted[encrypted.length - 1] ^= 0x80;
+ encrypted[encrypted.length - 1] ^= (byte)0x80;
// We don't necessarily know _which_ exception is thrown, but one _should_ be thrown!
assertThrows(Exception.class, () -> doOutputStreamCipherDecrypt(myShared, encrypted));
// Also try with corrupted ciphertext (pre MAC tag)
- encrypted[encrypted.length - 1] ^= 0x80; // Flip MAC bit back to correct state
- encrypted[encrypted.length - 17] ^= 0x80; // Pre 128-bit MAC tag
+ encrypted[encrypted.length - 1] ^= (byte)0x80; // Flip MAC bit back to correct state
+ encrypted[encrypted.length - 17] ^= (byte)0x80; // Pre 128-bit MAC tag
assertThrows(Exception.class, () -> doOutputStreamCipherDecrypt(myShared, encrypted));
}