/** @file\r
Root include file to support building OpenSSL Crypto Library.\r
\r
-Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
char *tm_zone; /* timezone abbreviation */\r
};\r
\r
+struct timeval {\r
+ long tv_sec; /* time value, in seconds */\r
+ long tv_usec; /* time value, in microseconds */\r
+} timeval;\r
+\r
struct dirent {\r
UINT32 d_fileno; /* file number of entry */\r
UINT16 d_reclen; /* length of this record */\r
#define assert(expression)\r
#define localtime(timer) NULL\r
#define gmtime_r(timer,result) (result = NULL)\r
+#define atoi(nptr) AsciiStrDecimalToUintn(nptr)\r
\r
#endif\r
--- /dev/null
+/** @file\r
+ Include file to support building OpenSSL Crypto Library.\r
+\r
+Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include <OpenSslSupport.h>\r
+\r
AuthenticodeVerify() will get PE/COFF Authenticode and will do basic check for\r
data structure.\r
\r
-Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
{\r
BOOLEAN Status;\r
PKCS7 *Pkcs7;\r
+ CONST UINT8 *Temp;\r
CONST UINT8 *OrigAuthData;\r
UINT8 *SpcIndirectDataContent;\r
UINT8 Asn1Byte;\r
//\r
// Retrieve & Parse PKCS#7 Data (DER encoding) from Authenticode Signature\r
//\r
- Pkcs7 = d2i_PKCS7 (NULL, &AuthData, (int)DataSize);\r
+ Temp = AuthData;\r
+ Pkcs7 = d2i_PKCS7 (NULL, &Temp, (int)DataSize);\r
if (Pkcs7 == NULL) {\r
goto _Exit;\r
}\r
/** @file\r
PKCS#7 SignedData Sign Wrapper Implementation over OpenSSL.\r
\r
-Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
if (Key == NULL) {\r
goto _Exit;\r
}\r
- Key->save_type = EVP_PKEY_RSA;\r
- Key->type = EVP_PKEY_type (EVP_PKEY_RSA);\r
- Key->pkey.rsa = (RSA *) RsaContext;\r
+ if (EVP_PKEY_assign_RSA (Key, (RSA *) RsaContext) == 0) {\r
+ goto _Exit;\r
+ }\r
\r
//\r
// Convert the data to be signed to BIO format. \r
}\r
\r
CopyMem (*SignedData, P7Data + 19, *SignedDataSize);\r
- \r
+\r
OPENSSL_free (P7Data);\r
\r
Status = TRUE;\r
WrapPkcs7Data(), Pkcs7GetSigners(), Pkcs7Verify() will get UEFI Authenticated\r
Variable and will do basic check for data structure.\r
\r
-Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
goto _Exit;\r
}\r
\r
- Length = ((BUF_MEM *) CertBio->ptr)->length;\r
+ Length = (INT32)(((BUF_MEM *) CertBio->ptr)->length);\r
if (Length <= 0) {\r
goto _Exit;\r
}\r
PKCS7 *Pkcs7;\r
BOOLEAN Status;\r
UINT8 *SignedData;\r
- UINT8 *Temp;\r
+ CONST UINT8 *Temp;\r
UINTN SignedDataSize;\r
BOOLEAN Wrapped;\r
STACK_OF(X509) *Stack;\r
X509 *Cert;\r
X509_STORE *CertStore;\r
UINT8 *SignedData;\r
- UINT8 *Temp;\r
+ CONST UINT8 *Temp;\r
UINTN SignedDataSize;\r
BOOLEAN Wrapped;\r
\r
//\r
// Read DER-encoded root certificate and Construct X509 Certificate\r
//\r
- Cert = d2i_X509 (NULL, &TrustedCert, (long) CertLength);\r
+ Temp = TrustedCert;\r
+ Cert = d2i_X509 (NULL, &Temp, (long) CertLength);\r
if (Cert == NULL) {\r
goto _Exit;\r
}\r
the lifetime of the signature when a signing certificate expires or is later\r
revoked.\r
\r
-Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
CONST UINT8 *TokenTemp;\r
PKCS7 *Pkcs7;\r
X509 *Cert;\r
+ CONST UINT8 *CertTemp;\r
X509_STORE *CertStore;\r
BIO *OutBio;\r
UINT8 *TstData;\r
UINTN TstSize;\r
- UINT8 *TstTemp;\r
+ CONST UINT8 *TstTemp;\r
TS_TST_INFO *TstInfo;\r
\r
Status = FALSE;\r
//\r
// Read the trusted TSA certificate (DER-encoded), and Construct X509 Certificate.\r
//\r
- Cert = d2i_X509 (NULL, &TsaCert, (long) CertSize);\r
+ CertTemp = TsaCert;\r
+ Cert = d2i_X509 (NULL, &CertTemp, (long) CertSize);\r
if (Cert == NULL) {\r
goto _Exit;\r
}\r
{\r
BOOLEAN Status;\r
PKCS7 *Pkcs7;\r
+ CONST UINT8 *Temp;\r
STACK_OF(PKCS7_SIGNER_INFO) *SignerInfos;\r
PKCS7_SIGNER_INFO *SignInfo;\r
UINTN Index;\r
//\r
// Decode ASN.1-encoded Authenticode data into PKCS7 structure.\r
//\r
- Pkcs7 = d2i_PKCS7 (NULL, (const unsigned char **) &AuthData, (int) DataSize);\r
+ Temp = AuthData;\r
+ Pkcs7 = d2i_PKCS7 (NULL, (const unsigned char **) &Temp, (int) DataSize);\r
if (Pkcs7 == NULL) {\r
goto _Exit;\r
}\r
/** @file\r
X.509 Certificate Handler Wrapper Implementation over OpenSSL.\r
\r
-Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
OUT UINT8 **SingleX509Cert\r
)\r
{\r
- X509 *X509Cert;\r
+ X509 *X509Cert;\r
+ CONST UINT8 *Temp;\r
\r
//\r
// Check input parameters.\r
//\r
// Read DER-encoded X509 Certificate and Construct X509 object.\r
//\r
- X509Cert = d2i_X509 (NULL, &Cert, (long) CertSize);\r
+ Temp = Cert;\r
+ X509Cert = d2i_X509 (NULL, &Temp, (long) CertSize);\r
if (X509Cert == NULL) {\r
return FALSE;\r
}\r
}\r
\r
CertSize = VA_ARG (Args, UINTN);\r
+ if (CertSize == 0) {\r
+ break;\r
+ }\r
\r
//\r
// Construct X509 Object from the given DER-encoded certificate data.\r
(UINT8 **) &X509Cert\r
);\r
if (!Status) {\r
- X509_free (X509Cert);\r
+ if (X509Cert != NULL) {\r
+ X509_free (X509Cert);\r
+ }\r
break;\r
}\r
\r
//\r
// Check input parameters.\r
//\r
- if ((Cert == NULL) || (TBSCert == NULL) || (TBSCertSize == NULL)) {\r
+ if ((Cert == NULL) || (TBSCert == NULL) ||\r
+ (TBSCertSize == NULL) || (CertSize > INT_MAX)) {\r
return FALSE;\r
}\r
\r