tboot/tboot-1.9.6-openssl11.patch
2018-02-06 11:41:25 +01:00

28 lines
928 B
Diff

diff -up tboot-1.9.6/lcptools/hash.c.openssl11 tboot-1.9.6/lcptools/hash.c
--- tboot-1.9.6/lcptools/hash.c.openssl11 2017-07-12 01:03:58.000000000 +0200
+++ tboot-1.9.6/lcptools/hash.c 2018-02-06 11:28:05.062843233 +0100
@@ -74,13 +74,19 @@ bool hash_buffer(const unsigned char* bu
return false;
if ( hash_alg == TB_HALG_SHA1_LG ) {
- EVP_MD_CTX ctx;
+ EVP_MD_CTX *ctx;
const EVP_MD *md;
md = EVP_sha1();
- EVP_DigestInit(&ctx, md);
- EVP_DigestUpdate(&ctx, buf, size);
- EVP_DigestFinal(&ctx, hash->sha1, NULL);
+ if ( md == NULL )
+ return false;
+ ctx = EVP_MD_CTX_create();
+ if ( ctx == NULL )
+ return false;
+ EVP_DigestInit(ctx, md);
+ EVP_DigestUpdate(ctx, buf, size);
+ EVP_DigestFinal(ctx, hash->sha1, NULL);
+ EVP_MD_CTX_destroy(ctx);
return true;
}
else