OSDN Git Service

Validate decryption key length to decrypt function.
authorEdwin Wong <edwinwong@google.com>
Sat, 7 Oct 2017 01:21:06 +0000 (18:21 -0700)
committerNikoli Cartagena <dargeren@google.com>
Wed, 29 Nov 2017 05:27:22 +0000 (21:27 -0800)
commitea822ac16a558640aa886b0cc6e28ab8855dc3da
tree3c1ea721df3693a1bb7197a383e70f22c8001977
parentbb04dadfbbfc2c001638568e490b7513d2d3683d
Validate decryption key length to decrypt function.

Cherry picked from http://go/ag/3038278.

AesCtrDecryptor::decrypt() doesn't check whether the size of "key"
is equal to 16 bytes,  which may lead to an OOB read problem in the
context of mediadrmserver.

Add DecryptsWithEmptyKey and DecryptsWithKeyTooLong unit tests.

Test: ClearKeyDrmUnitTest
  adb shell LD_LIBRARY_PATH="/vendor/lib/mediadrm"
  /data/nativetest/ClearKeyDrmUnitTest/ClearKeyDrmUnitTest

bug: 63982768
Change-Id: I1f22c9df2b051972b2c532608b7f203e3ce77926
(cherry picked from commit 379b672b189aa72ce0103b485019022f3e292c36)
drm/mediadrm/plugins/clearkey/AesCtrDecryptor.cpp
drm/mediadrm/plugins/clearkey/AesCtrDecryptor.h
drm/mediadrm/plugins/clearkey/tests/AesCtrDecryptorUnittest.cpp