vboot: include vb2_sha.h when required

Should include vb2_sha.h header when SHA library functions or
constants are required.  This replaces NEED_VB2_SHA_LIBRARY.

BUG=b:124141368, chromium:956474
TEST=make clean && make test-abuild
BRANCH=none

Change-Id: I9f32174dbf3de05fbe5279cb8017888757abf368
Signed-off-by: Joel Kitching <kitching@google.com>
Cq-Depend: chromium:1583820
Reviewed-on: https://review.coreboot.org/c/coreboot/+/32454
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
diff --git a/src/commonlib/cbfs.c b/src/commonlib/cbfs.c
index 4379099..a509bc9 100644
--- a/src/commonlib/cbfs.c
+++ b/src/commonlib/cbfs.c
@@ -18,6 +18,7 @@
 #include <commonlib/endian.h>
 #include <commonlib/helpers.h>
 #include <string.h>
+#include <vb2_sha.h>
 
 #if !defined(ERROR)
 #define ERROR(x...) printk(BIOS_ERR, "CBFS: " x)
diff --git a/src/security/tpm/tspi/tspi.c b/src/security/tpm/tspi/tspi.c
index e466eb8..4698a4d 100644
--- a/src/security/tpm/tspi/tspi.c
+++ b/src/security/tpm/tspi/tspi.c
@@ -22,6 +22,7 @@
 #include <stdlib.h>
 #if CONFIG(VBOOT)
 #include <vb2_api.h>
+#include <vb2_sha.h>
 #include <assert.h>
 #endif
 
diff --git a/src/security/vboot/antirollback.h b/src/security/vboot/antirollback.h
index 6ea2c13..62d2e20 100644
--- a/src/security/vboot/antirollback.h
+++ b/src/security/vboot/antirollback.h
@@ -37,6 +37,7 @@
 
 #include <types.h>
 #include <security/tpm/tspi.h>
+#include <vb2_sha.h>
 
 struct vb2_context;
 enum vb2_pcr_digest;
diff --git a/util/cbfstool/Makefile.inc b/util/cbfstool/Makefile.inc
index 1787eb1..7928520 100644
--- a/util/cbfstool/Makefile.inc
+++ b/util/cbfstool/Makefile.inc
@@ -81,7 +81,6 @@
 TOOLCPPFLAGS += -I$(objutil)/cbfstool
 TOOLCPPFLAGS += -I$(top)/src/commonlib/include
 TOOLCPPFLAGS += -include $(top)/src/commonlib/include/commonlib/compiler.h
-TOOLCPPFLAGS += -DNEED_VB2_SHA_LIBRARY
 TOOLCPPFLAGS += -I$(VBOOT_SOURCE)/firmware/include
 TOOLCPPFLAGS += -I$(VBOOT_SOURCE)/firmware/2lib/include
 # UEFI header file support. It's not pretty, but that's what we currently
diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c
index 5ff8130..5cbe1f1 100644
--- a/util/cbfstool/cbfs_image.c
+++ b/util/cbfstool/cbfs_image.c
@@ -22,6 +22,7 @@
 #include <string.h>
 #include <strings.h>
 #include <commonlib/endian.h>
+#include <vb2_sha.h>
 
 #include "common.h"
 #include "cbfs_image.h"