mirror of https://github.com/acidanthera/audk.git
Add new interfaces to support PKCS7#7 signed data and authenticode signature. Update Cryptest to validate functionality of new interfaces.
Signed-off-by: tye1 Reviewed-by: hhuan13 Reviewed-by: qlong git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12142 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
2f3f1a64ed
commit
b7d320f811
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Sample Implementation for Microsoft Authenticode Verification.
|
||||
|
||||
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 2011, 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
|
||||
|
@ -15,50 +15,28 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
#include "Cryptest.h"
|
||||
|
||||
//
|
||||
// DER encoding of SpcIndirectDataContent (Authenticode-specific Structure)
|
||||
// Last 20 bytes data should be the SHA-1 digest value of PE/COFF image
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED UINT8 SpcIndirectDataContentwithSha1[] = {
|
||||
0x30, 0x33, 0x06, 0x0A, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x0F, 0x30, 0x25,
|
||||
0x03, 0x01, 0x00, 0xA0, 0x20, 0xA2, 0x1E, 0x80, 0x1C, 0x00, 0x3C, 0x00, 0x3C, 0x00, 0x3C, 0x00,
|
||||
0x4F, 0x00, 0x62, 0x00, 0x73, 0x00, 0x6F, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x74, 0x00, 0x65, 0x00,
|
||||
0x3E, 0x00, 0x3E, 0x00, 0x3E, 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1A,
|
||||
0x05, 0x00, 0x04, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
//
|
||||
// DER encoding of SpcIndirectDataContent (Authenticode-specific Structure)
|
||||
// Last 16 bytes data should be the MD5 digest value of PE/COFF image
|
||||
// NOTE: Authenticode also support MD5 digest. Disable MD5 support here since MD5
|
||||
// has been marked as "Deprecated, do not use".
|
||||
//
|
||||
#if 0
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED UINT8 SpcIndirectDataContentwithMd5[] = {
|
||||
0x30, 0x33, 0x06, 0x0A, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x0F, 0x30, 0x25,
|
||||
0x03, 0x01, 0x00, 0xA0, 0x20, 0xA2, 0x1E, 0x80, 0x1C, 0x00, 0x3C, 0x00, 0x3C, 0x00, 0x3C, 0x00,
|
||||
0x4F, 0x00, 0x62, 0x00, 0x73, 0x00, 0x6F, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x74, 0x00, 0x65, 0x00,
|
||||
0x3E, 0x00, 0x3E, 0x00, 0x3E, 0x30, 0x20, 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x86, 0x48, 0x86, 0xF7,
|
||||
0x0D, 0x02, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
#endif
|
||||
|
||||
//
|
||||
// Sample PE/COFF Image Hash Value.
|
||||
// Sample PE/COFF Image Hash Value (Digested by SHA-1).
|
||||
// This value should be calculated following MSFT's Authenticode Specification
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED UINT8 PeHash[] = {
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED UINT8 PeSha1Hash[] = {
|
||||
0x44, 0xFD, 0x4F, 0xA9, 0x17, 0xEE, 0xAC, 0xCF, 0x1F, 0x0B, 0xE3, 0xA1, 0x4D, 0x5B, 0xA6, 0x61,
|
||||
0x82, 0x97, 0xC4, 0xB6
|
||||
};
|
||||
|
||||
//
|
||||
// Sample Authenticode Data (from MSFT Win7 BootLoader: bootmgfw.efi)
|
||||
// This data should be retrieved from signed PE/COFF image according to SECURITY
|
||||
// directory in PE/COFF Header
|
||||
// Sample PE/COFF Image Hash Value (Digested by SHA-256).
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED UINT8 Authenticode[] = {
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED UINT8 PeSha256Hash[] = {
|
||||
0x61, 0x82, 0xB7, 0xF8, 0x8C, 0xFF, 0xC2, 0xEB, 0x79, 0x6E, 0x9D, 0xA9, 0xDD, 0x39, 0x52, 0xDD,
|
||||
0x36, 0xDD, 0xF1, 0x43, 0x27, 0x58, 0x8C, 0xA7, 0xCC, 0xAE, 0xDE, 0xDD, 0x3C, 0x02, 0x12, 0x49
|
||||
};
|
||||
|
||||
//
|
||||
// Sample Authenticode Data with SHA-1 hash algorithm.
|
||||
// This data should be retrieved from signed PE/COFF image according to SECURITY
|
||||
// directory in PE/COFF Header.
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED UINT8 AuthenticodeWithSha1[] = {
|
||||
0x30, 0x82, 0x1C, 0x43, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x02, 0xA0,
|
||||
0x82, 0x1C, 0x34, 0x30, 0x82, 0x1C, 0x30, 0x02, 0x01, 0x01, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x05,
|
||||
0x2B, 0x0E, 0x03, 0x02, 0x1A, 0x05, 0x00, 0x30, 0x68, 0x06, 0x0A, 0x2B, 0x06, 0x01, 0x04, 0x01,
|
||||
|
@ -515,11 +493,257 @@ GLOBAL_REMOVE_IF_UNREFERENCED UINT8 Authenticode[] = {
|
|||
};
|
||||
|
||||
//
|
||||
// Sample MSFT's root certificate for code signing.
|
||||
// Sample Authenticode Data with SHA-256 hash algorithm.
|
||||
// This data should be retrieved from signed PE/COFF image according to SECURITY
|
||||
// directory in PE/COFF Header.
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED UINT8 AuthenticodeWithSha256[] = {
|
||||
0x30, 0x82, 0x0e, 0xd1, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x02, 0xa0,
|
||||
0x82, 0x0e, 0xc2, 0x30, 0x82, 0x0e, 0xbe, 0x02, 0x01, 0x01, 0x31, 0x0f, 0x30, 0x0d, 0x06, 0x09,
|
||||
0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x5c, 0x06, 0x0a, 0x2b,
|
||||
0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x04, 0xa0, 0x4e, 0x30, 0x4c, 0x30, 0x17, 0x06,
|
||||
0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x0f, 0x30, 0x09, 0x03, 0x01, 0x00,
|
||||
0xa0, 0x04, 0xa2, 0x02, 0x80, 0x00, 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01,
|
||||
0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20, 0x61, 0x82, 0xb7, 0xf8, 0x8c, 0xff, 0xc2,
|
||||
0xeb, 0x79, 0x6e, 0x9d, 0xa9, 0xdd, 0x39, 0x52, 0xdd, 0x36, 0xdd, 0xf1, 0x43, 0x27, 0x58, 0x8c,
|
||||
0xa7, 0xcc, 0xae, 0xde, 0xdd, 0x3c, 0x02, 0x12, 0x49, 0xa0, 0x82, 0x0c, 0x0a, 0x30, 0x82, 0x05,
|
||||
0xe5, 0x30, 0x82, 0x03, 0xcd, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x0a, 0x61, 0x03, 0x5f, 0x09,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
|
||||
0x01, 0x01, 0x0b, 0x05, 0x00, 0x30, 0x81, 0x90, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
|
||||
0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a,
|
||||
0x57, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x74, 0x6f, 0x6e, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03,
|
||||
0x55, 0x04, 0x07, 0x13, 0x07, 0x52, 0x65, 0x64, 0x6d, 0x6f, 0x6e, 0x64, 0x31, 0x1e, 0x30, 0x1c,
|
||||
0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x15, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74,
|
||||
0x20, 0x43, 0x6f, 0x72, 0x70, 0x6f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x31, 0x3a, 0x30, 0x38,
|
||||
0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x31, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74,
|
||||
0x20, 0x54, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x20, 0x43, 0x65,
|
||||
0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72,
|
||||
0x69, 0x74, 0x79, 0x20, 0x32, 0x30, 0x31, 0x30, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x30, 0x30, 0x36,
|
||||
0x32, 0x31, 0x32, 0x32, 0x35, 0x35, 0x30, 0x31, 0x5a, 0x17, 0x0d, 0x31, 0x34, 0x30, 0x36, 0x32,
|
||||
0x31, 0x32, 0x33, 0x30, 0x35, 0x30, 0x31, 0x5a, 0x30, 0x81, 0x81, 0x31, 0x13, 0x30, 0x11, 0x06,
|
||||
0x0a, 0x09, 0x92, 0x26, 0x89, 0x93, 0xf2, 0x2c, 0x64, 0x01, 0x19, 0x16, 0x03, 0x63, 0x6f, 0x6d,
|
||||
0x31, 0x19, 0x30, 0x17, 0x06, 0x0a, 0x09, 0x92, 0x26, 0x89, 0x93, 0xf2, 0x2c, 0x64, 0x01, 0x19,
|
||||
0x16, 0x09, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x31, 0x14, 0x30, 0x12, 0x06,
|
||||
0x0a, 0x09, 0x92, 0x26, 0x89, 0x93, 0xf2, 0x2c, 0x64, 0x01, 0x19, 0x16, 0x04, 0x63, 0x6f, 0x72,
|
||||
0x70, 0x31, 0x17, 0x30, 0x15, 0x06, 0x0a, 0x09, 0x92, 0x26, 0x89, 0x93, 0xf2, 0x2c, 0x64, 0x01,
|
||||
0x19, 0x16, 0x07, 0x72, 0x65, 0x64, 0x6d, 0x6f, 0x6e, 0x64, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x03,
|
||||
0x55, 0x04, 0x03, 0x13, 0x17, 0x4d, 0x53, 0x49, 0x54, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x43,
|
||||
0x6f, 0x64, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x20, 0x43, 0x41, 0x20, 0x33, 0x30, 0x82, 0x01, 0x22,
|
||||
0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03,
|
||||
0x82, 0x01, 0x0f, 0x00, 0x30, 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, 0xc4, 0xf2, 0xb9, 0xef, 0x92, 0x4a, 0x9f, 0xc8, 0x4c, 0x93, 0xe7, 0x19, 0xa8, 0x4e,
|
||||
0xbc, 0xe3, 0x62, 0xf4, 0xe0, 0x6e, 0xec, 0x45, 0x6e, 0x61, 0x4e, 0xad, 0x58, 0xe0, 0xf0, 0xea,
|
||||
0xf7, 0x74, 0x2c, 0xdf, 0x1b, 0xf6, 0x43, 0x3c, 0x84, 0xc2, 0x8c, 0x0b, 0xb4, 0xbd, 0x4a, 0x57,
|
||||
0xa6, 0x0c, 0x4e, 0x9e, 0x73, 0x43, 0x5f, 0x2d, 0xaf, 0x22, 0xf4, 0xa6, 0xfd, 0x5a, 0x87, 0xb9,
|
||||
0xbe, 0x6f, 0x9e, 0x1d, 0x99, 0xc8, 0xdf, 0x95, 0xc2, 0x02, 0xad, 0x7d, 0x4a, 0xf3, 0xba, 0x5d,
|
||||
0xe8, 0x7b, 0x6e, 0x57, 0xe5, 0x3a, 0x02, 0xf8, 0xd3, 0x01, 0x15, 0xae, 0x4f, 0x02, 0x03, 0x01,
|
||||
0x00, 0x01, 0xa3, 0x82, 0x01, 0x4c, 0x30, 0x82, 0x01, 0x48, 0x30, 0x10, 0x06, 0x09, 0x2b, 0x06,
|
||||
0x01, 0x04, 0x01, 0x82, 0x37, 0x15, 0x01, 0x04, 0x03, 0x02, 0x01, 0x00, 0x30, 0x1d, 0x06, 0x03,
|
||||
0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x4e, 0xfe, 0x61, 0x39, 0x6f, 0xca, 0xc5, 0x64, 0xe0,
|
||||
0x20, 0xb6, 0xda, 0xc1, 0xb9, 0x52, 0x0e, 0xca, 0xdf, 0x8e, 0xfe, 0x30, 0x19, 0x06, 0x09, 0x2b,
|
||||
0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x14, 0x02, 0x04, 0x0c, 0x1e, 0x0a, 0x00, 0x53, 0x00, 0x75,
|
||||
0x00, 0x62, 0x00, 0x43, 0x00, 0x41, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x04, 0x04, 0x03,
|
||||
0x02, 0x01, 0x86, 0x30, 0x12, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x08, 0x30,
|
||||
0x06, 0x01, 0x01, 0xff, 0x02, 0x01, 0x00, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18,
|
||||
0x30, 0x16, 0x80, 0x14, 0xa3, 0x01, 0x04, 0x7e, 0x30, 0x88, 0x33, 0xeb, 0xb9, 0x31, 0x9c, 0xca,
|
||||
0xeb, 0x85, 0x76, 0x67, 0xfc, 0x65, 0xb4, 0xd1, 0x30, 0x59, 0x06, 0x03, 0x55, 0x1d, 0x1f, 0x04,
|
||||
0x52, 0x30, 0x50, 0x30, 0x4e, 0xa0, 0x4c, 0xa0, 0x4a, 0x86, 0x48, 0x68, 0x74, 0x74, 0x70, 0x3a,
|
||||
0x2f, 0x2f, 0x63, 0x72, 0x6c, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x2e,
|
||||
0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6b, 0x69, 0x2f, 0x63, 0x72, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x64,
|
||||
0x75, 0x63, 0x74, 0x73, 0x2f, 0x4d, 0x69, 0x63, 0x54, 0x65, 0x73, 0x52, 0x6f, 0x6f, 0x43, 0x65,
|
||||
0x72, 0x41, 0x75, 0x74, 0x5f, 0x32, 0x30, 0x31, 0x30, 0x2d, 0x30, 0x36, 0x2d, 0x31, 0x37, 0x2e,
|
||||
0x63, 0x72, 0x6c, 0x30, 0x5d, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x01, 0x01, 0x04,
|
||||
0x51, 0x30, 0x4f, 0x30, 0x4d, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x30, 0x02, 0x86,
|
||||
0x41, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x6d, 0x69, 0x63, 0x72,
|
||||
0x6f, 0x73, 0x6f, 0x66, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6b, 0x69, 0x2f, 0x63, 0x65,
|
||||
0x72, 0x74, 0x73, 0x2f, 0x4d, 0x69, 0x63, 0x54, 0x65, 0x73, 0x52, 0x6f, 0x6f, 0x43, 0x65, 0x72,
|
||||
0x41, 0x75, 0x74, 0x5f, 0x32, 0x30, 0x31, 0x30, 0x2d, 0x30, 0x36, 0x2d, 0x31, 0x37, 0x2e, 0x63,
|
||||
0x72, 0x74, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05,
|
||||
0x00, 0x03, 0x82, 0x02, 0x01, 0x00, 0x91, 0x2d, 0x11, 0x36, 0xd1, 0x2c, 0x5e, 0x21, 0x77, 0x62,
|
||||
0x1a, 0xa1, 0xcf, 0x9a, 0x7e, 0x62, 0x2d, 0xc9, 0x90, 0xb9, 0x0e, 0x3d, 0x71, 0x0d, 0xa0, 0x4a,
|
||||
0x48, 0xad, 0xe1, 0xd6, 0xb0, 0x73, 0x4a, 0x51, 0x4b, 0x4c, 0xb2, 0x6b, 0x88, 0x0a, 0x5a, 0xb7,
|
||||
0xe9, 0x55, 0x67, 0x43, 0x8b, 0xf1, 0x9d, 0xcc, 0x52, 0x03, 0xaf, 0xac, 0x85, 0xe9, 0xd3, 0x75,
|
||||
0xce, 0xe5, 0x6f, 0x8b, 0x3c, 0x80, 0x81, 0xab, 0xd1, 0xd1, 0x73, 0x0d, 0x6b, 0xb0, 0x51, 0xb8,
|
||||
0xa2, 0x5e, 0x0c, 0x09, 0xe5, 0xa6, 0xbc, 0x54, 0x49, 0xe5, 0x54, 0x38,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xa0, 0x7f, 0x7b, 0xe2, 0x25, 0x21, 0xab, 0x95,
|
||||
0x50, 0x1e, 0x9f, 0xea, 0x77, 0x56, 0x47, 0x74, 0x73, 0xf2, 0x25, 0x1b, 0x0e, 0x36, 0xb9, 0xa2,
|
||||
0x57, 0xbf, 0x2c, 0x57, 0xbc, 0xe4, 0xfb, 0x88, 0xb1, 0x83, 0x56, 0xd8, 0x3c, 0xe0, 0x7c, 0xfd,
|
||||
0x11, 0x9f, 0xde, 0xe1, 0xb7, 0xd4, 0xc6, 0x23, 0xaf, 0xae, 0xc7, 0x5e, 0x4f, 0xc5, 0x23, 0x74,
|
||||
0x98, 0x38, 0x74, 0x9d, 0x0d, 0x0d, 0x6d, 0xf4, 0xde, 0x28, 0x44, 0x41, 0xd8, 0x22, 0x68, 0xe7,
|
||||
0x57, 0xa7, 0x66, 0x74, 0xb5, 0xc3, 0x31, 0x24, 0xe2, 0x7c, 0xd5, 0x52, 0x5d, 0x8a, 0xd2, 0x4e,
|
||||
0x14, 0xbb, 0x08, 0xd3, 0x1a, 0x31, 0x12, 0x04, 0x58, 0x9b, 0x3a, 0x99, 0x78, 0x93, 0x51, 0x3f,
|
||||
0x0b, 0x85, 0xce, 0xde, 0x09, 0x58, 0xf9, 0x96, 0x1b, 0x91, 0x11, 0xa0, 0x68, 0x53, 0x33, 0xcb,
|
||||
0xbe, 0x08, 0x89, 0xcc, 0x95, 0x55, 0xae, 0x06, 0x78, 0x27, 0x99, 0xa2, 0x56, 0xef, 0xae, 0x95,
|
||||
0x0a, 0x7f, 0x0d, 0xeb, 0x43, 0x0c, 0xc6, 0x9e, 0x3f, 0x80, 0xbb, 0xc4, 0x74, 0x03, 0x9d, 0xb8,
|
||||
0x1a, 0xaa, 0xbc, 0xcb, 0x1e, 0x03, 0xfb, 0xd8, 0x49, 0x89, 0x9d, 0x20, 0xaa, 0x25, 0x4b, 0x47,
|
||||
0x67, 0xf4, 0xa7, 0x0d, 0x8d, 0x76, 0x30, 0xc6, 0x48, 0xce, 0xdd, 0x8d, 0xfa, 0xbe, 0xda, 0xb4,
|
||||
0xeb, 0x3d, 0xd8, 0x0c, 0x3b, 0x15, 0x9a, 0xd1, 0x83, 0x85, 0xe5, 0xe3, 0x92, 0xaa, 0x3b, 0xad,
|
||||
0x34, 0x0c, 0x39, 0xf1, 0x7f, 0x75, 0xae, 0xe8, 0x70, 0xb0, 0xfd, 0xf2, 0x8e, 0x29, 0xda, 0xdc,
|
||||
0x09, 0x4f, 0x8a, 0x7b, 0x63, 0xbe, 0x1e, 0x8a, 0xc3, 0x58, 0xd1, 0x03, 0xbe, 0x37, 0xe9, 0xed,
|
||||
0x32, 0x26, 0xa8, 0x0c, 0xfe, 0xed, 0x12, 0xa7, 0x63, 0x04, 0xb3, 0x92, 0x97, 0xd9, 0x46, 0xa3,
|
||||
0x33, 0x33, 0x9c, 0x5b, 0xbc, 0x54, 0x30, 0x82, 0x06, 0x1d, 0x30, 0x82, 0x05, 0x05, 0xa0, 0x03,
|
||||
0x02, 0x01, 0x02, 0x02, 0x0a, 0x4e, 0x30, 0xa5, 0xbb, 0x00, 0x00, 0x00, 0x12, 0x7b, 0xf2, 0x30,
|
||||
0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30, 0x81,
|
||||
0x81, 0x31, 0x13, 0x30, 0x11, 0x06, 0x0a, 0x09, 0x92, 0x26, 0x89, 0x93, 0xf2, 0x2c, 0x64, 0x01,
|
||||
0x19, 0x16, 0x03, 0x63, 0x6f, 0x6d, 0x31, 0x19, 0x30, 0x17, 0x06, 0x0a, 0x09, 0x92, 0x26, 0x89,
|
||||
0x93, 0xf2, 0x2c, 0x64, 0x01, 0x19, 0x16, 0x09, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66,
|
||||
0x74, 0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x09, 0x92, 0x26, 0x89, 0x93, 0xf2, 0x2c, 0x64, 0x01,
|
||||
0x19, 0x16, 0x04, 0x63, 0x6f, 0x72, 0x70, 0x31, 0x17, 0x30, 0x15, 0x06, 0x0a, 0x09, 0x92, 0x26,
|
||||
0x89, 0x93, 0xf2, 0x2c, 0x64, 0x01, 0x19, 0x16, 0x07, 0x72, 0x65, 0x64, 0x6d, 0x6f, 0x6e, 0x64,
|
||||
0x31, 0x20, 0x30, 0x1e, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x17, 0x4d, 0x53, 0x49, 0x54, 0x20,
|
||||
0x54, 0x65, 0x73, 0x74, 0x20, 0x43, 0x6f, 0x64, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x20, 0x43, 0x41,
|
||||
0x20, 0x33, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x31, 0x30, 0x34, 0x32, 0x31, 0x30, 0x33, 0x33, 0x33,
|
||||
0x34, 0x39, 0x5a, 0x17, 0x0d, 0x31, 0x33, 0x30, 0x34, 0x32, 0x30, 0x30, 0x33, 0x33, 0x33, 0x34,
|
||||
0x39, 0x5a, 0x30, 0x70, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55,
|
||||
0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x57, 0x61, 0x73, 0x68,
|
||||
0x69, 0x6e, 0x67, 0x74, 0x6f, 0x6e, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13,
|
||||
0x07, 0x52, 0x65, 0x64, 0x6d, 0x6f, 0x6e, 0x64, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04,
|
||||
0x0a, 0x13, 0x15, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x43, 0x6f, 0x72,
|
||||
0x70, 0x6f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x31, 0x1a, 0x30, 0x18, 0x06, 0x03, 0x55, 0x04,
|
||||
0x03, 0x13, 0x11, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x57, 0x69, 0x6e,
|
||||
0x64, 0x6f, 0x77, 0x73, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
|
||||
0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a,
|
||||
0x02, 0x82, 0x01, 0x01, 0x00, 0xca, 0x9f, 0xcb, 0x8c, 0x5e, 0x61, 0x19, 0xb5, 0x37, 0x72, 0xd1,
|
||||
0xe2, 0x88, 0x1f, 0x37, 0x56, 0xce, 0xa8, 0x88, 0x05, 0x3e, 0xe8, 0xa6, 0x8d, 0xfd, 0x0b, 0x30,
|
||||
0x63, 0x54, 0x89, 0x1d, 0xda, 0x11, 0x70, 0x5a, 0x06, 0x00, 0x86, 0xd7, 0x7f, 0xe6, 0x21, 0x70,
|
||||
0x41, 0x81, 0x26, 0x4b, 0x6e, 0xc7, 0x02, 0xe2, 0xbf, 0x61, 0x45, 0x04, 0x2f, 0x45, 0xbc, 0xd2,
|
||||
0x0d, 0xf6, 0xac, 0xda, 0x91, 0x6d, 0xc6, 0x60, 0xad, 0xb3, 0x0b, 0x32, 0xe5, 0x13, 0x95, 0x96,
|
||||
0x02, 0x4e, 0x10, 0xad, 0x2e, 0x6c, 0xb0, 0xc7, 0x65, 0x6d, 0xea, 0x89, 0x91, 0x67, 0x73, 0x5d,
|
||||
0x05, 0x12, 0x9f, 0x95, 0x74, 0x6a, 0x6d, 0xb0, 0x6a, 0xd8, 0x94, 0x9b, 0xb0, 0x70, 0x79, 0xb0,
|
||||
0x85, 0x42, 0xe7, 0xd7, 0x19, 0xc4, 0x33, 0xfd, 0xac, 0xbe, 0x2b, 0xd5, 0x7e, 0x5a, 0xa9, 0xc7,
|
||||
0xa7, 0x68, 0x53, 0xed, 0xaa, 0x51, 0x2a, 0x6b, 0xac, 0x5a, 0xd7, 0x6e, 0xcf, 0x68, 0x60, 0x90,
|
||||
0xc7, 0xda, 0xd1, 0xe7, 0xf2, 0x53, 0x4a, 0x01, 0xaf, 0xe8, 0xb1, 0x29, 0x91, 0xab, 0x4c, 0x58,
|
||||
0x64, 0xe6, 0xb6, 0xcc, 0xdc, 0x0f, 0x43, 0xf2, 0x87, 0x15, 0xf8, 0x73, 0x06, 0xb8, 0x1f, 0xaa,
|
||||
0xf2, 0x66, 0x49, 0x82, 0xca, 0xf0, 0xdd, 0x4c, 0x7c, 0xd5, 0xe7, 0x59, 0xb7, 0xc6, 0xd3, 0x81,
|
||||
0x29, 0x5c, 0xce, 0xe4, 0xfd, 0xf7, 0xeb, 0x58, 0x6b, 0x50, 0x79, 0x72, 0x83, 0x4d, 0x59, 0xec,
|
||||
0xd1, 0xd2, 0xfc, 0x3a, 0x10, 0xc5, 0x7a, 0xba, 0x90, 0xea, 0xfd, 0x54, 0xc7, 0xc8, 0x58, 0x2d,
|
||||
0x84, 0xe5, 0x5b, 0x51, 0x98, 0x2c, 0x36, 0x7c, 0x42, 0x2b, 0xb1, 0x62, 0x4b, 0x0f, 0xf9, 0x72,
|
||||
0xd3, 0x3f, 0x99, 0xc8, 0xb4, 0x02, 0x17, 0x39, 0xe5, 0x0b, 0xf2, 0x5d, 0x2d, 0x7f, 0x23, 0x41,
|
||||
0xcd, 0x58, 0x3a, 0x25, 0x75, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x82, 0x02, 0xa5, 0x30, 0x82,
|
||||
0x02, 0xa1, 0x30, 0x3d, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x15, 0x07, 0x04,
|
||||
0x30, 0x30, 0x2e, 0x06, 0x26, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x15, 0x08, 0x83, 0xcf,
|
||||
0x89, 0x4d, 0xad, 0xf2, 0x02, 0x85, 0xa1, 0x9f, 0x0c, 0x82, 0xfa, 0xca, 0x7d, 0x81, 0xe1, 0xfb,
|
||||
0x74, 0x81, 0x4f, 0x84, 0x9a, 0xf1, 0x69, 0x85, 0xa1, 0xad, 0x1d, 0x02, 0x01, 0x64, 0x02, 0x01,
|
||||
0x0d, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x04, 0x04, 0x03, 0x02, 0x07, 0x80, 0x30, 0x29,
|
||||
0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x15, 0x0a, 0x04, 0x1c, 0x30, 0x1a, 0x30,
|
||||
0x0c, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x0a, 0x03, 0x06, 0x30, 0x0a, 0x06,
|
||||
0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x03, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x25,
|
||||
0x04, 0x18, 0x30, 0x16, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x0a, 0x03, 0x06,
|
||||
0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x03, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d,
|
||||
0x0e, 0x04, 0x16, 0x04, 0x14, 0xc9, 0x5a, 0xb3, 0x11, 0x02, 0x66, 0x71, 0x8c, 0x5b, 0x06, 0x80,
|
||||
0x8a, 0x6d, 0x4f, 0x5b, 0xf2, 0xb5, 0x67, 0x45, 0xb5, 0x30, 0x30, 0x06, 0x03, 0x55, 0x1d, 0x11,
|
||||
0x04, 0x29, 0x30, 0x27, 0xa0, 0x25, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x14,
|
||||
0x02, 0x03, 0xa0, 0x17, 0x0c, 0x15, 0x77, 0x69, 0x6e, 0x63, 0x62, 0x6c, 0x64, 0x40, 0x6d, 0x69,
|
||||
0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x1f, 0x06, 0x03, 0x55,
|
||||
0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x4e, 0xfe, 0x61, 0x39, 0x6f, 0xca, 0xc5, 0x64,
|
||||
0xe0, 0x20, 0xb6, 0xda, 0xc1, 0xb9, 0x52, 0x0e, 0xca, 0xdf, 0x8e, 0xfe, 0x30, 0x81, 0xe8, 0x06,
|
||||
0x03, 0x55, 0x1d, 0x1f, 0x04, 0x81, 0xe0, 0x30, 0x81, 0xdd, 0x30, 0x81, 0xda, 0xa0, 0x81, 0xd7,
|
||||
0xa0, 0x81, 0xd4, 0x86, 0x36, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x63, 0x6f, 0x72, 0x70,
|
||||
0x70, 0x6b, 0x69, 0x2f, 0x63, 0x72, 0x6c, 0x2f, 0x4d, 0x53, 0x49, 0x54, 0x25, 0x32, 0x30, 0x54,
|
||||
0x65, 0x73, 0x74, 0x25, 0x32, 0x30, 0x43, 0x6f, 0x64, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x25, 0x32,
|
||||
0x30, 0x43, 0x41, 0x25, 0x32, 0x30, 0x33, 0x2e, 0x63, 0x72, 0x6c, 0x86, 0x4d, 0x68, 0x74, 0x74,
|
||||
0x70, 0x3a, 0x2f, 0x2f, 0x6d, 0x73, 0x63, 0x72, 0x6c, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73,
|
||||
0x6f, 0x66, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6b, 0x69, 0x2f, 0x6d, 0x73, 0x63, 0x6f,
|
||||
0x72, 0x70, 0x2f, 0x63, 0x72, 0x6c, 0x2f, 0x4d, 0x53, 0x49, 0x54, 0x25, 0x32, 0x30, 0x54, 0x65,
|
||||
0x73, 0x74, 0x25, 0x32, 0x30, 0x43, 0x6f, 0x64, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x25, 0x32, 0x30,
|
||||
0x43, 0x41, 0x25, 0x32, 0x30, 0x33, 0x2e, 0x63, 0x72, 0x6c, 0x86, 0x4b, 0x68, 0x74, 0x74, 0x70,
|
||||
0x3a, 0x2f, 0x2f, 0x63, 0x72, 0x6c, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74,
|
||||
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6b, 0x69, 0x2f, 0x6d, 0x73, 0x63, 0x6f, 0x72, 0x70, 0x2f,
|
||||
0x63, 0x72, 0x6c, 0x2f, 0x4d, 0x53, 0x49, 0x54, 0x25, 0x32, 0x30, 0x54, 0x65, 0x73, 0x74, 0x25,
|
||||
0x32, 0x30, 0x43, 0x6f, 0x64, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x25, 0x32, 0x30, 0x43, 0x41, 0x25,
|
||||
0x32, 0x30, 0x33, 0x2e, 0x63, 0x72, 0x6c, 0x30, 0x81, 0xa9, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05,
|
||||
0x05, 0x07, 0x01, 0x01, 0x04, 0x81, 0x9c, 0x30, 0x81, 0x99, 0x30, 0x42, 0x06, 0x08, 0x2b, 0x06,
|
||||
0x01, 0x05, 0x05, 0x07, 0x30, 0x02, 0x86, 0x36, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x63,
|
||||
0x6f, 0x72, 0x70, 0x70, 0x6b, 0x69, 0x2f, 0x61, 0x69, 0x61, 0x2f, 0x4d, 0x53, 0x49, 0x54, 0x25,
|
||||
0x32, 0x30, 0x54, 0x65, 0x73, 0x74, 0x25, 0x32, 0x30, 0x43, 0x6f, 0x64, 0x65, 0x53, 0x69, 0x67,
|
||||
0x6e, 0x25, 0x32, 0x30, 0x43, 0x41, 0x25, 0x32, 0x30, 0x33, 0x2e, 0x63, 0x72, 0x74, 0x30, 0x53,
|
||||
0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x30, 0x02, 0x86, 0x47, 0x68, 0x74, 0x74, 0x70,
|
||||
0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74,
|
||||
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6b, 0x69, 0x2f, 0x6d, 0x73, 0x63, 0x6f, 0x72, 0x70, 0x2f,
|
||||
0x4d, 0x53, 0x49, 0x54, 0x25, 0x32, 0x30, 0x54, 0x65, 0x73, 0x74, 0x25, 0x32, 0x30, 0x43, 0x6f,
|
||||
0x64, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x25, 0x32, 0x30, 0x43, 0x41, 0x25, 0x32, 0x30, 0x33, 0x2e,
|
||||
0x63, 0x72, 0x74, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b,
|
||||
0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x97, 0x6d, 0x52, 0x46, 0x65, 0x08, 0x60, 0x01, 0x12,
|
||||
0x7a, 0x26, 0xaa, 0xd9, 0xc3, 0x15, 0xec, 0xc6, 0xae, 0x0b, 0x75, 0xe4, 0xd5, 0xe0, 0x31, 0xf6,
|
||||
0xda, 0xc0, 0xb1, 0x1b, 0x7b, 0x8a, 0x07, 0xda, 0x2f, 0x82, 0x4a, 0x21, 0x89, 0xe6, 0x61, 0x97,
|
||||
0xe4, 0x3a, 0x38, 0xd8, 0x0a, 0x26, 0x4e, 0x83, 0x54, 0xbf, 0x32, 0xe3, 0x64, 0x36, 0x61, 0x40,
|
||||
0x75, 0x55, 0xf1, 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, 0xe4, 0x6a, 0x56, 0xd0, 0x9a, 0x98, 0xa2, 0xbf, 0x6f, 0x43, 0xf2, 0xb0, 0x5b, 0xfd, 0xd9,
|
||||
0xfa, 0x08, 0x17, 0xc8, 0x3c, 0x61, 0xf1, 0x31, 0x82, 0x02, 0x3a, 0x30, 0x82, 0x02, 0x36, 0x02,
|
||||
0x01, 0x01, 0x30, 0x81, 0x90, 0x30, 0x81, 0x81, 0x31, 0x13, 0x30, 0x11, 0x06, 0x0a, 0x09, 0x92,
|
||||
0x26, 0x89, 0x93, 0xf2, 0x2c, 0x64, 0x01, 0x19, 0x16, 0x03, 0x63, 0x6f, 0x6d, 0x31, 0x19, 0x30,
|
||||
0x17, 0x06, 0x0a, 0x09, 0x92, 0x26, 0x89, 0x93, 0xf2, 0x2c, 0x64, 0x01, 0x19, 0x16, 0x09, 0x6d,
|
||||
0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x09, 0x92,
|
||||
0x26, 0x89, 0x93, 0xf2, 0x2c, 0x64, 0x01, 0x19, 0x16, 0x04, 0x63, 0x6f, 0x72, 0x70, 0x31, 0x17,
|
||||
0x30, 0x15, 0x06, 0x0a, 0x09, 0x92, 0x26, 0x89, 0x93, 0xf2, 0x2c, 0x64, 0x01, 0x19, 0x16, 0x07,
|
||||
0x72, 0x65, 0x64, 0x6d, 0x6f, 0x6e, 0x64, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x03, 0x55, 0x04, 0x03,
|
||||
0x13, 0x17, 0x4d, 0x53, 0x49, 0x54, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x43, 0x6f, 0x64, 0x65,
|
||||
0x53, 0x69, 0x67, 0x6e, 0x20, 0x43, 0x41, 0x20, 0x33, 0x02, 0x0a, 0x4e, 0x30, 0xa5, 0xbb, 0x00,
|
||||
0x00, 0x00, 0x12, 0x7b, 0xf2, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04,
|
||||
0x02, 0x01, 0x05, 0x00, 0xa0, 0x7c, 0x30, 0x10, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82,
|
||||
0x37, 0x02, 0x01, 0x0c, 0x31, 0x02, 0x30, 0x00, 0x30, 0x19, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
|
||||
0xf7, 0x0d, 0x01, 0x09, 0x03, 0x31, 0x0c, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37,
|
||||
0x02, 0x01, 0x04, 0x30, 0x1c, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01,
|
||||
0x0b, 0x31, 0x0e, 0x30, 0x0c, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01,
|
||||
0x15, 0x30, 0x2f, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x04, 0x31, 0x22,
|
||||
0x04, 0x20, 0x25, 0x60, 0x6e, 0xc8, 0x66, 0x72, 0x73, 0xb0, 0x71, 0x7b, 0x82, 0x09, 0x8c, 0x27,
|
||||
0xe8, 0xb1, 0x4a, 0x36, 0x1c, 0x81, 0x36, 0xb4, 0x1b, 0x44, 0xdf, 0x09, 0x82, 0x8b, 0xf9, 0xb6,
|
||||
0x1c, 0x65, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05,
|
||||
0x00, 0x04, 0x82, 0x01, 0x00, 0x01, 0xb7, 0x8e, 0x46, 0x9b, 0xb4, 0x18, 0xcd, 0xf6, 0x39, 0x8f,
|
||||
0x82, 0x79, 0xbc, 0x96, 0x55, 0x7e, 0xd7, 0x84, 0x8f, 0x18, 0x37, 0x48, 0x4e, 0x8f, 0x25, 0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0x08, 0x4c,
|
||||
0xa6, 0x4a, 0xa2, 0x05, 0x42, 0xa7, 0x77, 0xbc, 0x44, 0x7b, 0xed, 0xdb, 0x77, 0x63, 0x4c, 0x63,
|
||||
0x22, 0xb6, 0x17, 0x3f, 0x4f, 0x33, 0xed, 0xa6, 0xd9, 0x0f, 0x74, 0xfa, 0x97, 0x8d, 0x98, 0x55,
|
||||
0x42, 0x14, 0x76, 0xd4, 0x89, 0x07, 0xf2, 0x30, 0x5a, 0x27, 0x96, 0x1b, 0x92, 0x70, 0x5a, 0x83,
|
||||
0x89, 0x0f, 0xdb, 0x47, 0x7a, 0x00, 0x00, 0x00, 0x0a
|
||||
};
|
||||
|
||||
//
|
||||
// Sample root certificate for code signing.
|
||||
// A trusted certificate with self-signing, will be used to construct the certificate chains for
|
||||
// authority checking.
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED UINT8 MsftRootCert[] = {
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED UINT8 TestRootCert1[] = {
|
||||
0x30, 0x82, 0x05, 0x99, 0x30, 0x82, 0x03, 0x81, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x79,
|
||||
0xAD, 0x16, 0xA1, 0x4A, 0xA0, 0xA5, 0xAD, 0x4C, 0x73, 0x58, 0xF4, 0x07, 0x13, 0x2E, 0x65, 0x30,
|
||||
0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x5F,
|
||||
|
@ -612,49 +836,194 @@ GLOBAL_REMOVE_IF_UNREFERENCED UINT8 MsftRootCert[] = {
|
|||
0x6B, 0x9D, 0x4A, 0xFD, 0xD1, 0xA1, 0x9D, 0x99, 0x43, 0x77, 0x3F, 0xB0, 0xDA
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED UINT8 TestRootCert2[] = {
|
||||
0x30, 0x82, 0x05, 0xfd, 0x30, 0x82, 0x03, 0xe5, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x74,
|
||||
0x45, 0xc8, 0x78, 0x4e, 0x0c, 0xc9, 0x96, 0x4a, 0xb4, 0x2f, 0xbc, 0xda, 0x29, 0xe1, 0xbc, 0x30,
|
||||
0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30, 0x81,
|
||||
0x90, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13,
|
||||
0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x57, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67,
|
||||
0x74, 0x6f, 0x6e, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x52, 0x65,
|
||||
0x64, 0x6d, 0x6f, 0x6e, 0x64, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x15,
|
||||
0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x43, 0x6f, 0x72, 0x70, 0x6f, 0x72,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x31, 0x3a, 0x30, 0x38, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x31,
|
||||
0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x54, 0x65, 0x73, 0x74, 0x69, 0x6e,
|
||||
0x67, 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61,
|
||||
0x74, 0x65, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x20, 0x32, 0x30, 0x31,
|
||||
0x30, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x30, 0x30, 0x36, 0x31, 0x37, 0x32, 0x30, 0x35, 0x38, 0x30,
|
||||
0x32, 0x5a, 0x17, 0x0d, 0x33, 0x35, 0x30, 0x36, 0x31, 0x37, 0x32, 0x31, 0x30, 0x34, 0x31, 0x31,
|
||||
0x5a, 0x30, 0x81, 0x90, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55,
|
||||
0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x57, 0x61, 0x73, 0x68,
|
||||
0x69, 0x6e, 0x67, 0x74, 0x6f, 0x6e, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13,
|
||||
0x07, 0x52, 0x65, 0x64, 0x6d, 0x6f, 0x6e, 0x64, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04,
|
||||
0x0a, 0x13, 0x15, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x43, 0x6f, 0x72,
|
||||
0x70, 0x6f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x31, 0x3a, 0x30, 0x38, 0x06, 0x03, 0x55, 0x04,
|
||||
0x03, 0x13, 0x31, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x54, 0x65, 0x73,
|
||||
0x74, 0x69, 0x6e, 0x67, 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66,
|
||||
0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x20,
|
||||
0x32, 0x30, 0x31, 0x30, 0x30, 0x82, 0x02, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
|
||||
0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x02, 0x0f, 0x00, 0x30, 0x82, 0x02, 0x0a,
|
||||
0x02, 0x82, 0x02, 0x01, 0x00, 0x95, 0xe3, 0xa8, 0xc1, 0xb9, 0x9c, 0x26, 0x54, 0xb0, 0x99, 0xef,
|
||||
0x26, 0x1f, 0xac, 0x1e, 0xc7, 0x30, 0x80, 0xbb, 0xf5, 0x3f, 0xf2, 0xe4, 0xbb, 0xf8, 0xfe, 0x06,
|
||||
0x6a, 0x0a, 0xa6, 0x88, 0xbc, 0xb4, 0x8c, 0x45, 0xe0, 0x70, 0x55, 0x19, 0x88, 0xb4, 0x05, 0xcb,
|
||||
0xb5, 0xc1, 0xa1, 0xfa, 0xd4, 0x7c, 0xc2, 0x42, 0x53, 0x07, 0x9c, 0x54, 0x56, 0xa8, 0x97, 0xe0,
|
||||
0x94, 0x69, 0xbe, 0x13, 0x24, 0xef, 0xe5, 0x8a, 0x29, 0x9c, 0xa6, 0xd0, 0x2b, 0x2f, 0x8a, 0xa6,
|
||||
0xe8, 0x79, 0x44, 0x2e, 0x8b, 0xea, 0xc9, 0xbe, 0xb8, 0x54, 0x86, 0x53, 0xbe, 0x07, 0x24, 0x34,
|
||||
0x54, 0x15, 0x22, 0x20, 0x01, 0x7b, 0x8a, 0x46, 0xfb, 0xd2, 0x91, 0x07, 0x95, 0x09, 0xb0, 0x56,
|
||||
0x11, 0xcc, 0x76, 0xb2, 0xd0, 0x1f, 0x44, 0x79, 0x52, 0x34, 0x28, 0xec, 0x4f, 0x49, 0xc2, 0xcb,
|
||||
0x61, 0xd3, 0x86, 0xdc, 0xe4, 0xa3, 0x7e, 0x55, 0x9e, 0x9f, 0xee, 0x10, 0x6f, 0xcf, 0xe1, 0x3d,
|
||||
0xf8, 0xb7, 0x84, 0x79, 0xa2, 0x3b, 0x8d, 0x1c, 0xb0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, 0x3a, 0x63, 0x6e, 0x1a, 0x3e, 0x0a, 0x0c, 0x25, 0xb8, 0x7e,
|
||||
0xb5, 0x52, 0x0c, 0xb9, 0xab, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x51, 0x30, 0x4f, 0x30, 0x0b,
|
||||
0x06, 0x03, 0x55, 0x1d, 0x0f, 0x04, 0x04, 0x03, 0x02, 0x01, 0x86, 0x30, 0x0f, 0x06, 0x03, 0x55,
|
||||
0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x1d, 0x06, 0x03,
|
||||
0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0xa3, 0x01, 0x04, 0x7e, 0x30, 0x88, 0x33, 0xeb, 0xb9,
|
||||
0x31, 0x9c, 0xca, 0xeb, 0x85, 0x76, 0x67, 0xfc, 0x65, 0xb4, 0xd1, 0x30, 0x10, 0x06, 0x09, 0x2b,
|
||||
0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x15, 0x01, 0x04, 0x03, 0x02, 0x01, 0x00, 0x30, 0x0d, 0x06,
|
||||
0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x03, 0x82, 0x02, 0x01,
|
||||
0x00, 0x49, 0x8b, 0xc1, 0xfc, 0x4f, 0xe8, 0xe4, 0x2d, 0x67, 0x92, 0x9a, 0x76, 0x05, 0xba, 0xd1,
|
||||
0xbc, 0x98, 0xe4, 0x2b, 0xba, 0x1f, 0x66, 0x5f, 0x66, 0x23, 0xcf, 0x1c, 0x27, 0xeb, 0xb4, 0xaa,
|
||||
0xdd, 0xa0, 0x17, 0x20, 0x55, 0x72, 0x33, 0xb1, 0x76, 0xde, 0xc9, 0x6d, 0x0d, 0x3c, 0x2d, 0x0a,
|
||||
0x08, 0x24, 0x2d, 0xec, 0x38, 0x96, 0x7a, 0x83, 0xf1, 0x27, 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0xcf, 0x4f, 0xe7, 0xd2, 0x64, 0x40, 0x1d, 0xc4, 0x30, 0xba, 0xd5,
|
||||
0x08, 0x88, 0x67, 0x4b, 0x0f, 0xb8, 0xe5, 0x59, 0xe9, 0x18, 0xd8, 0x0c, 0x60, 0x68, 0xae, 0x7f,
|
||||
0xea, 0x91, 0x55, 0xbe, 0xeb, 0xf1, 0xa7, 0x8e, 0xd8, 0x5d, 0x50, 0x3e, 0xbf, 0xd5, 0x69, 0x57,
|
||||
0x95, 0x8f, 0xa7, 0xff, 0xe4, 0x09, 0x3f, 0x08, 0x80, 0x97, 0x32, 0x42, 0xb8, 0x82, 0x43, 0x82,
|
||||
0x6f, 0x8b, 0x0b, 0x93, 0xda, 0x19, 0xbf, 0x63, 0x4e, 0x5f, 0x9f, 0xed, 0x2c, 0x22, 0xb6, 0x20,
|
||||
0x5f, 0x70, 0x44, 0xfa, 0x89, 0x59, 0x93, 0xb0, 0x7b, 0x12, 0x0f, 0x5e, 0x62, 0x62, 0x51, 0x11,
|
||||
0xbd, 0xba, 0x5a, 0xd0, 0xce, 0xa1, 0xb6, 0xef, 0x80, 0x20, 0xe6, 0x73, 0x4b, 0x11, 0x06, 0x56,
|
||||
0xe2, 0x0a
|
||||
};
|
||||
|
||||
//
|
||||
// OID ASN.1 Value for Hash Algorithms
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED UINT8 HashOidValue[] = {
|
||||
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x02, 0x05, // OBJ_md5
|
||||
0x2B, 0x0E, 0x03, 0x02, 0x1A, // OBJ_sha1
|
||||
0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x04, // OBJ_sha224
|
||||
0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, // OBJ_sha256
|
||||
0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, // OBJ_sha384
|
||||
0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, // OBJ_sha512
|
||||
};
|
||||
|
||||
/**
|
||||
Validate MSFT Authenticode using PKCS#7 Verification Interfaces.
|
||||
Validate MSFT Authenticode Signature.
|
||||
|
||||
@return EFI_SUCCESS Validation succeeds.
|
||||
@retval TRUE Validation succeeded.
|
||||
@retval FALSE Validation failed.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
AuthenticodeVerify (
|
||||
VerifyAuthenticode (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
UINT8 *SpcIndirectDataContent;
|
||||
UINTN Size;
|
||||
BOOLEAN Status;
|
||||
|
||||
//
|
||||
// Construct SpcIndirectDataContent with the SHA-1 digest calculated from PE/COFF image
|
||||
//
|
||||
Size = sizeof (SpcIndirectDataContentwithSha1);
|
||||
SpcIndirectDataContent = (UINT8 *)AllocatePool (Size);
|
||||
CopyMem (SpcIndirectDataContent, SpcIndirectDataContentwithSha1, Size);
|
||||
CopyMem (SpcIndirectDataContent + Size - SHA1_DIGEST_SIZE, PeHash, SHA1_DIGEST_SIZE);
|
||||
Status = FALSE;
|
||||
Print (L"\n- PE/COFF Authenticode (Digested by SHA-1) Verification ... ");
|
||||
|
||||
//
|
||||
// Verify Authenticode struct. SpcIndirectDataContent will be regarded as opaque data for
|
||||
// PKCS#7 signed data verification.
|
||||
// Sample Code: Demonstrate how to check the Hash algorithm in PE/COFF Authenticode.
|
||||
// According to PKCS#7 Definition:
|
||||
// SignedData ::= SEQUENCE {
|
||||
// version Version,
|
||||
// digestAlgorithms DigestAlgorithmIdentifiers,
|
||||
// contentInfo ContentInfo,
|
||||
// .... }
|
||||
// The DigestAlgorithmIdentifiers can be used to determine the hash algorithm in PE/COFF hashing
|
||||
// This field has the fixed offset (+32) in final Authenticode ASN.1 data.
|
||||
//
|
||||
Status = Pkcs7Verify (
|
||||
Authenticode,
|
||||
sizeof (Authenticode),
|
||||
MsftRootCert,
|
||||
sizeof (MsftRootCert),
|
||||
SpcIndirectDataContent,
|
||||
Size
|
||||
if (CompareMem (AuthenticodeWithSha1 + 32, &HashOidValue[8], 5) == 0) {
|
||||
//
|
||||
// Verify Authenticode signature.
|
||||
// The PeHash value should be calculated following MSFT's Authenticode Specification.
|
||||
//
|
||||
Status = AuthenticodeVerify (
|
||||
AuthenticodeWithSha1,
|
||||
sizeof (AuthenticodeWithSha1),
|
||||
TestRootCert1,
|
||||
sizeof (TestRootCert1),
|
||||
PeSha1Hash,
|
||||
SHA1_DIGEST_SIZE
|
||||
);
|
||||
FreePool (SpcIndirectDataContent);
|
||||
if (Status) {
|
||||
Print (L"[Pass]");
|
||||
} else {
|
||||
Print (L"[Fail]");
|
||||
}
|
||||
} else {
|
||||
Print (L"[Invalid Hash]");
|
||||
}
|
||||
|
||||
|
||||
Print (L"\n- PE/COFF Authenticode (Digested by SHA-256) Verification ... ");
|
||||
|
||||
if (CompareMem (AuthenticodeWithSha256 + 32, &HashOidValue[22], 9) == 0) {
|
||||
Status = AuthenticodeVerify (
|
||||
AuthenticodeWithSha256,
|
||||
sizeof (AuthenticodeWithSha256),
|
||||
TestRootCert2,
|
||||
sizeof (TestRootCert2),
|
||||
PeSha256Hash,
|
||||
SHA256_DIGEST_SIZE
|
||||
);
|
||||
if (Status) {
|
||||
Print (L"[Pass]");
|
||||
} else {
|
||||
Print (L"[Fail]");
|
||||
}
|
||||
} else {
|
||||
Print (L"[Invalid Hash]");
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Validate UEFI-OpenSSL PKCS#7 Verification Interfaces.
|
||||
Validate UEFI-OpenSSL Authenticode Verification Interfaces.
|
||||
|
||||
@retval EFI_SUCCESS Validation succeeded.
|
||||
@retval EFI_ABORTED Validation failed.
|
||||
|
@ -665,17 +1034,17 @@ ValidateAuthenticode (
|
|||
VOID
|
||||
)
|
||||
{
|
||||
Print (L"\nUEFI-OpenSSL PKCS#7-Signed-Data Testing: ");
|
||||
BOOLEAN Status;
|
||||
|
||||
Print (L"\n- Authenticode (PKCS#7 Signed Data) Verification ... ");
|
||||
Print (L"\nUEFI-OpenSSL Authenticode Testing: ");
|
||||
|
||||
if (AuthenticodeVerify ()) {
|
||||
Print (L"[Pass]");
|
||||
} else {
|
||||
Print (L"[Fail]");
|
||||
}
|
||||
Status = VerifyAuthenticode ();
|
||||
|
||||
Print (L"\n");
|
||||
|
||||
if (Status) {
|
||||
return EFI_SUCCESS;
|
||||
} else {
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Application for Cryptographic Primitives Validation.
|
||||
|
||||
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 2011, 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
|
||||
|
@ -63,6 +63,11 @@ CryptestMain (
|
|||
return Status;
|
||||
}
|
||||
|
||||
Status = ValidateCryptPkcs7 ();
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = ValidateAuthenticode ();
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Application for Cryptographic Primitives Validation.
|
||||
|
||||
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 2011, 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
|
||||
|
@ -85,7 +85,19 @@ ValidateCryptRsa2 (
|
|||
);
|
||||
|
||||
/**
|
||||
Validate UEFI-OpenSSL PKCS#7 Verification Interfaces.
|
||||
Validate UEFI-OpenSSL PKCS#7 Signing & Verification Interfaces.
|
||||
|
||||
@retval EFI_SUCCESS Validation succeeded.
|
||||
@retval EFI_ABORTED Validation failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
ValidateCryptPkcs7 (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Validate UEFI-OpenSSL Authenticode Verification Interfaces.
|
||||
|
||||
@retval EFI_SUCCESS Validation succeeded.
|
||||
@retval EFI_ABORTED Validation failed.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Application for RSA Key Retrieving (from PEM and X509) & Signature Validation.
|
||||
|
||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2010 - 2011, 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
|
||||
|
@ -187,6 +187,11 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 MsgHash[] = {
|
|||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09
|
||||
};
|
||||
|
||||
//
|
||||
// Payload for PKCS#7 Signing & Verification Validation.
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *Payload = "Payload Data for PKCS#7 Signing";
|
||||
|
||||
/**
|
||||
Validate UEFI-OpenSSL RSA Key Retrieving & Signature Interfaces.
|
||||
|
||||
|
@ -303,3 +308,88 @@ ValidateCryptRsa2 (
|
|||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Validate UEFI-OpenSSL PKCS#7 Signing & Verification Interfaces.
|
||||
|
||||
@retval EFI_SUCCESS Validation succeeded.
|
||||
@retval EFI_ABORTED Validation failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
ValidateCryptPkcs7 (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
BOOLEAN Status;
|
||||
UINT8 *P7SignedData;
|
||||
UINTN P7SignedDataSize;
|
||||
UINT8 *SignCert;
|
||||
|
||||
P7SignedData = NULL;
|
||||
SignCert = NULL;
|
||||
|
||||
Print (L"\nUEFI-OpenSSL PKCS#7 Signing & Verification Testing: ");
|
||||
|
||||
Print (L"\n- Create PKCS#7 signedData ...");
|
||||
|
||||
//
|
||||
// Construct Signer Certificate from RAW data.
|
||||
//
|
||||
Status = X509ConstructCertificate (TestCert, sizeof (TestCert), (UINT8 **) &SignCert);
|
||||
if (!Status || SignCert == NULL) {
|
||||
Print (L"[Fail]");
|
||||
goto _Exit;
|
||||
} else {
|
||||
Print (L"[Pass]");
|
||||
}
|
||||
|
||||
//
|
||||
// Create PKCS#7 signedData on Payload.
|
||||
// Note: Caller should release P7SignedData manually.
|
||||
//
|
||||
Status = Pkcs7Sign (
|
||||
TestKeyPem,
|
||||
sizeof (TestKeyPem),
|
||||
(CONST UINT8 *) PemPass,
|
||||
(UINT8 *) Payload,
|
||||
AsciiStrLen (Payload),
|
||||
SignCert,
|
||||
NULL,
|
||||
&P7SignedData,
|
||||
&P7SignedDataSize
|
||||
);
|
||||
if (!Status || P7SignedDataSize == 0) {
|
||||
Print (L"[Fail]");
|
||||
goto _Exit;
|
||||
} else {
|
||||
Print (L"[Pass]");
|
||||
}
|
||||
|
||||
Print (L"\n- Verify PKCS#7 signedData ...");
|
||||
|
||||
Status = Pkcs7Verify (
|
||||
P7SignedData,
|
||||
P7SignedDataSize,
|
||||
TestCACert,
|
||||
sizeof (TestCACert),
|
||||
(UINT8 *) Payload,
|
||||
AsciiStrLen (Payload)
|
||||
);
|
||||
if (!Status) {
|
||||
Print (L"[Fail]");
|
||||
} else {
|
||||
Print (L"[Pass]");
|
||||
}
|
||||
|
||||
_Exit:
|
||||
if (P7SignedData != NULL) {
|
||||
FreePool (P7SignedData);
|
||||
}
|
||||
if (SignCert != NULL) {
|
||||
X509Free (SignCert);
|
||||
}
|
||||
|
||||
Print (L"\n");
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
PLATFORM_VERSION = 0.91
|
||||
DSC_SPECIFICATION = 0x00010005
|
||||
OUTPUT_DIRECTORY = Build/CryptoPkg
|
||||
SUPPORTED_ARCHITECTURES = IA32|X64|IPF|EBC|ARM
|
||||
SUPPORTED_ARCHITECTURES = IA32|X64|IPF|ARM
|
||||
BUILD_TARGETS = DEBUG|RELEASE
|
||||
SKUID_IDENTIFIER = DEFAULT
|
||||
|
||||
|
@ -68,6 +68,9 @@
|
|||
[LibraryClasses.common.DXE_RUNTIME_DRIVER]
|
||||
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
|
||||
|
||||
[LibraryClasses.common.DXE_SMM_DRIVER]
|
||||
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
|
||||
|
||||
[LibraryClasses.common.DXE_SAL_DRIVER]
|
||||
BaseCryptLib|CryptoPkg/Library/BaseCryptLibRuntimeCryptProtocol/BaseCryptLibRuntimeCryptProtocol.inf
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
primitives (Hash Serials, HMAC, RSA, Diffie-Hellman, etc) for UEFI security
|
||||
functionality enabling.
|
||||
|
||||
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 2011, 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
|
||||
|
@ -1346,7 +1346,7 @@ RsaCheckKey (
|
|||
|
||||
If RsaContext is NULL, then ASSERT().
|
||||
If MessageHash is NULL, then ASSERT().
|
||||
If HashSize is not equal to the size of MD5, SHA-1, SHA-256, SHA-224, SHA-512 or SHA-384 digest, then ASSERT().
|
||||
If HashSize is not equal to the size of MD5, SHA-1 or SHA-256 digest, then ASSERT().
|
||||
If SigSize is large enough but Signature is NULL, then ASSERT().
|
||||
|
||||
@param[in] RsaContext Pointer to RSA context for signature generation.
|
||||
|
@ -1378,7 +1378,7 @@ RsaPkcs1Sign (
|
|||
If RsaContext is NULL, then ASSERT().
|
||||
If MessageHash is NULL, then ASSERT().
|
||||
If Signature is NULL, then ASSERT().
|
||||
If HashSize is not equal to the size of MD5, SHA-1, SHA-256, SHA-224, SHA-512 or SHA-384 digest, then ASSERT().
|
||||
If HashSize is not equal to the size of MD5, SHA-1, SHA-256 digest, then ASSERT().
|
||||
|
||||
@param[in] RsaContext Pointer to RSA context for signature verification.
|
||||
@param[in] MessageHash Pointer to octet message hash to be checked.
|
||||
|
@ -1501,6 +1501,116 @@ X509VerifyCert (
|
|||
IN UINTN CACertSize
|
||||
);
|
||||
|
||||
/**
|
||||
Construct a X509 object from DER-encoded certificate data.
|
||||
|
||||
If Cert is NULL, then ASSERT().
|
||||
If SingleX509Cert is NULL, then ASSERT().
|
||||
|
||||
@param[in] Cert Pointer to the DER-encoded certificate data.
|
||||
@param[in] CertSize The size of certificate data in bytes.
|
||||
@param[out] SingleX509Cert The generated X509 object.
|
||||
|
||||
@retval TRUE The X509 object generation succeeded.
|
||||
@retval FALSE The operation failed.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
X509ConstructCertificate (
|
||||
IN CONST UINT8 *Cert,
|
||||
IN UINTN CertSize,
|
||||
OUT UINT8 **SingleX509Cert
|
||||
);
|
||||
|
||||
/**
|
||||
Construct a X509 stack object from a list of DER-encoded certificate data.
|
||||
|
||||
If X509Stack is NULL, then ASSERT().
|
||||
|
||||
@param[in, out] X509Stack On input, pointer to an existing X509 stack object.
|
||||
On output, pointer to the X509 stack object with new
|
||||
inserted X509 certificate.
|
||||
@param ... A list of DER-encoded single certificate data followed
|
||||
by certificate size. A NULL terminates the list. The
|
||||
pairs are the arguments to X509ConstructCertificate().
|
||||
|
||||
@retval TRUE The X509 stack construction succeeded.
|
||||
@retval FALSE The construction operation failed.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
X509ConstructCertificateStack (
|
||||
IN OUT UINT8 **X509Stack,
|
||||
...
|
||||
);
|
||||
|
||||
/**
|
||||
Release the specified X509 object.
|
||||
|
||||
If X509Cert is NULL, then ASSERT().
|
||||
|
||||
@param[in] X509Cert Pointer to the X509 object to be released.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
X509Free (
|
||||
IN VOID *X509Cert
|
||||
);
|
||||
|
||||
/**
|
||||
Release the specified X509 stack object.
|
||||
|
||||
If X509Stack is NULL, then ASSERT().
|
||||
|
||||
@param[in] X509Stack Pointer to the X509 stack object to be released.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
X509StackFree (
|
||||
IN VOID *X509Stack
|
||||
);
|
||||
|
||||
/**
|
||||
Creates a PKCS#7 signedData as described in "PKCS #7: Cryptographic Message
|
||||
Syntax Standard, version 1.5". This interface is only intended to be used for
|
||||
application to perform PKCS#7 functionality validation.
|
||||
|
||||
@param[in] PrivateKey Pointer to the PEM-formatted private key data for
|
||||
data signing.
|
||||
@param[in] PrivateKeySize Size of the PEM private key data in bytes.
|
||||
@param[in] KeyPassword NULL-terminated passphrase used for encrypted PEM
|
||||
key data.
|
||||
@param[in] InData Pointer to the content to be signed.
|
||||
@param[in] InDataSize Size of InData in bytes.
|
||||
@param[in] SignCert Pointer to signer's DER-encoded certificate to sign with.
|
||||
@param[in] OtherCerts Pointer to an optional additional set of certificates to
|
||||
include in the PKCS#7 signedData (e.g. any intermediate
|
||||
CAs in the chain).
|
||||
@param[out] SignedData Pointer to output PKCS#7 signedData.
|
||||
@param[out] SignedDataSize Size of SignedData in bytes.
|
||||
|
||||
@retval TRUE PKCS#7 data signing succeeded.
|
||||
@retval FALSE PKCS#7 data signing failed.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
Pkcs7Sign (
|
||||
IN CONST UINT8 *PrivateKey,
|
||||
IN UINTN PrivateKeySize,
|
||||
IN CONST UINT8 *KeyPassword,
|
||||
IN UINT8 *InData,
|
||||
IN UINTN InDataSize,
|
||||
IN UINT8 *SignCert,
|
||||
IN UINT8 *OtherCerts OPTIONAL,
|
||||
OUT UINT8 **SignedData,
|
||||
OUT UINTN *SignedDataSize
|
||||
);
|
||||
|
||||
/**
|
||||
Verifies the validility of a PKCS#7 signed data as described in "PKCS #7: Cryptographic
|
||||
Message Syntax Standard".
|
||||
|
@ -1530,6 +1640,39 @@ Pkcs7Verify (
|
|||
IN UINTN DataSize
|
||||
);
|
||||
|
||||
/**
|
||||
Verifies the validility of a PE/COFF Authenticode Signature as described in "Windows
|
||||
Authenticode Portable Executable Signature Format".
|
||||
|
||||
If AuthData is NULL, then ASSERT().
|
||||
If ImageHash is NULL, then ASSERT().
|
||||
|
||||
@param[in] AuthData Pointer to the Authenticode Signature retrieved from signed
|
||||
PE/COFF image to be verified.
|
||||
@param[in] DataSize Size of the Authenticode Signature in bytes.
|
||||
@param[in] TrustedCert Pointer to a trusted/root certificate encoded in DER, which
|
||||
is used for certificate chain verification.
|
||||
@param[in] CertSize Size of the trusted certificate in bytes.
|
||||
@param[in] ImageHash Pointer to the original image file hash value. The procudure
|
||||
for calculating the image hash value is described in Authenticode
|
||||
specification.
|
||||
@param[in] HashSize Size of Image hash value in bytes.
|
||||
|
||||
@retval TRUE The specified Authenticode Signature is valid.
|
||||
@retval FALSE Invalid Authenticode Signature.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
AuthenticodeVerify (
|
||||
IN CONST UINT8 *AuthData,
|
||||
IN UINTN DataSize,
|
||||
IN CONST UINT8 *TrustedCert,
|
||||
IN UINTN CertSize,
|
||||
IN CONST UINT8 *ImageHash,
|
||||
IN UINTN HashSize
|
||||
);
|
||||
|
||||
//=====================================================================================
|
||||
// DH Key Exchange Primitive
|
||||
//=====================================================================================
|
||||
|
|
|
@ -41,8 +41,6 @@ typedef VOID *FILE;
|
|||
#define va_end(Marker) ((void)0)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
//
|
||||
// #defines from EFI Application Toolkit required to buiild Open SSL
|
||||
//
|
||||
|
@ -241,7 +239,6 @@ extern FILE *stdout;
|
|||
#define abort() ASSERT (FALSE)
|
||||
#define assert(expression)
|
||||
#define localtime(timer) NULL
|
||||
#define gmtime(timer) NULL
|
||||
#define gmtime_r(timer,result) (result = NULL)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
## @file
|
||||
# Cryptographic Library Instance for DXE_DRIVER.
|
||||
#
|
||||
# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2009 - 2011, 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
|
||||
|
@ -23,7 +23,7 @@
|
|||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF ARM
|
||||
#
|
||||
|
||||
[Sources]
|
||||
|
@ -42,6 +42,7 @@
|
|||
Pk/CryptPkcs7.c
|
||||
Pk/CryptDh.c
|
||||
Pk/CryptX509.c
|
||||
Pk/CryptAuthenticode.c
|
||||
Pem/CryptPem.c
|
||||
|
||||
SysCall/CrtWrapper.c
|
||||
|
|
|
@ -0,0 +1,143 @@
|
|||
/** @file
|
||||
Authenticode Portable Executable Signature Verification over OpenSSL.
|
||||
|
||||
Copyright (c) 2011, 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#include "InternalCryptLib.h"
|
||||
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/pkcs7.h>
|
||||
|
||||
|
||||
/**
|
||||
Verifies the validility of a PE/COFF Authenticode Signature as described in "Windows
|
||||
Authenticode Portable Executable Signature Format".
|
||||
|
||||
If AuthData is NULL, then ASSERT().
|
||||
If ImageHash is NULL, then ASSERT().
|
||||
|
||||
@param[in] AuthData Pointer to the Authenticode Signature retrieved from signed
|
||||
PE/COFF image to be verified.
|
||||
@param[in] DataSize Size of the Authenticode Signature in bytes.
|
||||
@param[in] TrustedCert Pointer to a trusted/root certificate encoded in DER, which
|
||||
is used for certificate chain verification.
|
||||
@param[in] CertSize Size of the trusted certificate in bytes.
|
||||
@param[in] ImageHash Pointer to the original image file hash value. The procudure
|
||||
for calculating the image hash value is described in Authenticode
|
||||
specification.
|
||||
@param[in] HashSize Size of Image hash value in bytes.
|
||||
|
||||
@retval TRUE The specified Authenticode Signature is valid.
|
||||
@retval FALSE Invalid Authenticode Signature.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
AuthenticodeVerify (
|
||||
IN CONST UINT8 *AuthData,
|
||||
IN UINTN DataSize,
|
||||
IN CONST UINT8 *TrustedCert,
|
||||
IN UINTN CertSize,
|
||||
IN CONST UINT8 *ImageHash,
|
||||
IN UINTN HashSize
|
||||
)
|
||||
{
|
||||
BOOLEAN Status;
|
||||
PKCS7 *Pkcs7;
|
||||
CONST UINT8 *OrigAuthData;
|
||||
UINT8 *SpcIndirectDataContent;
|
||||
UINT8 Asn1Byte;
|
||||
UINTN ContentSize;
|
||||
|
||||
//
|
||||
// ASSERT if Authenticode Signature Data or PE Image Hash is NULL
|
||||
//
|
||||
ASSERT (AuthData != NULL);
|
||||
ASSERT (ImageHash != NULL);
|
||||
|
||||
Status = FALSE;
|
||||
Pkcs7 = NULL;
|
||||
OrigAuthData = AuthData;
|
||||
|
||||
//
|
||||
// Retrieve & Parse PKCS#7 Data (DER encoding) from Authenticode Signature
|
||||
//
|
||||
Pkcs7 = d2i_PKCS7 (NULL, &AuthData, (int)DataSize);
|
||||
if (Pkcs7 == NULL) {
|
||||
goto _Exit;
|
||||
}
|
||||
|
||||
//
|
||||
// Check if it's PKCS#7 Signed Data (for Authenticode Scenario)
|
||||
//
|
||||
if (!PKCS7_type_is_signed (Pkcs7)) {
|
||||
goto _Exit;
|
||||
}
|
||||
|
||||
//
|
||||
// NOTE: OpenSSL PKCS7 Decoder didn't work for Authenticode-format signed data due to
|
||||
// some authenticode-specific structure. Use opaque ASN.1 string to retrieve
|
||||
// PKCS#7 ContentInfo here.
|
||||
//
|
||||
SpcIndirectDataContent = (UINT8 *)(Pkcs7->d.sign->contents->d.other->value.asn1_string->data);
|
||||
|
||||
//
|
||||
// Retrieve the SEQUENCE data size from ASN.1-encoded SpcIndirectDataContent.
|
||||
//
|
||||
Asn1Byte = *(SpcIndirectDataContent + 1);
|
||||
if ((Asn1Byte & 0x80) == 0) {
|
||||
//
|
||||
// Short Form of Length Encoding
|
||||
//
|
||||
ContentSize = (UINTN) (Asn1Byte & 0x7F);
|
||||
//
|
||||
// Skip the SEQUENCE Tag;
|
||||
//
|
||||
SpcIndirectDataContent += 2;
|
||||
} else {
|
||||
//
|
||||
// Long Form of Length Encoding (Assume Only two bytes here)
|
||||
//
|
||||
ContentSize = (UINTN) (*(SpcIndirectDataContent + 2));
|
||||
ContentSize = (ContentSize << 8) + (UINTN)(*(SpcIndirectDataContent + 3));
|
||||
//
|
||||
// Skip the SEQUENCE Tag;
|
||||
//
|
||||
SpcIndirectDataContent += 4;
|
||||
}
|
||||
|
||||
//
|
||||
// Compare the original file hash value to the digest retrieve from SpcIndirectDataContent
|
||||
// defined in Authenticode
|
||||
// NOTE: Need to double-check HashLength here!
|
||||
//
|
||||
if (CompareMem (SpcIndirectDataContent + ContentSize - HashSize, ImageHash, HashSize) != 0) {
|
||||
//
|
||||
// Un-matched PE/COFF Hash Value
|
||||
//
|
||||
goto _Exit;
|
||||
}
|
||||
|
||||
//
|
||||
// Verifies the PKCS#7 Signed Data in PE/COFF Authenticode Signature
|
||||
//
|
||||
Status = (BOOLEAN) Pkcs7Verify (OrigAuthData, DataSize, TrustedCert, CertSize, SpcIndirectDataContent, ContentSize);
|
||||
|
||||
_Exit:
|
||||
//
|
||||
// Release Resources
|
||||
//
|
||||
PKCS7_free (Pkcs7);
|
||||
|
||||
return Status;
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
PKCS#7 SignedData Verification Wrapper Implementation over OpenSSL.
|
||||
|
||||
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 2011, 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
|
||||
|
@ -19,6 +19,235 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
#include <openssl/pkcs7.h>
|
||||
|
||||
|
||||
/**
|
||||
Verification callback function to override any existing callbacks in OpenSSL
|
||||
for intermediate certificate supports.
|
||||
|
||||
@param[in] Status Original status before calling this callback.
|
||||
@param[in] Context X509 store context.
|
||||
|
||||
@retval 1 Current X509 certificate is verified successfully.
|
||||
@retval 0 Verification failed.
|
||||
|
||||
**/
|
||||
STATIC int X509VerifyCb (int Status, X509_STORE_CTX *Context)
|
||||
{
|
||||
X509_OBJECT *Obj;
|
||||
int Error;
|
||||
int Index;
|
||||
int Count;
|
||||
|
||||
Obj = NULL;
|
||||
Error = X509_STORE_CTX_get_error (Context);
|
||||
|
||||
//
|
||||
// X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT and X509_V_ERR_UNABLE_TO_GET_ISSUER_
|
||||
// CERT_LOCALLY mean a X509 certificate is not self signed and its issuer
|
||||
// can not be found in X509_verify_cert of X509_vfy.c.
|
||||
// In order to support intermediate certificate node, we override the
|
||||
// errors if the certification is obtained from X509 store, i.e. it is
|
||||
// a trusted ceritifcate node that is enrolled by user.
|
||||
// Besides,X509_V_ERR_CERT_UNTRUSTED and X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE
|
||||
// are also ignored to enable such feature.
|
||||
//
|
||||
if ((Error == X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT) ||
|
||||
(Error == X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY)) {
|
||||
Obj = (X509_OBJECT *) OPENSSL_malloc (sizeof (X509_OBJECT));
|
||||
if (Obj == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Obj->type = X509_LU_X509;
|
||||
Obj->data.x509 = Context->current_cert;
|
||||
|
||||
CRYPTO_w_lock (CRYPTO_LOCK_X509_STORE);
|
||||
|
||||
if (X509_OBJECT_retrieve_match (Context->ctx->objs, Obj)) {
|
||||
Status = 1;
|
||||
} else {
|
||||
//
|
||||
// If any certificate in the chain is enrolled as trusted certificate,
|
||||
// pass the certificate verification.
|
||||
//
|
||||
if (Error == X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY) {
|
||||
Count = sk_X509_num (Context->chain);
|
||||
for (Index = 0; Index < Count; Index++) {
|
||||
Obj->data.x509 = sk_X509_value (Context->chain, Index);
|
||||
if (X509_OBJECT_retrieve_match (Context->ctx->objs, Obj)) {
|
||||
Status = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CRYPTO_w_unlock (CRYPTO_LOCK_X509_STORE);
|
||||
}
|
||||
|
||||
if ((Error == X509_V_ERR_CERT_UNTRUSTED) ||
|
||||
(Error == X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE)) {
|
||||
Status = 1;
|
||||
}
|
||||
|
||||
if (Obj != NULL) {
|
||||
OPENSSL_free (Obj);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Creates a PKCS#7 signedData as described in "PKCS #7: Cryptographic Message
|
||||
Syntax Standard, version 1.5". This interface is only intended to be used for
|
||||
application to perform PKCS#7 functionality validation.
|
||||
|
||||
@param[in] PrivateKey Pointer to the PEM-formatted private key data for
|
||||
data signing.
|
||||
@param[in] PrivateKeySize Size of the PEM private key data in bytes.
|
||||
@param[in] KeyPassword NULL-terminated passphrase used for encrypted PEM
|
||||
key data.
|
||||
@param[in] InData Pointer to the content to be signed.
|
||||
@param[in] InDataSize Size of InData in bytes.
|
||||
@param[in] SignCert Pointer to signer's DER-encoded certificate to sign with.
|
||||
@param[in] OtherCerts Pointer to an optional additional set of certificates to
|
||||
include in the PKCS#7 signedData (e.g. any intermediate
|
||||
CAs in the chain).
|
||||
@param[out] SignedData Pointer to output PKCS#7 signedData.
|
||||
@param[out] SignedDataSize Size of SignedData in bytes.
|
||||
|
||||
@retval TRUE PKCS#7 data signing succeeded.
|
||||
@retval FALSE PKCS#7 data signing failed.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
Pkcs7Sign (
|
||||
IN CONST UINT8 *PrivateKey,
|
||||
IN UINTN PrivateKeySize,
|
||||
IN CONST UINT8 *KeyPassword,
|
||||
IN UINT8 *InData,
|
||||
IN UINTN InDataSize,
|
||||
IN UINT8 *SignCert,
|
||||
IN UINT8 *OtherCerts OPTIONAL,
|
||||
OUT UINT8 **SignedData,
|
||||
OUT UINTN *SignedDataSize
|
||||
)
|
||||
{
|
||||
BOOLEAN Status;
|
||||
EVP_PKEY *Key;
|
||||
BIO *DataBio;
|
||||
PKCS7 *Pkcs7;
|
||||
UINT8 *RsaContext;
|
||||
UINT8 *P7Data;
|
||||
|
||||
//
|
||||
// Check input parameters.
|
||||
//
|
||||
if ((PrivateKey == NULL) || (KeyPassword == NULL) || (InData == NULL)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((SignCert == NULL) || (SignedData == NULL) || (SignedDataSize == NULL)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
RsaContext = NULL;
|
||||
Key = NULL;
|
||||
Pkcs7 = NULL;
|
||||
DataBio = NULL;
|
||||
Status = FALSE;
|
||||
|
||||
//
|
||||
// Retrieve RSA private key from PEM data.
|
||||
//
|
||||
Status = RsaGetPrivateKeyFromPem (
|
||||
PrivateKey,
|
||||
PrivateKeySize,
|
||||
(CONST CHAR8 *) KeyPassword,
|
||||
(VOID **) &RsaContext
|
||||
);
|
||||
if (!Status) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Register & Initialize necessary digest algorithms and PRNG for PKCS#7 Handling
|
||||
//
|
||||
EVP_add_digest (EVP_md5());
|
||||
EVP_add_digest (EVP_sha1());
|
||||
EVP_add_digest (EVP_sha256());
|
||||
RandomSeed (NULL, 0);
|
||||
|
||||
//
|
||||
// Construct OpenSSL EVP_PKEY for private key.
|
||||
//
|
||||
Key = EVP_PKEY_new ();
|
||||
if (Key == NULL) {
|
||||
goto _Exit;
|
||||
}
|
||||
Key->save_type = EVP_PKEY_RSA;
|
||||
Key->type = EVP_PKEY_type (EVP_PKEY_RSA);
|
||||
Key->pkey.rsa = (RSA *) RsaContext;
|
||||
|
||||
//
|
||||
// Convert the data to be signed to BIO format.
|
||||
//
|
||||
DataBio = BIO_new (BIO_s_mem ());
|
||||
BIO_write (DataBio, InData, (int) InDataSize);
|
||||
|
||||
//
|
||||
// Create the PKCS#7 signedData structure.
|
||||
//
|
||||
Pkcs7 = PKCS7_sign (
|
||||
(X509 *) SignCert,
|
||||
Key,
|
||||
(STACK_OF(X509) *) OtherCerts,
|
||||
DataBio,
|
||||
PKCS7_BINARY
|
||||
);
|
||||
if (Pkcs7 == NULL) {
|
||||
goto _Exit;
|
||||
}
|
||||
|
||||
//
|
||||
// Convert PKCS#7 signedData structure into DER-encoded buffer.
|
||||
//
|
||||
*SignedDataSize = i2d_PKCS7 (Pkcs7, NULL);
|
||||
if (*SignedDataSize == 0) {
|
||||
goto _Exit;
|
||||
}
|
||||
*SignedData = OPENSSL_malloc (*SignedDataSize);
|
||||
P7Data = *SignedData;
|
||||
*SignedDataSize = i2d_PKCS7 (Pkcs7, (unsigned char **) &P7Data);
|
||||
|
||||
Status = TRUE;
|
||||
|
||||
_Exit:
|
||||
//
|
||||
// Release Resources
|
||||
//
|
||||
if (RsaContext != NULL) {
|
||||
RsaFree (RsaContext);
|
||||
if (Key != NULL) {
|
||||
Key->pkey.rsa = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (Key != NULL) {
|
||||
EVP_PKEY_free (Key);
|
||||
}
|
||||
|
||||
if (DataBio != NULL) {
|
||||
BIO_free (DataBio);
|
||||
}
|
||||
|
||||
if (Pkcs7 != NULL) {
|
||||
PKCS7_free (Pkcs7);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Verifies the validility of a PKCS#7 signed data as described in "PKCS #7: Cryptographic
|
||||
Message Syntax Standard".
|
||||
|
@ -49,7 +278,6 @@ Pkcs7Verify (
|
|||
)
|
||||
{
|
||||
PKCS7 *Pkcs7;
|
||||
UINT8 *Content;
|
||||
BIO *CertBio;
|
||||
BIO *DataBio;
|
||||
BOOLEAN Status;
|
||||
|
@ -73,6 +301,7 @@ Pkcs7Verify (
|
|||
//
|
||||
EVP_add_digest (EVP_md5());
|
||||
EVP_add_digest (EVP_sha1());
|
||||
EVP_add_digest_alias (SN_sha1WithRSAEncryption, SN_sha1WithRSA);
|
||||
EVP_add_digest (EVP_sha256());
|
||||
|
||||
//
|
||||
|
@ -90,23 +319,6 @@ Pkcs7Verify (
|
|||
goto _Exit;
|
||||
}
|
||||
|
||||
//
|
||||
// Check PKCS#7 embedded signed content with InData.
|
||||
//
|
||||
if (InData != NULL) {
|
||||
//
|
||||
// NOTE: PKCS7_dataDecode() didn't work for Authenticode-format signed data due to
|
||||
// some authenticode-specific structure. Use opaque ASN.1 string to retrieve
|
||||
// PKCS#7 ContentInfo here.
|
||||
//
|
||||
Content = (UINT8 *)(Pkcs7->d.sign->contents->d.other->value.asn1_string->data);
|
||||
|
||||
// Ignore two bytes for DER encoding of ASN.1 "SEQUENCE"
|
||||
if (CompareMem (Content + 2, InData, DataLength) != 0) {
|
||||
goto _Exit;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Read DER-encoded root certificate and Construct X509 Certificate
|
||||
//
|
||||
|
@ -131,6 +343,12 @@ Pkcs7Verify (
|
|||
goto _Exit;
|
||||
}
|
||||
|
||||
//
|
||||
// Register customized X509 verification callback function to support
|
||||
// trusted intermediate certificate anchor.
|
||||
//
|
||||
CertStore->verify_cb = X509VerifyCb;
|
||||
|
||||
//
|
||||
// For generic PKCS#7 handling, InData may be NULL if the content is present
|
||||
// in PKCS#7 structure. So ignore NULL checking here.
|
||||
|
@ -141,7 +359,7 @@ Pkcs7Verify (
|
|||
//
|
||||
// Verifies the PKCS#7 signedData structure
|
||||
//
|
||||
Status = (BOOLEAN) PKCS7_verify (Pkcs7, NULL, CertStore, DataBio, NULL, 0);
|
||||
Status = (BOOLEAN) PKCS7_verify (Pkcs7, NULL, CertStore, DataBio, NULL, PKCS7_BINARY);
|
||||
|
||||
_Exit:
|
||||
//
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
RSA Asymmetric Cipher Wrapper Implementation over OpenSSL.
|
||||
|
||||
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 2011, 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
|
||||
|
@ -545,7 +545,7 @@ DigestInfoEncoding (
|
|||
|
||||
If RsaContext is NULL, then ASSERT().
|
||||
If MessageHash is NULL, then ASSERT().
|
||||
If HashSize is not equal to the size of MD5, SHA-1, SHA-256, SHA-224, SHA-512 or SHA-384 digest, then ASSERT().
|
||||
If HashSize is not equal to the size of MD5, SHA-1 or SHA-256 digest, then ASSERT().
|
||||
If SigSize is large enough but Signature is NULL, then ASSERT().
|
||||
|
||||
@param[in] RsaContext Pointer to RSA context for signature generation.
|
||||
|
@ -615,7 +615,7 @@ RsaPkcs1Sign (
|
|||
If RsaContext is NULL, then ASSERT().
|
||||
If MessageHash is NULL, then ASSERT().
|
||||
If Signature is NULL, then ASSERT().
|
||||
If HashSize is not equal to the size of MD5, SHA-1, SHA-256, SHA-224, SHA-512 or SHA-384 digest, then ASSERT().
|
||||
If HashSize is not equal to the size of MD5, SHA-1 or SHA-256 digest, then ASSERT().
|
||||
|
||||
@param[in] RsaContext Pointer to RSA context for signature verification.
|
||||
@param[in] MessageHash Pointer to octet message hash to be checked.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
X.509 Certificate Handler Wrapper Implementation over OpenSSL.
|
||||
|
||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2010 - 2011, 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
|
||||
|
@ -15,6 +15,202 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
#include "InternalCryptLib.h"
|
||||
#include <openssl/x509.h>
|
||||
|
||||
|
||||
/**
|
||||
Construct a X509 object from DER-encoded certificate data.
|
||||
|
||||
If Cert is NULL, then ASSERT().
|
||||
If SingleX509Cert is NULL, then ASSERT().
|
||||
|
||||
@param[in] Cert Pointer to the DER-encoded certificate data.
|
||||
@param[in] CertSize The size of certificate data in bytes.
|
||||
@param[out] SingleX509Cert The generated X509 object.
|
||||
|
||||
@retval TRUE The X509 object generation succeeded.
|
||||
@retval FALSE The operation failed.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
X509ConstructCertificate (
|
||||
IN CONST UINT8 *Cert,
|
||||
IN UINTN CertSize,
|
||||
OUT UINT8 **SingleX509Cert
|
||||
)
|
||||
{
|
||||
BIO *CertBio;
|
||||
X509 *X509Cert;
|
||||
BOOLEAN Status;
|
||||
|
||||
//
|
||||
// ASSERT if Cert is NULL or SingleX509Cert is NULL.
|
||||
//
|
||||
ASSERT (Cert != NULL);
|
||||
ASSERT (SingleX509Cert != NULL);
|
||||
|
||||
Status = FALSE;
|
||||
|
||||
//
|
||||
// Read DER-encoded X509 Certificate and Construct X509 object.
|
||||
//
|
||||
CertBio = BIO_new (BIO_s_mem ());
|
||||
BIO_write (CertBio, Cert, (int) CertSize);
|
||||
if (CertBio == NULL) {
|
||||
goto _Exit;
|
||||
}
|
||||
X509Cert = d2i_X509_bio (CertBio, NULL);
|
||||
if (X509Cert == NULL) {
|
||||
goto _Exit;
|
||||
}
|
||||
|
||||
*SingleX509Cert = (UINT8 *) X509Cert;
|
||||
Status = TRUE;
|
||||
|
||||
_Exit:
|
||||
//
|
||||
// Release Resources.
|
||||
//
|
||||
BIO_free (CertBio);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Construct a X509 stack object from a list of DER-encoded certificate data.
|
||||
|
||||
If X509Stack is NULL, then ASSERT().
|
||||
|
||||
@param[in, out] X509Stack On input, pointer to an existing X509 stack object.
|
||||
On output, pointer to the X509 stack object with new
|
||||
inserted X509 certificate.
|
||||
@param ... A list of DER-encoded single certificate data followed
|
||||
by certificate size. A NULL terminates the list. The
|
||||
pairs are the arguments to X509ConstructCertificate().
|
||||
|
||||
@retval TRUE The X509 stack construction succeeded.
|
||||
@retval FALSE The construction operation failed.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
X509ConstructCertificateStack (
|
||||
IN OUT UINT8 **X509Stack,
|
||||
...
|
||||
)
|
||||
{
|
||||
UINT8 *Cert;
|
||||
UINTN CertSize;
|
||||
X509 *X509Cert;
|
||||
STACK_OF(X509) *CertStack;
|
||||
BOOLEAN Status;
|
||||
VA_LIST Args;
|
||||
UINTN Index;
|
||||
|
||||
//
|
||||
// ASSERT if input X509Stack is NULL.
|
||||
//
|
||||
ASSERT (X509Stack != NULL);
|
||||
|
||||
Status = FALSE;
|
||||
|
||||
//
|
||||
// Initialize X509 stack object.
|
||||
//
|
||||
CertStack = (STACK_OF(X509) *) (*X509Stack);
|
||||
if (CertStack == NULL) {
|
||||
CertStack = sk_X509_new_null ();
|
||||
if (CertStack == NULL) {
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
VA_START (Args, X509Stack);
|
||||
|
||||
for (Index = 0; ; Index++) {
|
||||
//
|
||||
// If Cert is NULL, then it is the end of the list.
|
||||
//
|
||||
Cert = VA_ARG (Args, UINT8 *);
|
||||
if (Cert == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
CertSize = VA_ARG (Args, UINTN);
|
||||
|
||||
//
|
||||
// Construct X509 Object from the given DER-encoded certificate data.
|
||||
//
|
||||
Status = X509ConstructCertificate (
|
||||
(CONST UINT8 *) Cert,
|
||||
CertSize,
|
||||
(UINT8 **) &X509Cert
|
||||
);
|
||||
if (!Status) {
|
||||
X509_free (X509Cert);
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Insert the new X509 object into X509 stack object.
|
||||
//
|
||||
sk_X509_push (CertStack, X509Cert);
|
||||
}
|
||||
|
||||
VA_END (Args);
|
||||
|
||||
if (!Status) {
|
||||
sk_X509_pop_free (CertStack, X509_free);
|
||||
} else {
|
||||
*X509Stack = (UINT8 *) CertStack;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Release the specified X509 object.
|
||||
|
||||
If X509Cert is NULL, then ASSERT().
|
||||
|
||||
@param[in] X509Cert Pointer to the X509 object to be released.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
X509Free (
|
||||
IN VOID *X509Cert
|
||||
)
|
||||
{
|
||||
ASSERT (X509Cert != NULL);
|
||||
|
||||
//
|
||||
// Free OpenSSL X509 object.
|
||||
//
|
||||
X509_free ((X509 *) X509Cert);
|
||||
}
|
||||
|
||||
/**
|
||||
Release the specified X509 stack object.
|
||||
|
||||
If X509Stack is NULL, then ASSERT().
|
||||
|
||||
@param[in] X509Stack Pointer to the X509 stack object to be released.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
X509StackFree (
|
||||
IN VOID *X509Stack
|
||||
)
|
||||
{
|
||||
ASSERT (X509Stack != NULL);
|
||||
|
||||
//
|
||||
// Free OpenSSL X509 stack object.
|
||||
//
|
||||
sk_X509_pop_free ((STACK_OF(X509) *) X509Stack, X509_free);
|
||||
}
|
||||
|
||||
/**
|
||||
Retrieve the subject bytes from one X.509 certificate.
|
||||
|
||||
|
@ -42,7 +238,6 @@ X509GetSubjectName (
|
|||
)
|
||||
{
|
||||
BOOLEAN Status;
|
||||
BIO *CertBio;
|
||||
X509 *X509Cert;
|
||||
X509_NAME *X509Name;
|
||||
|
||||
|
@ -58,13 +253,8 @@ X509GetSubjectName (
|
|||
//
|
||||
// Read DER-encoded X509 Certificate and Construct X509 object.
|
||||
//
|
||||
CertBio = BIO_new (BIO_s_mem ());
|
||||
BIO_write (CertBio, Cert, (int)CertSize);
|
||||
if (CertBio == NULL) {
|
||||
goto _Exit;
|
||||
}
|
||||
X509Cert = d2i_X509_bio (CertBio, NULL);
|
||||
if (Cert == NULL) {
|
||||
Status = X509ConstructCertificate (Cert, CertSize, (UINT8 **) &X509Cert);
|
||||
if ((X509Cert == NULL) || (!Status)) {
|
||||
goto _Exit;
|
||||
}
|
||||
|
||||
|
@ -86,7 +276,6 @@ _Exit:
|
|||
//
|
||||
// Release Resources.
|
||||
//
|
||||
BIO_free (CertBio);
|
||||
X509_free (X509Cert);
|
||||
|
||||
return Status;
|
||||
|
@ -118,7 +307,6 @@ RsaGetPublicKeyFromX509 (
|
|||
{
|
||||
BOOLEAN Status;
|
||||
EVP_PKEY *Pkey;
|
||||
BIO *CertBio;
|
||||
X509 *X509Cert;
|
||||
|
||||
//
|
||||
|
@ -129,19 +317,13 @@ RsaGetPublicKeyFromX509 (
|
|||
|
||||
Status = FALSE;
|
||||
Pkey = NULL;
|
||||
CertBio = NULL;
|
||||
X509Cert = NULL;
|
||||
|
||||
//
|
||||
// Read DER-encoded X509 Certificate and Construct X509 object.
|
||||
//
|
||||
CertBio = BIO_new (BIO_s_mem ());
|
||||
BIO_write (CertBio, Cert, (int)CertSize);
|
||||
if (CertBio == NULL) {
|
||||
goto _Exit;
|
||||
}
|
||||
X509Cert = d2i_X509_bio (CertBio, NULL);
|
||||
if (X509Cert == NULL) {
|
||||
Status = X509ConstructCertificate (Cert, CertSize, (UINT8 **) &X509Cert);
|
||||
if ((X509Cert == NULL) || (!Status)) {
|
||||
goto _Exit;
|
||||
}
|
||||
|
||||
|
@ -164,7 +346,6 @@ _Exit:
|
|||
//
|
||||
// Release Resources.
|
||||
//
|
||||
BIO_free (CertBio);
|
||||
X509_free (X509Cert);
|
||||
EVP_PKEY_free (Pkey);
|
||||
|
||||
|
@ -197,8 +378,6 @@ X509VerifyCert (
|
|||
)
|
||||
{
|
||||
BOOLEAN Status;
|
||||
BIO *BioCert;
|
||||
BIO *BioCACert;
|
||||
X509 *X509Cert;
|
||||
X509 *X509CACert;
|
||||
X509_STORE *CertStore;
|
||||
|
@ -211,8 +390,6 @@ X509VerifyCert (
|
|||
ASSERT (CACert != NULL);
|
||||
|
||||
Status = FALSE;
|
||||
BioCert = NULL;
|
||||
BioCACert = NULL;
|
||||
X509Cert = NULL;
|
||||
X509CACert = NULL;
|
||||
CertStore = NULL;
|
||||
|
@ -227,26 +404,16 @@ X509VerifyCert (
|
|||
//
|
||||
// Read DER-encoded certificate to be verified and Construct X509 object.
|
||||
//
|
||||
BioCert = BIO_new (BIO_s_mem ());
|
||||
BIO_write (BioCert, Cert, (int)CertSize);
|
||||
if (BioCert == NULL) {
|
||||
goto _Exit;
|
||||
}
|
||||
X509Cert = d2i_X509_bio (BioCert, NULL);
|
||||
if (X509Cert == NULL) {
|
||||
Status = X509ConstructCertificate (Cert, CertSize, (UINT8 **) &X509Cert);
|
||||
if ((X509Cert == NULL) || (!Status)) {
|
||||
goto _Exit;
|
||||
}
|
||||
|
||||
//
|
||||
// Read DER-encoded root certificate and Construct X509 object.
|
||||
//
|
||||
BioCACert = BIO_new (BIO_s_mem());
|
||||
BIO_write (BioCACert, CACert, (int)CACertSize);
|
||||
if (BioCert == NULL) {
|
||||
goto _Exit;
|
||||
}
|
||||
X509CACert = d2i_X509_bio (BioCACert, NULL);
|
||||
if (CACert == NULL) {
|
||||
Status = X509ConstructCertificate (CACert, CACertSize, (UINT8 **) &X509CACert);
|
||||
if ((X509CACert == NULL) || (!Status)) {
|
||||
goto _Exit;
|
||||
}
|
||||
|
||||
|
@ -277,8 +444,6 @@ _Exit:
|
|||
//
|
||||
// Release Resources.
|
||||
//
|
||||
BIO_free (BioCert);
|
||||
BIO_free (BioCACert);
|
||||
X509_free (X509Cert);
|
||||
X509_free (X509CACert);
|
||||
X509_STORE_free (CertStore);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
## @file
|
||||
# Cryptographic Library Instance for DXE_RUNTIME_DRIVER
|
||||
#
|
||||
# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2009 - 2011, 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
|
||||
|
@ -24,14 +24,17 @@
|
|||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF ARM
|
||||
#
|
||||
|
||||
[Sources]
|
||||
Hash/CryptMd5.c
|
||||
Hash/CryptSha1.c
|
||||
Hash/CryptSha256.c
|
||||
Rand/CryptRand.c
|
||||
Pk/CryptRsa.c
|
||||
Pk/CryptPkcs7.c
|
||||
Pem/CryptPem.c
|
||||
|
||||
SysCall/CrtWrapper.c
|
||||
SysCall/TimerWrapper.c
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
## @file
|
||||
# Cryptographic Library Instance for SMM driver.
|
||||
#
|
||||
# Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2010 - 2011, 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
|
||||
|
@ -18,6 +18,7 @@
|
|||
FILE_GUID = 028080a3-8958-4a62-a1a8-0fa1da162007
|
||||
MODULE_TYPE = DXE_SMM_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
PI_SPECIFICATION_VERSION = 0x0001000A
|
||||
LIBRARY_CLASS = BaseCryptLib|DXE_SMM_DRIVER SMM_CORE
|
||||
|
||||
#
|
||||
|
@ -30,8 +31,10 @@
|
|||
Hash/CryptMd5.c
|
||||
Hash/CryptSha1.c
|
||||
Hash/CryptSha256.c
|
||||
Rand/CryptRand.c
|
||||
Pk/CryptRsa.c
|
||||
Pk/CryptPkcs7.c
|
||||
Pem/CryptPem.c
|
||||
|
||||
SysCall/CrtWrapper.c
|
||||
SysCall/RealTimeClock.c
|
||||
|
|
|
@ -244,7 +244,10 @@ void qsort (void *base, size_t num, size_t width, int (*compare)(const void *, c
|
|||
ASSERT (base != NULL);
|
||||
ASSERT (compare != NULL);
|
||||
|
||||
Buffer = AllocatePool (width);
|
||||
//
|
||||
// Use CRT-style malloc to cover BS and RT memory allocation.
|
||||
//
|
||||
Buffer = malloc (width);
|
||||
ASSERT (Buffer != NULL);
|
||||
|
||||
//
|
||||
|
@ -252,7 +255,7 @@ void qsort (void *base, size_t num, size_t width, int (*compare)(const void *, c
|
|||
//
|
||||
QuickSortWorker (base, (UINTN)num, (UINTN)width, (SORT_COMPARE)compare, Buffer);
|
||||
|
||||
FreePool (Buffer);
|
||||
free (Buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
C Run-Time Libraries (CRT) Time Management Routines Wrapper Implementation
|
||||
for OpenSSL-based Cryptographic Library (used in SMM).
|
||||
|
||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2010 - 2011, 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
|
||||
|
@ -74,6 +74,7 @@ typedef union {
|
|||
//
|
||||
|
||||
#define IsLeap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
|
||||
#define SECSPERMIN (60)
|
||||
#define SECSPERHOUR (60 * 60)
|
||||
#define SECSPERDAY (24 * SECSPERHOUR)
|
||||
|
||||
|
@ -220,3 +221,66 @@ time_t time (time_t *timer)
|
|||
|
||||
return *timer;
|
||||
}
|
||||
|
||||
//
|
||||
// Convert a time value from type time_t to struct tm.
|
||||
//
|
||||
struct tm * gmtime (const time_t *timer)
|
||||
{
|
||||
struct tm *GmTime;
|
||||
UINT16 DayNo;
|
||||
UINT16 DayRemainder;
|
||||
time_t Year;
|
||||
time_t YearNo;
|
||||
UINT16 TotalDays;
|
||||
UINT16 MonthNo;
|
||||
|
||||
if (timer == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GmTime = malloc (sizeof (struct tm));
|
||||
if (GmTime == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ZeroMem ((VOID *) GmTime, (UINTN) sizeof (struct tm));
|
||||
|
||||
DayNo = (UINT16) (*timer / SECSPERDAY);
|
||||
DayRemainder = (UINT16) (*timer % SECSPERDAY);
|
||||
|
||||
GmTime->tm_sec = (int) (DayRemainder % SECSPERMIN);
|
||||
GmTime->tm_min = (int) ((DayRemainder % SECSPERHOUR) / SECSPERMIN);
|
||||
GmTime->tm_hour = (int) (DayRemainder / SECSPERHOUR);
|
||||
GmTime->tm_wday = (int) ((DayNo + 4) % 7);
|
||||
|
||||
for (Year = 1970, YearNo = 0; DayNo > 0; Year++) {
|
||||
TotalDays = (UINT16) (IsLeap (Year) ? 366 : 365);
|
||||
if (DayNo >= TotalDays) {
|
||||
DayNo = (UINT16) (DayNo - TotalDays);
|
||||
YearNo++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GmTime->tm_year = (int) (YearNo + (1970 - 1900));
|
||||
GmTime->tm_yday = (int) DayNo;
|
||||
|
||||
for (MonthNo = 12; MonthNo > 1; MonthNo--) {
|
||||
if (DayNo > CumulativeDays[IsLeap(Year)][MonthNo]) {
|
||||
DayNo = (UINT16) (DayNo - (UINT16) (CumulativeDays[IsLeap(Year)][MonthNo]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GmTime->tm_mon = (int) MonthNo;
|
||||
GmTime->tm_mday = (int) DayNo;
|
||||
|
||||
GmTime->tm_isdst = 0;
|
||||
GmTime->tm_gmtoff = 0;
|
||||
GmTime->tm_zone = NULL;
|
||||
|
||||
return GmTime;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Light-weight Memory Management Routines for OpenSSL-based Crypto
|
||||
Library at Runtime Phase.
|
||||
|
||||
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 2011, 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
|
||||
|
@ -38,7 +38,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
#define RT_PAGE_FREE 0x00000000
|
||||
#define RT_PAGE_USED 0x00000001
|
||||
|
||||
#define MIN_REQUIRED_BLOCKS 24
|
||||
#define MIN_REQUIRED_BLOCKS 600
|
||||
|
||||
//
|
||||
// Memory Page Table
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
C Run-Time Libraries (CRT) Time Management Routines Wrapper Implementation
|
||||
for OpenSSL-based Cryptographic Library (used in DXE & RUNTIME).
|
||||
|
||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2010 - 2011, 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
|
||||
|
@ -22,6 +22,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
//
|
||||
|
||||
#define IsLeap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
|
||||
#define SECSPERMIN (60)
|
||||
#define SECSPERHOUR (60 * 60)
|
||||
#define SECSPERDAY (24 * SECSPERHOUR)
|
||||
|
||||
|
@ -100,3 +101,65 @@ time_t time (time_t *timer)
|
|||
|
||||
return *timer;
|
||||
}
|
||||
|
||||
//
|
||||
// Convert a time value from type time_t to struct tm.
|
||||
//
|
||||
struct tm * gmtime (const time_t *timer)
|
||||
{
|
||||
struct tm *GmTime;
|
||||
UINT16 DayNo;
|
||||
UINT16 DayRemainder;
|
||||
time_t Year;
|
||||
time_t YearNo;
|
||||
UINT16 TotalDays;
|
||||
UINT16 MonthNo;
|
||||
|
||||
if (timer == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GmTime = malloc (sizeof (struct tm));
|
||||
if (GmTime == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ZeroMem ((VOID *) GmTime, (UINTN) sizeof (struct tm));
|
||||
|
||||
DayNo = (UINT16) (*timer / SECSPERDAY);
|
||||
DayRemainder = (UINT16) (*timer % SECSPERDAY);
|
||||
|
||||
GmTime->tm_sec = (int) (DayRemainder % SECSPERMIN);
|
||||
GmTime->tm_min = (int) ((DayRemainder % SECSPERHOUR) / SECSPERMIN);
|
||||
GmTime->tm_hour = (int) (DayRemainder / SECSPERHOUR);
|
||||
GmTime->tm_wday = (int) ((DayNo + 4) % 7);
|
||||
|
||||
for (Year = 1970, YearNo = 0; DayNo > 0; Year++) {
|
||||
TotalDays = (UINT16) (IsLeap (Year) ? 366 : 365);
|
||||
if (DayNo >= TotalDays) {
|
||||
DayNo = (UINT16) (DayNo - TotalDays);
|
||||
YearNo++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GmTime->tm_year = (int) (YearNo + (1970 - 1900));
|
||||
GmTime->tm_yday = (int) DayNo;
|
||||
|
||||
for (MonthNo = 12; MonthNo > 1; MonthNo--) {
|
||||
if (DayNo > CumulativeDays[IsLeap(Year)][MonthNo]) {
|
||||
DayNo = (UINT16) (DayNo - (UINT16) (CumulativeDays[IsLeap(Year)][MonthNo]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GmTime->tm_mon = (int) MonthNo;
|
||||
GmTime->tm_mday = (int) DayNo;
|
||||
|
||||
GmTime->tm_isdst = 0;
|
||||
GmTime->tm_gmtoff = 0;
|
||||
GmTime->tm_zone = NULL;
|
||||
|
||||
return GmTime;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue