Check for empty vectors in RKP COSE code

The std::vector::data accessor returns nullptr if the vector is empty.
We were not checking for empty vectors in some spots, and were thus
passing nullptr to Boring crypto. Boring does not generally check for
null pointers on inputs, so we end up segfaulting.

Work around this by explicitly checking for empty buffers in places
where the return value from std::vector::data is passed to Boring.

Test: atest RemoteProvisionerUnitTests
Change-Id: I92c203196a904c1ee95c6de4b0a7962ac0d9292d
1 file changed