OSDN Git Service

Have generateKey() treat additional entropy as optional
authorBartosz Fabianowski <bartfab@google.com>
Mon, 13 Feb 2017 15:50:24 +0000 (16:50 +0100)
committerBartosz Fabianowski <bartfab@google.com>
Tue, 14 Feb 2017 10:24:38 +0000 (11:24 +0100)
commit50624e995d07b8fa214f8e0885696445df470018
tree690a1574c8830eb3e7fd6302d9ce97465e2605e6
parent5331371a3aa6d61546866f81a4ddea0220b901f0
Have generateKey() treat additional entropy as optional

KeyStore.generateKey() takes an entropy parameter. This is optional
and can be null. That is how KeyStore used to work but a recent
refactor made us always feed the entropy to keymaster, even if it
is empty (null or byte[0] on the Java side). This CL makes us ignore
such empty entropy again.

We only noticed this because a recently added GTS test that happens
to set the entropy to null is failing on some hardware (other
keymaster implementations silently ignore this invalid attempt to
set entropy).

Bug: 35156555
Test: gts-tradefed run gts --module GtsGmscoreHostTestCases
      --test com.google.android.gts.security.DeviceIdAttestationHostTest

Change-Id: Iadaf40e69350c17dd18e4dc2a1dab97fa911e1bf
keymaster/3.0/default/KeymasterDevice.cpp