90 lines
3.0 KiB
Diff
90 lines
3.0 KiB
Diff
|
From e43831512dad43ec5537d30911dba5f4c36fef59 Mon Sep 17 00:00:00 2001
|
|||
|
From: William Roberts <william.c.roberts@intel.com>
|
|||
|
Date: Wed, 17 Oct 2018 08:27:11 -0700
|
|||
|
Subject: [PATCH] tpm2_getmanufc: fix OSSL build warnings
|
|||
|
MIME-Version: 1.0
|
|||
|
Content-Type: text/plain; charset=UTF-8
|
|||
|
Content-Transfer-Encoding: 8bit
|
|||
|
|
|||
|
Fix the following reported error:
|
|||
|
|
|||
|
In file included from tools/tpm2_getmanufec.c:42:0:
|
|||
|
tools/tpm2_getmanufec.c: In function ‘Base64Encode’:
|
|||
|
/home/travis/build/AndreasFuchsSIT/tpm2-tss-engine/tpm2-tools/../installdir/usr/local/include/openssl/bio.h:596:34: error: value computed is not used [-Werror=unused-value]
|
|||
|
# define BIO_flush(b) (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL)
|
|||
|
^
|
|||
|
tools/tpm2_getmanufec.c:290:5: note: in expansion of macro ‘BIO_flush’
|
|||
|
BIO_flush(bio);
|
|||
|
^
|
|||
|
/home/travis/build/AndreasFuchsSIT/tpm2-tss-engine/tpm2-tools/../installdir/usr/local/include/openssl/bio.h:589:34: error: value computed is not used [-Werror=unused-value]
|
|||
|
# define BIO_set_close(b,c) (int)BIO_ctrl(b,BIO_CTRL_SET_CLOSE,(c),NULL)
|
|||
|
^
|
|||
|
tools/tpm2_getmanufec.c:292:5: note: in expansion of macro ‘BIO_set_close’
|
|||
|
BIO_set_close(bio, BIO_NOCLOSE);
|
|||
|
^
|
|||
|
cc1: all warnings being treated as errors
|
|||
|
make: *** [tools/tpm2_getmanufec.o] Error 1
|
|||
|
make: *** Waiting for unfinished jobs....
|
|||
|
|
|||
|
Fixes: #1200
|
|||
|
|
|||
|
Signed-off-by: William Roberts <william.c.roberts@intel.com>
|
|||
|
---
|
|||
|
tools/tpm2_getmanufec.c | 18 ++++++++++++++----
|
|||
|
1 file changed, 14 insertions(+), 4 deletions(-)
|
|||
|
|
|||
|
diff --git a/tools/tpm2_getmanufec.c b/tools/tpm2_getmanufec.c
|
|||
|
index 6ddf31eee5d..89702f9c78a 100644
|
|||
|
--- a/tools/tpm2_getmanufec.c
|
|||
|
+++ b/tools/tpm2_getmanufec.c
|
|||
|
@@ -274,6 +274,7 @@ char *Base64Encode(const unsigned char* buffer)
|
|||
|
{
|
|||
|
BIO *bio, *b64;
|
|||
|
BUF_MEM *bufferPtr;
|
|||
|
+ char *final_string = NULL;
|
|||
|
|
|||
|
LOG_INFO("Calculating the Base64Encode of the hash of the Endorsement Public Key:");
|
|||
|
|
|||
|
@@ -287,9 +288,19 @@ char *Base64Encode(const unsigned char* buffer)
|
|||
|
bio = BIO_push(b64, bio);
|
|||
|
BIO_set_flags(bio, BIO_FLAGS_BASE64_NO_NL);
|
|||
|
BIO_write(bio, buffer, SHA256_DIGEST_LENGTH);
|
|||
|
- BIO_flush(bio);
|
|||
|
+ int rc = BIO_flush(bio);
|
|||
|
+ if (rc < 0) {
|
|||
|
+ LOG_ERR("BIO_flush() failed");
|
|||
|
+ goto bio_out;
|
|||
|
+ }
|
|||
|
+
|
|||
|
BIO_get_mem_ptr(bio, &bufferPtr);
|
|||
|
- BIO_set_close(bio, BIO_NOCLOSE);
|
|||
|
+
|
|||
|
+ rc = BIO_set_close(bio, BIO_NOCLOSE);
|
|||
|
+ if (rc < 0) {
|
|||
|
+ LOG_ERR("BIO_set_close() failed");
|
|||
|
+ goto bio_out;
|
|||
|
+ }
|
|||
|
|
|||
|
/* these are not NULL terminated */
|
|||
|
char *b64text = bufferPtr->data;
|
|||
|
@@ -305,8 +316,6 @@ char *Base64Encode(const unsigned char* buffer)
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
- char *final_string = NULL;
|
|||
|
-
|
|||
|
CURL *curl = curl_easy_init();
|
|||
|
if (curl) {
|
|||
|
char *output = curl_easy_escape(curl, b64text, len);
|
|||
|
@@ -317,6 +326,7 @@ char *Base64Encode(const unsigned char* buffer)
|
|||
|
}
|
|||
|
curl_easy_cleanup(curl);
|
|||
|
curl_global_cleanup();
|
|||
|
+bio_out:
|
|||
|
BIO_free_all(bio);
|
|||
|
|
|||
|
/* format to a proper NULL terminated string */
|
|||
|
--
|
|||
|
2.19.2
|
|||
|
|