OSDN Git Service

cryptfs: Make decrypted key buffers large enough
authorGreg Kaiser <gkaiser@google.com>
Sat, 10 Feb 2018 01:01:06 +0000 (17:01 -0800)
committerGreg Kaiser <gkaiser@google.com>
Sat, 10 Feb 2018 01:21:33 +0000 (17:21 -0800)
commit4a35ef0a53d1f8041adc8bf49585e700bb7af803
treead0389e8ee1518d3f2ac7b92246b097e6ebfe691
parent1452b27d4e445d71863d2bc2afce2825b9f68f13
cryptfs: Make decrypted key buffers large enough

Looking at the EVP_DecryptUpdate() documentation, we need a
buffer which isn't just the keysize, but also provides the
cipher block length minus one byte extra.  For EVP_aes_128_cbc(),
that block length is 16, but we use the maximum block length to
be safe for any future cipher change.

For two of our decrypted_master_key usages, the buffer was
already sufficiently sized.  But for one of our instances,
in cryptfs_enable_internal(), the buffer was previously
smaller than this.  So this CL represents a possible behavior
change if we were ever overrunning that buffer.

Bug: 7307919173176599
Test: Flashed an encrypted sailfish and it booted.

Change-Id: Ic5043340910dc7d625e6e5baedbca5bd4b2bfb03
cryptfs.cpp