Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 22b5d9b9 authored by Alex Klyubin's avatar Alex Klyubin Committed by Android Git Automerger
Browse files

am 28a9089f: am 216d18b9: Merge "Remove IV auto-generation workaround."

* commit '28a9089f':
  Remove IV auto-generation workaround.
parents 13391109 28a9089f
Loading
Loading
Loading
Loading
+6 −12
Original line number Diff line number Diff line
@@ -547,18 +547,12 @@ public abstract class KeyStoreCipherSpi extends CipherSpi implements KeyStoreCry
            if (mIvRequired) {
                // IV is needed
                if ((mIv == null) && (mEncrypting)) {
                    // TODO: Switch to keymaster-generated IV code below once keymaster supports
                    // that.
                    // IV is needed but was not provided by the caller -- generate an IV.
                    mIv = new byte[mBlockSizeBytes];
                    SecureRandom rng = (mRng != null) ? mRng : new SecureRandom();
                    rng.nextBytes(mIv);
//                    // IV was not provided by the caller and thus will be generated by keymaster.
//                    // Mix in some additional entropy from the provided SecureRandom.
//                    if (mRng != null) {
//                        mAdditionalEntropyForBegin = new byte[mBlockSizeBytes];
//                        mRng.nextBytes(mAdditionalEntropyForBegin);
//                    }
                    // IV was not provided by the caller and thus will be generated by keymaster.
                    // Mix in some additional entropy from the provided SecureRandom.
                    if (mRng != null) {
                        mAdditionalEntropyForBegin = new byte[mBlockSizeBytes];
                        mRng.nextBytes(mAdditionalEntropyForBegin);
                    }
                }
            }
        }