Hi Folks,
First off, thanks for the hard work on the tboot project.
I downloaded the tboot-1.9.6 release and am having problems compiling
against openssl-1.1.0f. The file lcptools/hash.c has problems in
function hash_buffer().
It looks like this changeset did not go far enough:
changeset: 485:4304cb3a9b3e
user: Ning Sun <ning....@intel.com>
date: Thu May 18 11:12:34 2017 -0700
summary: [PATCH 1/4] Manage OpenSSL EVP_MD_CTX objects as pointers
Attached is a patch that fixes up hash_buffer() along the lines of
changeset 485:4304cb3a9b3e. With this patch applied the project
compiles OK.
Cheers,
Curt
port to openssl-1.1.0
SSL 1.1.0 made various structure opaque, so these objects can no
longer be created on the stack. The life cycle of these objects is
now managed with allocators and de-allocators.
This patch ports tboot to be compatible with openssl-1.1.0.
Signed-off-by: Curt Brune <c...@cumulusnetworks.com>
diff --git a/lcptools/hash.c b/lcptools/hash.c
index 4e328c6..71df5e3 100644
--- a/lcptools/hash.c
+++ b/lcptools/hash.c
@@ -74,13 +74,18 @@ bool hash_buffer(const unsigned char* buf, size_t size, tb_hash_t *hash,
return false;
if ( hash_alg == TB_HALG_SHA1_LG ) {
- EVP_MD_CTX ctx;
+ EVP_MD_CTX *ctx = EVP_MD_CTX_create();
+ if (ctx == NULL) {
+ fprintf(stderr, "%s(): EVP_MD_CTX_create() failed.\n", __func__);
+ return false;
+ }
const EVP_MD *md;
md = EVP_sha1();
- EVP_DigestInit(&ctx, md);
- EVP_DigestUpdate(&ctx, buf, size);
- EVP_DigestFinal(&ctx, hash->sha1, NULL);
+ EVP_DigestInit(ctx, md);
+ EVP_DigestUpdate(ctx, buf, size);
+ EVP_DigestFinal(ctx, hash->sha1, NULL);
+ EVP_MD_CTX_destroy(ctx);
return true;
}
else
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
tboot-devel mailing list
tboot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tboot-devel