1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 21:06:50 +01:00

Huawei: Fix linter

Math.multiplyExact is only available on SDK24 onward. We do not expect
an overflow to occur here, since the hashLength is fixed and the outputLength
is small (32 on all current calls).
This commit is contained in:
José Rebelo 2024-01-08 13:43:26 +00:00
parent 0c22ecdd51
commit 705361ae3a

View File

@ -94,7 +94,7 @@ public class CryptoUtils {
int n = (outputLength % hashLen == 0) ? outputLength / hashLen : (outputLength / hashLen) + 1;
byte[] hashRound = new byte[0];
ByteBuffer generatedBytes = ByteBuffer.allocate(Math.multiplyExact(n, hashLen));
ByteBuffer generatedBytes = ByteBuffer.allocate(n * hashLen);
Mac mac = Mac.getInstance("HmacSHA256");
mac.init(pseudoSecretKey);
for (int roundNum = 1; roundNum <= n; roundNum++) {