Prefer AES when hardware acceleration is available

ChaCha20-Poly1305 is more efficient in software, but many modern CPUs
have acceleration for AES which makes AES-GCM the more preferable choice
in terms of throughput and battery consumption (i.e., less CPU cycles
per byte).

Use the CPU features as reported by BoringSSL to determine when to
prioritize AES-GCM over ChaCha20-Poly1305. This should be good enough to
say when the trade-off should be made.

(cherry picked from commit 4209803a99fe1c26e5ef66c16dc70e302a428e8a)

Bug: 26945889
Change-Id: I7ae2f3e422e30e83324c08514509cb3e9a506d97
2 files changed