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

Commit 8758b2ce authored by Janis Danisevskis's avatar Janis Danisevskis Committed by Yo Chiang
Browse files

Keystore 2.0: Fix infinit recursion.

Fix endless recursion when Cipher is initialized with
AndroidKeyStorePrivateKey.

Fixes: 183167349
Test: atest android.keystore.cts.AndroidKeyStoreTest#testKeyStore_Encrypting_RSA_NONE_NOPADDING
Change-Id: I5b4166fb1a4e298072f7156ba61a64966e86dc53
parent 47157e77
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -124,7 +124,7 @@ abstract class AndroidKeyStoreCipherSpiBase extends CipherSpi implements KeyStor
        resetAll();

        // Public key operations get diverted to the default provider.
        if (opmode == Cipher.ENCRYPT_MODE
        if (!(key instanceof AndroidKeyStorePrivateKey)
                && (key instanceof PrivateKey || key instanceof PublicKey)) {
            try {
                mCipher = Cipher.getInstance(getTransform());
@@ -186,7 +186,7 @@ abstract class AndroidKeyStoreCipherSpiBase extends CipherSpi implements KeyStor
        resetAll();

        // Public key operations get diverted to the default provider.
        if (opmode == Cipher.ENCRYPT_MODE
        if (!(key instanceof AndroidKeyStorePrivateKey)
                && (key instanceof PrivateKey || key instanceof PublicKey)) {
            try {
                mCipher = Cipher.getInstance(getTransform());
@@ -216,7 +216,7 @@ abstract class AndroidKeyStoreCipherSpiBase extends CipherSpi implements KeyStor
        resetAll();

        // Public key operations get diverted to the default provider.
        if (opmode == Cipher.ENCRYPT_MODE
        if (!(key instanceof AndroidKeyStorePrivateKey)
                && (key instanceof PrivateKey || key instanceof PublicKey)) {
            try {
                mCipher = Cipher.getInstance(getTransform());