boringssl/include/openssl
David Benjamin 054e151b16 Rewrite ARM feature detection.
This removes the thread-unsafe SIGILL-based detection and the
multi-consumer-hostile CRYPTO_set_NEON_capable API. (Changing
OPENSSL_armcap_P after initialization is likely to cause problems.)

The right way to detect ARM features on Linux is getauxval. On aarch64,
we should be able to rely on this, so use it straight. Split this out
into its own file. The #ifdefs in the old cpu-arm.c meant it shared all
but no code with its arm counterpart anyway.

Unfortunately, various versions of Android have different missing APIs, so, on
arm, we need a series of workarounds. Previously, we used a SIGILL fallback
based on OpenSSL's logic, but this is inherently not thread-safe. (SIGILL also
does not tell us if the OS knows how to save and restore NEON state.) Instead,
base the behavior on Android NDK's cpu-features library, what Chromium
currently uses with CRYPTO_set_NEON_capable:

- Android before API level 20 does not provide getauxval. Where missing,
  we can read from /proc/self/auxv.

- On some versions of Android, /proc/self/auxv is also not readable, so
  use /proc/cpuinfo's Features line.

- Linux only advertises optional features in /proc/cpuinfo. ARMv8 makes NEON
  mandatory, so /proc/cpuinfo can't be used without additional effort.

Finally, we must blacklist a particular chip because the NEON unit is broken
(https://crbug.com/341598).

Unfortunately, this means CRYPTO_library_init now depends on /proc being
available, which will require some care with Chromium's sandbox. The
simplest solution is to just call CRYPTO_library_init before entering
the sandbox.

It's worth noting that Chromium's current EnsureOpenSSLInit function already
depends on /proc/cpuinfo to detect the broken CPU, by way of base::CPU.
android_getCpuFeatures also interally depends on it. We were already relying on
both of those being stateful and primed prior to entering the sandbox.

BUG=chromium:589200

Change-Id: Ic5d1c341aab5a614eb129d8aa5ada2809edd6af8
Reviewed-on: https://boringssl-review.googlesource.com/7506
Reviewed-by: David Benjamin <davidben@google.com>
2016-03-26 04:54:44 +00:00
..
aead.h Point EVP_aead_chacha20_poly1305 at the standardized version. 2015-12-16 21:22:11 +00:00
aes.h
arm_arch.h Remove CRYPTO_set_NEON_functional. 2016-02-23 23:19:46 +00:00
asn1_mac.h
asn1.h Align with upstream's error strings, take two. 2016-03-15 16:02:12 +00:00
asn1t.h
base64.h
base.h Match upstream's error codes for the old sigalg code. 2016-03-11 21:15:47 +00:00
bio.h Include buffer.h from bio.h. 2016-03-08 01:44:37 +00:00
blowfish.h
bn.h Rename the BIGNUM ASN.1 functions. 2016-01-27 22:37:44 +00:00
buf.h Have doc.go parse struct comments. 2016-01-26 23:23:23 +00:00
buffer.h
bytestring.h Add CBS_ASN1_UTF8STRING define. 2016-03-23 19:29:49 +00:00
cast.h
chacha.h
cipher.h
cmac.h
conf.h Fix the shared library build. 2016-03-09 20:13:41 +00:00
cpu.h Rewrite ARM feature detection. 2016-03-26 04:54:44 +00:00
crypto.h Rewrite ARM feature detection. 2016-03-26 04:54:44 +00:00
curve25519.h Add SPAKE2 over Ed25519. 2016-03-01 19:34:10 +00:00
des.h
dh.h Add missing prototypes. 2016-03-20 16:43:50 +00:00
digest.h
dsa.h Add DSA_generate_parameters to decrepit. 2016-03-08 01:44:27 +00:00
dtls1.h
ec_key.h Rewrite ECPrivateKey serialization. 2016-02-16 23:51:09 +00:00
ec.h Restore EC_GROUP_new_by_curve_name and EC_GROUP_set_generator. 2016-03-15 18:53:12 +00:00
ecdh.h
ecdsa.h Update comments to better document in-place semantics. 2016-01-19 17:01:37 +00:00
engine.h
err.h Have doc.go parse struct comments. 2016-01-26 23:23:23 +00:00
evp.h Reset crypto/evp error codes. 2016-02-26 23:34:04 +00:00
ex_data.h Skip free callbacks on empty CRYPTO_EX_DATAs. 2015-12-15 21:32:14 +00:00
hkdf.h
hmac.h
lhash_macros.h
lhash.h
md4.h Add one-shot |MD4| function. 2016-03-09 01:13:55 +00:00
md5.h Store the partial block as uint8_t, not uint32_t. 2015-12-16 19:59:29 +00:00
mem.h Add CRYPTO_[malloc|free|realloc] as aliases for the OPENSSL_𝑥 names. 2016-03-10 17:44:23 +00:00
obj_mac.h Rename NID_x25519 to NID_X25519. 2016-03-07 15:48:51 +00:00
obj.h Add |OBJ_NAME_do_all_sorted|. 2016-03-09 19:38:06 +00:00
objects.h
opensslconf.h Rename opensslfeatures.h to opensslconf.h. 2016-02-26 01:32:50 +00:00
opensslv.h
ossl_typ.h
pem.h Decouple the EVP and PEM code. 2016-02-26 22:50:21 +00:00
pkcs7.h
pkcs8.h Changes to support node.js's use of PKCS#12. 2016-02-02 19:21:59 +00:00
pkcs12.h
poly1305.h Enable upstream's Poly1305 code. 2016-02-26 16:05:14 +00:00
pqueue.h
rand.h Add a deterministic PRNG for fuzzing. 2016-03-03 01:36:19 +00:00
rc4.h Add |RC4_options| to decrepit. 2016-03-09 01:14:30 +00:00
ripemd.h Add RIPEMD160 support in decrepit. 2016-03-09 19:37:14 +00:00
rsa.h Always cache Montgomery contexts in RSA. 2016-03-25 20:04:24 +00:00
safestack.h
sha.h Store the partial block as uint8_t, not uint32_t. 2015-12-16 19:59:29 +00:00
srtp.h
ssl3.h Remove SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER. 2015-12-15 19:14:00 +00:00
ssl.h SSL_set_fd should create socket BIOs, not fd BIOs. 2016-03-07 18:19:12 +00:00
stack_macros.h Remove stack macros for nonexistent types. 2015-12-22 00:12:38 +00:00
stack.h Remove stack macros for nonexistent types. 2015-12-22 00:12:38 +00:00
thread.h
time_support.h Include time.h in time_support.h. 2016-03-17 17:27:27 +00:00
tls1.h Update references to the extended master secret draft. 2016-02-02 16:37:55 +00:00
type_check.h
x509_vfy.h Bring back |verify_store|. 2016-03-02 15:57:27 +00:00
x509.h Align with upstream's error strings, take two. 2016-03-15 16:02:12 +00:00
x509v3.h Add missing prototypes. 2016-03-20 16:43:50 +00:00