Snap for 8604758 from df1a1e826f54c950c475c487498d78a3888a5f5a to tm-frc-art-release
Change-Id: I6ae1df8adb4c8abced96e53b91aebcf048410030
diff --git a/selftest/boringssl_self_test.cpp b/selftest/boringssl_self_test.cpp
index 3d2d520..4776fa1 100644
--- a/selftest/boringssl_self_test.cpp
+++ b/selftest/boringssl_self_test.cpp
@@ -16,12 +16,16 @@
#include <openssl/crypto.h>
+// This program is run early during boot and if it exits with a
+// failure status then the device will reboot to the bootloader.
+// See init.rc for details.
+// It may also exit before reaching main() if BoringSSL fast tests fail.
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 1; // Fail: BoringSSL not built in FIPS mode.
}
- return 0; // success
+ if (!BORINGSSL_self_test()) {
+ return 1; // Fail: One or more self tests failed.
+ }
+ return 0; // Success
}