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

Commit 81824ebf authored by Elliott Hughes's avatar Elliott Hughes Committed by Gerrit Code Review
Browse files

Merge "Add libkeyutils."

parents f218210f f8627cea
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -128,7 +128,8 @@ LOCAL_STATIC_LIBRARIES := \
    libsparse \
    libsparse \
    libz \
    libz \
    libprocessgroup \
    libprocessgroup \
    libavb
    libavb \
    libkeyutils \


# Create symlinks.
# Create symlinks.
LOCAL_POST_INSTALL_CMD := $(hide) mkdir -p $(TARGET_ROOT_OUT)/sbin; \
LOCAL_POST_INSTALL_CMD := $(hide) mkdir -p $(TARGET_ROOT_OUT)/sbin; \
+5 −6
Original line number Original line Diff line number Diff line
@@ -21,7 +21,6 @@
#include <errno.h>
#include <errno.h>
#include <fcntl.h>
#include <fcntl.h>
#include <inttypes.h>
#include <inttypes.h>
#include <keyutils.h>
#include <libgen.h>
#include <libgen.h>
#include <paths.h>
#include <paths.h>
#include <signal.h>
#include <signal.h>
@@ -39,10 +38,6 @@
#include <sys/wait.h>
#include <sys/wait.h>
#include <unistd.h>
#include <unistd.h>


#include <selinux/selinux.h>
#include <selinux/label.h>
#include <selinux/android.h>

#include <android-base/chrono_utils.h>
#include <android-base/chrono_utils.h>
#include <android-base/file.h>
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/logging.h>
@@ -50,8 +45,12 @@
#include <android-base/stringprintf.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
#include <android-base/strings.h>
#include <android-base/unique_fd.h>
#include <android-base/unique_fd.h>
#include <keyutils.h>
#include <libavb/libavb.h>
#include <libavb/libavb.h>
#include <private/android_filesystem_config.h>
#include <private/android_filesystem_config.h>
#include <selinux/android.h>
#include <selinux/label.h>
#include <selinux/selinux.h>


#include <fstream>
#include <fstream>
#include <memory>
#include <memory>
@@ -1024,7 +1023,7 @@ int main(int argc, char** argv) {
    // Set up a session keyring that all processes will have access to. It
    // Set up a session keyring that all processes will have access to. It
    // will hold things like FBE encryption keys. No process should override
    // will hold things like FBE encryption keys. No process should override
    // its session keyring.
    // its session keyring.
    keyctl(KEYCTL_GET_KEYRING_ID, KEY_SPEC_SESSION_KEYRING, 1);
    keyctl_get_keyring_ID(KEY_SPEC_SESSION_KEYRING, 1);


    // Indicate that booting is in progress to background fw loaders, etc.
    // Indicate that booting is in progress to background fw loaders, etc.
    close(open("/dev/.booting", O_WRONLY | O_CREAT | O_CLOEXEC, 0000));
    close(open("/dev/.booting", O_WRONLY | O_CREAT | O_CLOEXEC, 0000));

init/keyutils.h

deleted100644 → 0
+0 −44
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/* Miniature version of a header-only keyutils.h (no library required) */

#ifndef _INIT_KEYUTILS_H_
#define _INIT_KEYUTILS_H_

#ifndef KEYUTILS_H /* walk away if the _real_ one exists */

#include <linux/keyctl.h>
#include <stdarg.h>
#include <sys/syscall.h>
#include <unistd.h>

static inline long keyctl(int cmd, ...) {
    va_list va;
    unsigned long arg2, arg3, arg4, arg5;

    va_start(va, cmd);
    arg2 = va_arg(va, unsigned long);
    arg3 = va_arg(va, unsigned long);
    arg4 = va_arg(va, unsigned long);
    arg5 = va_arg(va, unsigned long);
    va_end(va);
    return syscall(__NR_keyctl, cmd, arg2, arg3, arg4, arg5);
}

#endif

#endif
+1 −0
Original line number Original line Diff line number Diff line
../.clang-format-2
 No newline at end of file

libkeyutils/Android.bp

0 → 100644
+16 −0
Original line number Original line Diff line number Diff line
cc_library {
    name: "libkeyutils",
    cflags: ["-Werror"],
    defaults: ["linux_bionic_supported"],
    export_include_dirs: ["include/"],
    local_include_dirs: ["include/"],
    srcs: ["keyutils.cpp"],
    stl: "none",
}

cc_test {
    name: "libkeyutils-tests",
    cflags: ["-Werror"],
    shared_libs: ["libkeyutils"],
    srcs: ["keyutils_test.cpp"],
}
Loading