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

Commit 9e30bf5e authored by Eric Biggers's avatar Eric Biggers Committed by Gerrit Code Review
Browse files

Merge "init: remove session keyring workaround for old kernels" into main

parents e010614a 5d7c35ce
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -188,7 +188,6 @@ libinit_cc_defaults {
        "libfs_mgr",
        "libgsi",
        "libhidl-gen-utils",
        "libkeyutils",
        "liblog",
        "liblogwrap",
        "liblp",
+0 −3
Original line number Diff line number Diff line
@@ -592,9 +592,6 @@ static Result<void> queue_fs_event(int code) {
    } else if (code == FS_MGR_MNTALL_DEV_FILE_ENCRYPTED ||
               code == FS_MGR_MNTALL_DEV_IS_METADATA_ENCRYPTED ||
               code == FS_MGR_MNTALL_DEV_NEEDS_METADATA_ENCRYPTION) {
        if (!FscryptInstallKeyring()) {
            return Error() << "FscryptInstallKeyring() failed";
        }
        SetProperty("ro.crypto.state", "encrypted");

        // Although encrypted, vold has already set the device up, so we do not need to
+0 −16
Original line number Diff line number Diff line
@@ -34,28 +34,12 @@
#include <cutils/properties.h>
#include <cutils/sockets.h>
#include <fscrypt/fscrypt.h>
#include <keyutils.h>
#include <logwrap/logwrap.h>

#define TAG "fscrypt"

using namespace android::fscrypt;

bool FscryptInstallKeyring() {
    if (keyctl_search(KEY_SPEC_SESSION_KEYRING, "keyring", "fscrypt", 0) != -1) {
        LOG(INFO) << "Keyring is already created";
        return true;
    }
    key_serial_t device_keyring = add_key("keyring", "fscrypt", 0, 0, KEY_SPEC_SESSION_KEYRING);

    if (device_keyring == -1) {
        PLOG(ERROR) << "Failed to create keyring";
        return false;
    }
    LOG(INFO) << "Keyring created with id " << device_keyring << " in process " << getpid();
    return true;
}

// TODO(b/139378601): use a single central implementation of this.
static void delete_dir_contents(const std::string& dir) {
    char* const paths[2] = {const_cast<char*>(dir.c_str()), nullptr};
+0 −1
Original line number Diff line number Diff line
@@ -25,6 +25,5 @@ enum class FscryptAction {
    kDeleteIfNecessary,
};

bool FscryptInstallKeyring();
bool FscryptSetDirectoryPolicy(const std::string& ref_basename, FscryptAction action,
                               const std::string& dir);
+0 −1
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ cc_defaults {
        "libbase",
        "libfs_mgr",
        "libhidl-gen-utils",
        "libkeyutils",
        "liblog",
        "libprocessgroup",
        "libselinux",
Loading