package org.bouncycastle.crypto.prng;

/* JADX INFO: loaded from: E:\ios\vf_dex\classes4.dex */
public class BasicEntropySourceProvider implements org.bouncycastle.crypto.prng.EntropySourceProvider {
    private final java.security.SecureRandom a;

    @Override // org.bouncycastle.crypto.prng.EntropySourceProvider
    public org.bouncycastle.crypto.prng.EntropySource get(final int i) {
        return new org.bouncycastle.crypto.prng.EntropySource() { // from class: org.bouncycastle.crypto.prng.BasicEntropySourceProvider.1
            @Override // org.bouncycastle.crypto.prng.EntropySource
            public int entropySize() {
                return i;
            }

            @Override // org.bouncycastle.crypto.prng.EntropySource
            public byte[] getEntropy() {
                if (!(org.bouncycastle.crypto.prng.BasicEntropySourceProvider.this.a instanceof org.bouncycastle.crypto.prng.SP800SecureRandom) && !(org.bouncycastle.crypto.prng.BasicEntropySourceProvider.this.a instanceof org.bouncycastle.crypto.prng.X931SecureRandom)) {
                    return org.bouncycastle.crypto.prng.BasicEntropySourceProvider.this.a.generateSeed((i + 7) / 8);
                }
                byte[] bArr = new byte[(i + 7) / 8];
                org.bouncycastle.crypto.prng.BasicEntropySourceProvider.this.a.nextBytes(bArr);
                return bArr;
            }
        };
    }
}
