diff options
author | Pete Bentley <prb@google.com> | 2019-10-21 08:10:03 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-10-21 08:10:03 -0700 |
commit | e4f6585f979a89e09b92ddcca3e55dbae43620d1 (patch) | |
tree | 674d759d76017ce859c30f0a31de84382697ed7a | |
parent | e148df97ecaa6a2f75a4e5bb83e18d312c5d1795 (diff) | |
parent | abe58f95ba4dbea46fa913a8dddf66f622d1d085 (diff) | |
download | boringssl-e4f6585f979a89e09b92ddcca3e55dbae43620d1.tar.gz |
Merge "Move BoringSSL self test binaries to external/boringssl." am: bfc55bd05b
am: abe58f95ba
Change-Id: I0100ca82103762b18a8c5be27e0a17cd7436abdc
-rw-r--r-- | selftest/Android.bp | 50 | ||||
-rw-r--r-- | selftest/boringssl_self_test.cpp | 27 | ||||
-rw-r--r-- | selftest/boringssl_self_test.rc | 15 |
3 files changed, 92 insertions, 0 deletions
diff --git a/selftest/Android.bp b/selftest/Android.bp new file mode 100644 index 00000000..5e92441b --- /dev/null +++ b/selftest/Android.bp @@ -0,0 +1,50 @@ +// +// Copyright (C) 2019 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. + +cc_defaults { + name: "boringssl_self_test_defaults", + compile_multilib: "both", + multilib: { + lib32: { + suffix: "32", + }, + lib64: { + suffix: "64", + }, + }, + shared_libs: [ + "libcrypto", + ], + srcs: [ + "boringssl_self_test.cpp", + ], +} + +cc_binary { + name: "boringssl_self_test", + visibility: [ + "//external/conscrypt/apex", + "//external/conscrypt/apex/testing", + ], + defaults: ["boringssl_self_test_defaults"], +} + +cc_binary { + name: "boringssl_self_test_vendor", + defaults: ["boringssl_self_test_defaults"], + stem: "boringssl_self_test", + vendor: true, + init_rc: ["boringssl_self_test.rc"], +} diff --git a/selftest/boringssl_self_test.cpp b/selftest/boringssl_self_test.cpp new file mode 100644 index 00000000..3d2d5209 --- /dev/null +++ b/selftest/boringssl_self_test.cpp @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2019 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 <openssl/crypto.h> + +int main(int, char**) { + // If we get here, then libcrypto is either in FIPS mode (in which case + // it doesn't run the self test), or the self test has passed. If the + // self test ran and failed, then libcrypto will already have abort()ed. + if (!FIPS_mode()) { + return 1; // failure + } + return 0; // success +} diff --git a/selftest/boringssl_self_test.rc b/selftest/boringssl_self_test.rc new file mode 100644 index 00000000..dc08111e --- /dev/null +++ b/selftest/boringssl_self_test.rc @@ -0,0 +1,15 @@ +# Run boringssl self test for each ABI so that later processes can skip it. http://b/139348610 +on early-init && property:ro.product.cpu.abilist32=* + exec_start boringssl_self_test32_vendor +on early-init && property:ro.product.cpu.abilist64=* + exec_start boringssl_self_test64_vendor + +service boringssl_self_test32_vendor /vendor/bin/boringssl_self_test32 + setenv BORINGSSL_SELF_TEST_CREATE_FLAG true # Any nonempty value counts as true + reboot_on_failure reboot,boringssl-self-check-failed + stdio_to_kmsg + +service boringssl_self_test64_vendor /vendor/bin/boringssl_self_test64 + setenv BORINGSSL_SELF_TEST_CREATE_FLAG true # Any nonempty value counts as true + reboot_on_failure reboot,boringssl-self-check-failed + stdio_to_kmsg |