177 lines
5.4 KiB
Java
177 lines
5.4 KiB
Java
package o;
|
|
|
|
import com.google.common.base.Ascii;
|
|
import com.google.common.primitives.UnsignedBytes;
|
|
import java.io.BufferedInputStream;
|
|
import java.io.FilterInputStream;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import org.bouncycastle.crypto.tls.CipherSuite;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class FJQ extends FilterInputStream {
|
|
private int a;
|
|
private final int b;
|
|
private rEp c;
|
|
private final int d;
|
|
private final int e;
|
|
private byte[] f;
|
|
private byte[] g;
|
|
private int h;
|
|
private int[] i;
|
|
private byte[] j;
|
|
private int k;
|
|
private int l;
|
|
private int m;
|
|
|
|
@Override // java.io.FilterInputStream, java.io.InputStream
|
|
public final boolean markSupported() {
|
|
return false;
|
|
}
|
|
|
|
public FJQ(InputStream inputStream, int[] iArr, byte[] bArr, int i, boolean z, int i2) throws IOException {
|
|
this(inputStream, iArr, bArr, i, false, i2, (byte) 0);
|
|
}
|
|
|
|
private FJQ(InputStream inputStream, int[] iArr, byte[] bArr, int i, boolean z, int i2, byte b) throws IOException {
|
|
super(new BufferedInputStream(inputStream, 4096));
|
|
this.a = 1;
|
|
this.l = Integer.MAX_VALUE;
|
|
int min = Math.min(Math.max(i, 3), 16);
|
|
this.b = min;
|
|
this.g = new byte[8];
|
|
byte[] bArr2 = new byte[8];
|
|
this.j = bArr2;
|
|
this.f = new byte[8];
|
|
this.i = new int[2];
|
|
this.h = 8;
|
|
this.k = 8;
|
|
this.m = i2;
|
|
if (i2 == 2) {
|
|
System.arraycopy(bArr, 0, bArr2, 0, 8);
|
|
}
|
|
this.c = new rEp(iArr, min, true, false);
|
|
this.e = 100;
|
|
this.d = 100;
|
|
}
|
|
|
|
@Override // java.io.FilterInputStream, java.io.InputStream
|
|
public final int read() throws IOException {
|
|
a();
|
|
int i = this.h;
|
|
if (i >= this.k) {
|
|
return -1;
|
|
}
|
|
byte[] bArr = this.g;
|
|
this.h = i + 1;
|
|
return bArr[i] & UnsignedBytes.MAX_VALUE;
|
|
}
|
|
|
|
@Override // java.io.FilterInputStream, java.io.InputStream
|
|
public final int read(byte[] bArr, int i, int i2) throws IOException {
|
|
int i3 = i + i2;
|
|
for (int i4 = i; i4 < i3; i4++) {
|
|
a();
|
|
int i5 = this.h;
|
|
if (i5 >= this.k) {
|
|
if (i4 == i) {
|
|
return -1;
|
|
}
|
|
return i2 - (i3 - i4);
|
|
}
|
|
byte[] bArr2 = this.g;
|
|
this.h = i5 + 1;
|
|
bArr[i4] = bArr2[i5];
|
|
}
|
|
return i2;
|
|
}
|
|
|
|
@Override // java.io.FilterInputStream, java.io.InputStream
|
|
public final long skip(long j) throws IOException {
|
|
long j2 = 0;
|
|
while (j2 < j && read() != -1) {
|
|
j2++;
|
|
}
|
|
return j2;
|
|
}
|
|
|
|
@Override // java.io.FilterInputStream, java.io.InputStream
|
|
public final int available() throws IOException {
|
|
a();
|
|
return this.k - this.h;
|
|
}
|
|
|
|
private void e() {
|
|
if (this.m == 2) {
|
|
byte[] bArr = this.g;
|
|
System.arraycopy(bArr, 0, this.f, 0, bArr.length);
|
|
}
|
|
byte[] bArr2 = this.g;
|
|
UQp.c(((bArr2[0] << Ascii.CAN) & (-16777216)) + ((bArr2[1] << 16) & 16711680) + ((bArr2[2] << 8) & CipherSuite.DRAFT_TLS_DHE_RSA_WITH_AES_128_OCB) + (bArr2[3] & UnsignedBytes.MAX_VALUE), ((-16777216) & (bArr2[4] << Ascii.CAN)) + (16711680 & (bArr2[5] << 16)) + (65280 & (bArr2[6] << 8)) + (bArr2[7] & UnsignedBytes.MAX_VALUE), false, this.b, this.c.b, this.c.d, this.i);
|
|
int[] iArr = this.i;
|
|
int i = iArr[0];
|
|
int i2 = iArr[1];
|
|
byte[] bArr3 = this.g;
|
|
bArr3[0] = (byte) (i >> 24);
|
|
bArr3[1] = (byte) (i >> 16);
|
|
bArr3[2] = (byte) (i >> 8);
|
|
bArr3[3] = (byte) i;
|
|
bArr3[4] = (byte) (i2 >> 24);
|
|
bArr3[5] = (byte) (i2 >> 16);
|
|
bArr3[6] = (byte) (i2 >> 8);
|
|
bArr3[7] = (byte) i2;
|
|
if (this.m == 2) {
|
|
for (int i3 = 0; i3 < 8; i3++) {
|
|
byte[] bArr4 = this.g;
|
|
bArr4[i3] = (byte) (bArr4[i3] ^ this.j[i3]);
|
|
}
|
|
byte[] bArr5 = this.f;
|
|
System.arraycopy(bArr5, 0, this.j, 0, bArr5.length);
|
|
}
|
|
}
|
|
|
|
private int a() throws IOException {
|
|
if (this.l == Integer.MAX_VALUE) {
|
|
this.l = ((FilterInputStream) this).in.read();
|
|
}
|
|
if (this.h == 8) {
|
|
byte[] bArr = this.g;
|
|
int i = this.l;
|
|
bArr[0] = (byte) i;
|
|
if (i < 0) {
|
|
throw new IllegalStateException("unexpected block size");
|
|
}
|
|
int i2 = 1;
|
|
do {
|
|
int read = ((FilterInputStream) this).in.read(this.g, i2, 8 - i2);
|
|
if (read <= 0) {
|
|
break;
|
|
}
|
|
i2 += read;
|
|
} while (i2 < 8);
|
|
if (i2 < 8) {
|
|
throw new IllegalStateException("unexpected block size");
|
|
}
|
|
int i3 = this.e;
|
|
if (i3 == this.d) {
|
|
e();
|
|
} else {
|
|
if (this.a <= i3) {
|
|
e();
|
|
}
|
|
int i4 = this.a;
|
|
if (i4 < this.d) {
|
|
this.a = i4 + 1;
|
|
} else {
|
|
this.a = 1;
|
|
}
|
|
}
|
|
int read2 = ((FilterInputStream) this).in.read();
|
|
this.l = read2;
|
|
this.h = 0;
|
|
this.k = read2 < 0 ? 8 - (this.g[7] & UnsignedBytes.MAX_VALUE) : 8;
|
|
}
|
|
return this.k;
|
|
}
|
|
}
|