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

Commit cb57745c authored by Robert Shih's avatar Robert Shih
Browse files

CryptoHal: graceful plugin creation failure

Bug: 162255728
Change-Id: I36ad115c9a60da64c4a9d2bd31d7e5c4fe2ebd70
Test: build
parent 5d9a9e0e
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -146,6 +146,9 @@ sp<ICryptoPlugin> CryptoHal::makeCryptoPlugin(const sp<ICryptoFactory>& factory,
                plugin = hPlugin;
            }
        );
    if (!hResult.isOk()) {
        mInitCheck = DEAD_OBJECT;
    }
    return plugin;
}

@@ -179,10 +182,8 @@ status_t CryptoHal::createPlugin(const uint8_t uuid[16], const void *data,
        }
    }

    if (mPlugin == NULL) {
        mInitCheck = ERROR_UNSUPPORTED;
    } else {
        mInitCheck = OK;
    if (mInitCheck == NO_INIT) {
        mInitCheck = mPlugin == NULL ? ERROR_UNSUPPORTED : OK;
    }

    return mInitCheck;