2sha: Add a vb2_hash type to make it easier to work with hashes

I'm prototyping some coreboot code to closer integrate vboot with CBFS
(per-file hashing and that stuff). While doing that, I noticed that it
would be neat to have a standardized serializable representation for any
kind of vboot hash. We already have something like that in CBFS
attributes, but if we want to use it more generally it makes more sense
to put it in vboot. This patch adds a suitable structure defintion to
2sha.h and two utility functions that can be used to work with it.

Also add alloca() because I need it and fix the return types of
vb2_..._size(), because those are just plain wrong.

BRANCH=None
BUG=None
TEST=make runtests

Change-Id: I4b535ad43704693463fb114d6a81d2b5689a87b9
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1963614
Reviewed-by: Joel Kitching <kitching@chromium.org>
5 files changed