Zero-copy digesting for direct ByteBuffer input.

Prior to this change, Conscrypt's MessageDigest.update(ByteBuffer)
invoked for a direct ByteBuffer resulted in the creation of a new
byte[] of size ByteBuffer.remaining() and the copying of the
ByteBuffer's contents into that array.

This change implements an optimization which avoids the allocation
and copying, by making BoringSSL EVP_DigestUpdate read directly from
the memory region represented by the direct ByteBuffer.

Change-Id: I112d318128402d1d78e226df9dfe54af55955953
3 files changed