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

Commit 44671d92 authored by David Drysdale's avatar David Drysdale Committed by Gerrit Code Review
Browse files

Merge "Skip curve25519 upgrade tests on KeyMint v1"

parents a81c9a1e 9ea96ddd
Loading
Loading
Loading
Loading
+18 −12
Original line number Diff line number Diff line
@@ -76,18 +76,14 @@ std::vector<std::string> keyblob_names_tee = {
        "rsa-key",        "p256-key",        "ed25519-key",       "x25519-key",
        "rsa-attest-key", "p256-attest-key", "ed25519-attest-key"};

std::vector<std::string> keyblob_names_tee_no_25519 = {
        "aes-key", "aes-key-rr", "des-key",        "hmac-key",
        "rsa-key", "p256-key",   "rsa-attest-key", "p256-attest-key"};

std::vector<std::string> keyblob_names_sb = {"aes-key",        "aes-key-rr",     "des-key",
                                             "hmac-key",       "rsa-key",        "p256-key",
                                             "rsa-attest-key", "p256-attest-key"};

const std::vector<std::string>& keyblob_names(SecurityLevel sec_level) {
    if (sec_level == SecurityLevel::STRONGBOX) {
        return keyblob_names_sb;
    } else {
        return keyblob_names_tee;
    }
}

bool requires_rr(const std::string& name) {
    return name.find("-rr") != std::string::npos;
}
@@ -194,13 +190,23 @@ std::vector<uint8_t> load_cert(const std::string& subdir, const std::string& nam

class KeyBlobUpgradeTest : public KeyMintAidlTestBase {
  protected:
    const std::vector<std::string>& keyblob_names() {
        if (SecLevel() == SecurityLevel::STRONGBOX) {
            return keyblob_names_sb;
        } else if (!Curve25519Supported()) {
            return keyblob_names_tee_no_25519;
        } else {
            return keyblob_names_tee;
        }
    }

    void UpgradeKeyBlobs(bool expectUpgrade) {
        std::string subdir = keyblob_subdir(keyblob_dir, GetParam(), /* create? */ false);
        if (subdir.empty()) {
            GTEST_SKIP() << "No keyblob directory provided";
        }

        for (std::string name : keyblob_names(SecLevel())) {
        for (std::string name : keyblob_names()) {
            for (bool with_hidden : {false, true}) {
                std::string app_id;
                std::string app_data;
@@ -348,7 +354,7 @@ TEST_P(KeyBlobUpgradeTest, CreateKeyBlobsBefore) {
                            .SetDefaultValidity(),
            }};

    for (std::string name : keyblob_names(SecLevel())) {
    for (std::string name : keyblob_names()) {
        auto entry = keys_info.find(name);
        ASSERT_NE(entry, keys_info.end()) << "no builder for " << name;
        auto builder = entry->second;
@@ -425,7 +431,7 @@ TEST_P(KeyBlobUpgradeTest, UseKeyBlobsBeforeOrAfter) {
                        "/data/local/tmp/keymint-blobs";
    }

    for (std::string name : keyblob_names(SecLevel())) {
    for (std::string name : keyblob_names()) {
        for (bool with_hidden : {false, true}) {
            auto builder = AuthorizationSetBuilder();
            if (with_hidden) {
@@ -562,7 +568,7 @@ TEST_P(KeyBlobUpgradeTest, DeleteRRKeyBlobsAfter) {
                        "/data/local/tmp/keymint-blobs";
    }

    for (std::string name : keyblob_names(SecLevel())) {
    for (std::string name : keyblob_names()) {
        for (bool with_hidden : {false, true}) {
            auto builder = AuthorizationSetBuilder();
            if (with_hidden) {