summaryrefslogtreecommitdiff
path: root/Cryptlib/Pk/CryptTs.c
diff options
context:
space:
mode:
authorGary Lin <glin@suse.com>2017-04-06 15:54:00 +0800
committerPeter Jones <pjones@redhat.com>2017-04-11 10:42:18 -0400
commitd064bd7eef201f26cb926450a76260b5187ac689 (patch)
tree31e32f58f8c5b17b57e674d40a585d119857d21b /Cryptlib/Pk/CryptTs.c
parent9bc86cfd6f9387f0da9d5c0102b6aa5627e91c91 (diff)
downloadefi-boot-shim-d064bd7eef201f26cb926450a76260b5187ac689.tar.gz
efi-boot-shim-d064bd7eef201f26cb926450a76260b5187ac689.zip
Cryptlib: Update to the latest edk2 commit
- Update to edk2 commit 7c410b3d4180087020c7734bf67cdc4ad9fdb136 CryptoPkg/BaseCryptLib: Adding NULL checking in time() wrapper. - Update headers in Cryptlib/Include/openssl/ to 1.1.0e + Also copy the openssl internal headers Signed-off-by: Gary Lin <glin@suse.com>
Diffstat (limited to 'Cryptlib/Pk/CryptTs.c')
-rw-r--r--Cryptlib/Pk/CryptTs.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/Cryptlib/Pk/CryptTs.c b/Cryptlib/Pk/CryptTs.c
index 1b78472f..d63c23df 100644
--- a/Cryptlib/Pk/CryptTs.c
+++ b/Cryptlib/Pk/CryptTs.c
@@ -5,7 +5,7 @@
the lifetime of the signature when a signing certificate expires or is later
revoked.
-Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -239,7 +239,7 @@ CheckTSTInfo (
TS_MESSAGE_IMPRINT *Imprint;
X509_ALGOR *HashAlgo;
CONST EVP_MD *Md;
- EVP_MD_CTX MdCtx;
+ EVP_MD_CTX *MdCtx;
UINTN MdSize;
UINT8 *HashedMsg;
@@ -249,6 +249,7 @@ CheckTSTInfo (
Status = FALSE;
HashAlgo = NULL;
HashedMsg = NULL;
+ MdCtx = NULL;
//
// -- Check version number of Timestamp:
@@ -285,11 +286,17 @@ CheckTSTInfo (
if (HashedMsg == NULL) {
goto _Exit;
}
- EVP_DigestInit (&MdCtx, Md);
- EVP_DigestUpdate (&MdCtx, TimestampedData, DataSize);
- EVP_DigestFinal (&MdCtx, HashedMsg, NULL);
+ MdCtx = EVP_MD_CTX_new ();
+ if (MdCtx == NULL) {
+ goto _Exit;
+ }
+ if ((EVP_DigestInit_ex (MdCtx, Md, NULL) != 1) ||
+ (EVP_DigestUpdate (MdCtx, TimestampedData, DataSize) != 1) ||
+ (EVP_DigestFinal (MdCtx, HashedMsg, NULL) != 1)) {
+ goto _Exit;
+ }
if ((MdSize == (UINTN)ASN1_STRING_length (Imprint->HashedMessage)) &&
- (CompareMem (HashedMsg, ASN1_STRING_data (Imprint->HashedMessage), MdSize) != 0)) {
+ (CompareMem (HashedMsg, ASN1_STRING_get0_data (Imprint->HashedMessage), MdSize) != 0)) {
goto _Exit;
}
@@ -315,6 +322,7 @@ CheckTSTInfo (
_Exit:
X509_ALGOR_free (HashAlgo);
+ EVP_MD_CTX_free (MdCtx);
if (HashedMsg != NULL) {
FreePool (HashedMsg);
}