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

Commit c9b9e10e authored by Pavel Grafov's avatar Pavel Grafov Committed by Android (Google) Code Review
Browse files

Merge "Run and log BoringSSL self-test for NIAP compliance."

parents bc88614a b7455404
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -6740,6 +6740,7 @@ package android.app.admin {
    field public static final int TAG_APP_PROCESS_START = 210005; // 0x33455
    field public static final int TAG_CERT_AUTHORITY_INSTALLED = 210029; // 0x3346d
    field public static final int TAG_CERT_AUTHORITY_REMOVED = 210030; // 0x3346e
    field public static final int TAG_CRYPTO_SELF_TEST_COMPLETED = 210031; // 0x3346f
    field public static final int TAG_KEYGUARD_DISABLED_FEATURES_SET = 210021; // 0x33465
    field public static final int TAG_KEYGUARD_DISMISSED = 210006; // 0x33456
    field public static final int TAG_KEYGUARD_DISMISS_AUTH_ATTEMPT = 210007; // 0x33457
+10 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ public class SecurityLog {
            TAG_KEY_DESTRUCTION,
            TAG_CERT_AUTHORITY_INSTALLED,
            TAG_CERT_AUTHORITY_REMOVED,
            TAG_CRYPTO_SELF_TEST_COMPLETED,
    })
    public @interface SecurityLogTag {}

@@ -399,6 +400,14 @@ public class SecurityLog {
    public static final int TAG_USER_RESTRICTION_REMOVED =
            SecurityLogTags.SECURITY_USER_RESTRICTION_REMOVED;

    /**
     * Indicates that cryptographic functionality self test has completed. The log entry contains an
     * {@code Integer} payload, indicating the result of the test (0 if the test failed, 1 if
     * succeeded) and accessible via {@link SecurityEvent#getData()}.
     */
    public static final int TAG_CRYPTO_SELF_TEST_COMPLETED =
            SecurityLogTags.SECURITY_CRYPTO_SELF_TEST_COMPLETED;

    /**
     * Event severity level indicating that the event corresponds to normal workflow.
     */
@@ -529,6 +538,7 @@ public class SecurityLog {
                case TAG_USER_RESTRICTION_REMOVED:
                    return LEVEL_INFO;
                case TAG_CERT_AUTHORITY_REMOVED:
                case TAG_CRYPTO_SELF_TEST_COMPLETED:
                    return getSuccess() ? LEVEL_INFO : LEVEL_ERROR;
                case TAG_CERT_AUTHORITY_INSTALLED:
                case TAG_KEYGUARD_DISMISS_AUTH_ATTEMPT:
+2 −1
Original line number Diff line number Diff line
@@ -35,3 +35,4 @@ option java_package android.app.admin
210028 security_user_restriction_removed        (package|3),(admin_user|1),(restriction|3)
210029 security_cert_authority_installed        (success|1),(subject|3)
210030 security_cert_authority_removed          (success|1),(subject|3)
210031 security_crypto_self_test_completed      (success|1)
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ cc_library_static {
        "com_android_server_connectivity_Vpn.cpp",
        "com_android_server_connectivity_tethering_OffloadHardwareInterface.cpp",
        "com_android_server_ConsumerIrService.cpp",
        "com_android_server_devicepolicy_CryptoTestHelper.cpp",
        "com_android_server_HardwarePropertiesManagerService.cpp",
        "com_android_server_hdmi_HdmiCecController.cpp",
        "com_android_server_input_InputApplicationHandle.cpp",
+42 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 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.
 */

#include "jni.h"
#include "core_jni_helpers.h"

#include <openssl/crypto.h>

namespace {

static jint runSelfTest(JNIEnv* env, jobject /* clazz */) {
    return BORINGSSL_self_test();
}

static const JNINativeMethod methods[] = {
    /* name, signature, funcPtr */
    {"runSelfTest", "()I", (void*) runSelfTest}
};

} // anonymous namespace

namespace android {

int register_android_server_devicepolicy_CryptoTestHelper(JNIEnv *env) {
    return jniRegisterNativeMethods(
            env, "com/android/server/devicepolicy/CryptoTestHelper", methods, NELEM(methods));
}

} // namespace android
 No newline at end of file
Loading