mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
backport upstream BouncyCastle fixes
aligned with bcgit/bc-java@7b094ad188
This commit is contained in:
committed by
José Rebelo
parent
3e48a41aae
commit
fde8563b4a
@@ -19,8 +19,14 @@ public abstract class DefaultMultiBlockCipher
|
|||||||
// TODO check if the underlying cipher supports the multiblock interface and call it directly?
|
// TODO check if the underlying cipher supports the multiblock interface and call it directly?
|
||||||
|
|
||||||
int resultLen = 0;
|
int resultLen = 0;
|
||||||
int blockSize = this.getMultiBlockSize();
|
int blockSize = this.getBlockSize();
|
||||||
|
int len = blockCount * blockSize;
|
||||||
|
if (in == out)
|
||||||
|
{
|
||||||
|
in = new byte[len];
|
||||||
|
System.arraycopy(out, inOff, in, 0, len);
|
||||||
|
inOff = 0;
|
||||||
|
}
|
||||||
for (int i = 0; i != blockCount; i++)
|
for (int i = 0; i != blockCount; i++)
|
||||||
{
|
{
|
||||||
resultLen += this.processBlock(in, inOff, out, outOff + resultLen);
|
resultLen += this.processBlock(in, inOff, out, outOff + resultLen);
|
||||||
|
|||||||
@@ -803,9 +803,7 @@ public final class Arrays
|
|||||||
int newLength = to - from;
|
int newLength = to - from;
|
||||||
if (newLength < 0)
|
if (newLength < 0)
|
||||||
{
|
{
|
||||||
StringBuffer sb = new StringBuffer(from);
|
throw new IllegalArgumentException(from + " > " + to);
|
||||||
sb.append(" > ").append(to);
|
|
||||||
throw new IllegalArgumentException(sb.toString());
|
|
||||||
}
|
}
|
||||||
return newLength;
|
return newLength;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,16 +23,32 @@ public final class Strings {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String toLowerCase(String str) {
|
/**
|
||||||
char[] charArray = str.toCharArray();
|
* A locale independent version of toLowerCase.
|
||||||
boolean z = false;
|
*
|
||||||
for (int i = 0; i != charArray.length; i++) {
|
* @param string input to be converted
|
||||||
char c = charArray[i];
|
* @return a US ASCII lowercase version
|
||||||
if ('A' <= c && 'Z' >= c) {
|
*/
|
||||||
charArray[i] = (char) ((c - 'A') + 97);
|
public static String toLowerCase(String string)
|
||||||
z = true;
|
{
|
||||||
|
boolean changed = false;
|
||||||
|
char[] chars = string.toCharArray();
|
||||||
|
|
||||||
|
for (int i = 0; i != chars.length; i++)
|
||||||
|
{
|
||||||
|
char ch = chars[i];
|
||||||
|
if ('A' <= ch && 'Z' >= ch)
|
||||||
|
{
|
||||||
|
changed = true;
|
||||||
|
chars[i] = (char)(ch - 'A' + 'a');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return z ? new String(charArray) : str;
|
|
||||||
|
if (changed)
|
||||||
|
{
|
||||||
|
return new String(chars);
|
||||||
|
}
|
||||||
|
|
||||||
|
return string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user