Changeset 58466 in vbox for trunk/src/VBox/Devices/EFI/Firmware/CryptoPkg/Application
- Timestamp:
- Oct 29, 2015 4:30:44 AM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 103777
- Location:
- trunk/src/VBox/Devices/EFI/Firmware
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/Firmware
- Property svn:mergeinfo changed
/vendor/edk2/current merged: 103769-103776
- Property svn:mergeinfo changed
-
trunk/src/VBox/Devices/EFI/Firmware/CryptoPkg/Application/Cryptest/AuthenticodeVerify.c
r48674 r58466 1 /** @file 1 /** @file 2 2 Sample Implementation for Microsoft Authenticode Verification. 3 3 … … 20 20 // 21 21 GLOBAL_REMOVE_IF_UNREFERENCED UINT8 PeSha1Hash[] = { 22 0x44, 0xFD, 0x4F, 0xA9, 0x17, 0xEE, 0xAC, 0xCF, 0x1F, 0x0B, 0xE3, 0xA1, 0x4D, 0x5B, 0xA6, 0x61, 22 0x44, 0xFD, 0x4F, 0xA9, 0x17, 0xEE, 0xAC, 0xCF, 0x1F, 0x0B, 0xE3, 0xA1, 0x4D, 0x5B, 0xA6, 0x61, 23 23 0x82, 0x97, 0xC4, 0xB6 24 24 }; … … 34 34 // 35 35 // Sample Authenticode Data with SHA-1 hash algorithm. 36 // This data should be retrieved from signed PE/COFF image according to SECURITY 36 // This data should be retrieved from signed PE/COFF image according to SECURITY 37 37 // directory in PE/COFF Header. 38 38 // … … 169 169 0xE8, 0x28, 0x62, 0xC2, 0xF3, 0xC2, 0x23, 0xA6, 0x1C, 0x49, 0x82, 0x0B, 0xD5, 0x53, 0x30, 0x0E, 170 170 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, 0x07, 0x80, 0x30, 0x1F, 171 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x90, 0x8B, 0x11, 171 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x90, 0x8B, 0x11, 172 172 0xA5, 0x70, 0xED, 0xE0, 0xF9, 0xA9, 0xC0, 0xAC, 0x08, 0xC7, 0xB5, 0xF4, 0x82, 0xB1, 0x3C, 0xC5, 173 173 0x4A, 0x30, 0x7B, 0x06, 0x03, 0x55, 0x1D, 0x1F, 0x04, 0x74, 0x30, 0x72, 0x30, 0x70, 0xA0, 0x6E, … … 490 490 0x0E, 0x99, 0x1F, 0xDF, 0x7E, 0xC9, 0x10, 0x56, 0xC7, 0x00, 0x6D, 0x5F, 0x23, 0x57, 0x12, 0x84, 491 491 0xCD, 0xAC, 0x82, 0xAE, 0x39, 0x52, 0xA5, 0x19, 0x23, 0xA3, 0x6B, 0xE7, 0x49, 0x8F, 0x86, 0x74, 492 0x46, 0x41, 0x2A, 0x0F, 0x3D, 0x29, 0xB7, 0xAE, 0x8C, 0x00 492 0x46, 0x41, 0x2A, 0x0F, 0x3D, 0x29, 0xB7, 0xAE, 0x8C, 0x00 493 493 }; 494 494 495 495 // 496 496 // Sample Authenticode Data with SHA-256 hash algorithm. 497 // This data should be retrieved from signed PE/COFF image according to SECURITY 497 // This data should be retrieved from signed PE/COFF image according to SECURITY 498 498 // directory in PE/COFF Header. 499 499 // … … 740 740 741 741 // 742 // Sample root certificate for code signing. 743 // A trusted certificate with self-signing, will be used to construct the certificate chains for 742 // Sample root certificate for code signing. 743 // A trusted certificate with self-signing, will be used to construct the certificate chains for 744 744 // authority checking. 745 745 // … … 965 965 Status = FALSE; 966 966 Print (L"\n- PE/COFF Authenticode (Digested by SHA-1) Verification ... "); 967 967 968 968 // 969 969 // Sample Code: Demonstrate how to check the Hash algorithm in PE/COFF Authenticode. 970 // According to PKCS#7 Definition: 970 // According to PKCS#7 Definition: 971 971 // SignedData ::= SEQUENCE { 972 972 // version Version, … … 976 976 // The DigestAlgorithmIdentifiers can be used to determine the hash algorithm in PE/COFF hashing 977 977 // This field has the fixed offset (+32) in final Authenticode ASN.1 data. 978 // 978 // 979 979 if (CompareMem (AuthenticodeWithSha1 + 32, &HashOidValue[8], 5) == 0) { 980 980 // 981 // Verify Authenticode signature. 981 // Verify Authenticode signature. 982 982 // The PeHash value should be calculated following MSFT's Authenticode Specification. 983 983 // … … 994 994 } else { 995 995 Print (L"[Fail]"); 996 } 996 } 997 997 } else { 998 998 Print (L"[Invalid Hash]"); … … 1015 1015 } else { 1016 1016 Print (L"[Fail]"); 1017 } 1017 } 1018 1018 } else { 1019 1019 Print (L"[Invalid Hash]"); -
trunk/src/VBox/Devices/EFI/Firmware/CryptoPkg/Application/Cryptest/BlockCipherVerify.c
r48674 r58466 1 /** @file 1 /** @file 2 2 Application for Block Cipher Primitives Validation. 3 3 … … 42 42 43 43 GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesCbcKey[] = { 44 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 44 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 45 45 0xf1, 0xe0, 0xd3, 0xc2, 0xb5, 0xa4, 0x97, 0x86, 46 46 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 … … 223 223 Print (L"[Fail]"); 224 224 return EFI_ABORTED; 225 } 225 } 226 226 227 227 if (CompareMem (Decrypt, TdesEcbData, 8) != 0) { … … 272 272 CtxSize = AesGetContextSize (); 273 273 CipherCtx = AllocatePool (CtxSize); 274 274 275 275 Print (L"\n- AES Validation: "); 276 276 … … 304 304 Print (L"[Fail]"); 305 305 return EFI_ABORTED; 306 } 306 } 307 307 308 308 if (CompareMem (Decrypt, Aes128EcbData, sizeof (Aes128EcbData)) != 0) { -
trunk/src/VBox/Devices/EFI/Firmware/CryptoPkg/Application/Cryptest/Cryptest.inf
r58459 r58466 9 9 # which accompanies this distribution. The full text of the license may be found at 10 10 # http://opensource.org/licenses/bsd-license.php 11 # 11 # 12 12 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 13 13 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 14 # 14 # 15 15 ## 16 16 … … 42 42 DhVerify.c 43 43 RandVerify.c 44 44 45 45 [Packages] 46 46 MdePkg/MdePkg.dec … … 59 59 [UserExtensions.TianoCore."ExtraFiles"] 60 60 CryptestExtra.uni 61 61 -
trunk/src/VBox/Devices/EFI/Firmware/CryptoPkg/Application/Cryptest/HmacVerify.c
r48674 r58466 1 /** @file 1 /** @file 2 2 Application for HMAC Primitives Validation. 3 3 -
trunk/src/VBox/Devices/EFI/Firmware/CryptoPkg/Application/Cryptest/RandVerify.c
r48674 r58466 1 /** @file 1 /** @file 2 2 Application for Pseudorandom Number Generator Validation. 3 3 -
trunk/src/VBox/Devices/EFI/Firmware/CryptoPkg/Application/Cryptest/RsaVerify.c
r48674 r58466 1 /** @file 1 /** @file 2 2 Application for RSA Primitives Validation. 3 3 … … 25 25 // 26 26 GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 RsaN[] = { 27 0xBB, 0xF8, 0x2F, 0x09, 0x06, 0x82, 0xCE, 0x9C, 0x23, 0x38, 0xAC, 0x2B, 0x9D, 0xA8, 0x71, 0xF7, 27 0xBB, 0xF8, 0x2F, 0x09, 0x06, 0x82, 0xCE, 0x9C, 0x23, 0x38, 0xAC, 0x2B, 0x9D, 0xA8, 0x71, 0xF7, 28 28 0x36, 0x8D, 0x07, 0xEE, 0xD4, 0x10, 0x43, 0xA4, 0x40, 0xD6, 0xB6, 0xF0, 0x74, 0x54, 0xF5, 0x1F, 29 29 0xB8, 0xDF, 0xBA, 0xAF, 0x03, 0x5C, 0x02, 0xAB, 0x61, 0xEA, 0x48, 0xCE, 0xEB, 0x6F, 0xCD, 0x48, … … 235 235 return EFI_ABORTED; 236 236 } 237 237 238 238 if (KeySize != 3 || 239 239 CompareMem (KeyBuffer, DefaultPublicKey, 3) != 0) { … … 300 300 301 301 // 302 // SHA-1 Digest Message for PKCS#1 Signature 302 // SHA-1 Digest Message for PKCS#1 Signature 303 303 // 304 304 Print (L"Hash Original Message ... "); -
trunk/src/VBox/Devices/EFI/Firmware/CryptoPkg/Application/Cryptest/RsaVerify2.c
r48674 r58466 1 /** @file 1 /** @file 2 2 Application for RSA Key Retrieving (from PEM and X509) & Signature Validation. 3 3 … … 73 73 0x13, 0x05, 0x49, 0x4e, 0x54, 0x45, 0x4c, 0x31, 0x0c, 0x30, 0x0a, 0x06, 0x03, 0x55, 0x04, 0x0b, 74 74 0x13, 0x03, 0x50, 0x53, 0x49, 0x31, 0x0d, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x04, 75 0x55, 0x45, 0x46, 0x49, 0x31, 0x1b, 0x30, 0x19, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 75 0x55, 0x45, 0x46, 0x49, 0x31, 0x1b, 0x30, 0x19, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 76 76 0x01, 0x09, 0x01, 0x16, 0x0c, 0x75, 0x65, 0x66, 0x69, 0x40, 0x70, 0x73, 0x69, 0x2e, 0x63, 0x6f, 77 77 0x6d, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x30, 0x31, 0x30, 0x30, 0x38, 0x31, 0x38, 0x31, 0x35, 0x33, … … 346 346 347 347 // 348 // Create PKCS#7 signedData on Payload. 348 // Create PKCS#7 signedData on Payload. 349 349 // Note: Caller should release P7SignedData manually. 350 350 // -
trunk/src/VBox/Devices/EFI/Firmware/CryptoPkg/Application/Cryptest/TSVerify.c
r58464 r58466 17 17 // 18 18 // Sample Authenticode Data with RFC3161 time stamping signature. 19 // The data retrieved from one signed sample UEFI image, which is generated by MSFT's signtool 19 // The data retrieved from one signed sample UEFI image, which is generated by MSFT's signtool 20 20 // utility in conjunction with RFC3161 timestamping, as the following command: 21 // signtool sign /ac <xxx.cer> / f <xxx.pfx> /p <pass> /fd <digestAlg> 21 // signtool sign /ac <xxx.cer> / f <xxx.pfx> /p <pass> /fd <digestAlg> 22 22 // /tr http://timestamp.comodoca.com/rfc3161 sample.efi 23 23 //
Note:
See TracChangeset
for help on using the changeset viewer.