]>
Commit | Line | Data |
---|---|---|
532616bb | 1 | /** @file\r |
2 | PKCS#7 SignedData Verification Wrapper Implementation which does not provide\r | |
3 | real capabilities.\r | |
4 | \r | |
afeb55e4 | 5 | Copyright (c) 2012 - 2015, Intel Corporation. All rights reserved.<BR>\r |
532616bb | 6 | This program and the accompanying materials\r |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #include "InternalCryptLib.h"\r | |
17 | \r | |
18 | /**\r | |
19 | Get the signer's certificates from PKCS#7 signed data as described in "PKCS #7:\r | |
20 | Cryptographic Message Syntax Standard". The input signed data could be wrapped\r | |
21 | in a ContentInfo structure.\r | |
22 | \r | |
23 | Return FALSE to indicate this interface is not supported.\r | |
24 | \r | |
25 | @param[in] P7Data Pointer to the PKCS#7 message to verify.\r | |
26 | @param[in] P7Length Length of the PKCS#7 message in bytes.\r | |
27 | @param[out] CertStack Pointer to Signer's certificates retrieved from P7Data.\r | |
28 | It's caller's responsiblity to free the buffer.\r | |
29 | @param[out] StackLength Length of signer's certificates in bytes.\r | |
30 | @param[out] TrustedCert Pointer to a trusted certificate from Signer's certificates.\r | |
31 | It's caller's responsiblity to free the buffer.\r | |
32 | @param[out] CertLength Length of the trusted certificate in bytes.\r | |
33 | \r | |
34 | @retval FALSE This interface is not supported.\r | |
35 | \r | |
36 | **/\r | |
37 | BOOLEAN\r | |
38 | EFIAPI\r | |
39 | Pkcs7GetSigners (\r | |
40 | IN CONST UINT8 *P7Data,\r | |
41 | IN UINTN P7Length,\r | |
42 | OUT UINT8 **CertStack,\r | |
43 | OUT UINTN *StackLength,\r | |
44 | OUT UINT8 **TrustedCert,\r | |
45 | OUT UINTN *CertLength\r | |
46 | )\r | |
47 | {\r | |
48 | ASSERT (FALSE);\r | |
49 | return FALSE;\r | |
50 | }\r | |
51 | \r | |
52 | /**\r | |
53 | Wrap function to use free() to free allocated memory for certificates.\r | |
54 | \r | |
55 | If the interface is not supported, then ASSERT().\r | |
56 | \r | |
57 | @param[in] Certs Pointer to the certificates to be freed.\r | |
58 | \r | |
59 | **/\r | |
60 | VOID\r | |
61 | EFIAPI\r | |
62 | Pkcs7FreeSigners (\r | |
63 | IN UINT8 *Certs\r | |
64 | )\r | |
65 | {\r | |
66 | ASSERT (FALSE);\r | |
67 | }\r | |
68 | \r | |
69 | /**\r | |
70 | Verifies the validility of a PKCS#7 signed data as described in "PKCS #7:\r | |
71 | Cryptographic Message Syntax Standard". The input signed data could be wrapped\r | |
72 | in a ContentInfo structure.\r | |
73 | \r | |
74 | Return FALSE to indicate this interface is not supported.\r | |
75 | \r | |
76 | @param[in] P7Data Pointer to the PKCS#7 message to verify.\r | |
77 | @param[in] P7Length Length of the PKCS#7 message in bytes.\r | |
78 | @param[in] TrustedCert Pointer to a trusted/root certificate encoded in DER, which\r | |
79 | is used for certificate chain verification.\r | |
80 | @param[in] CertLength Length of the trusted certificate in bytes.\r | |
81 | @param[in] InData Pointer to the content to be verified.\r | |
82 | @param[in] DataLength Length of InData in bytes.\r | |
83 | \r | |
84 | @retval FALSE This interface is not supported.\r | |
85 | \r | |
86 | **/\r | |
87 | BOOLEAN\r | |
88 | EFIAPI\r | |
89 | Pkcs7Verify (\r | |
90 | IN CONST UINT8 *P7Data,\r | |
91 | IN UINTN P7Length,\r | |
92 | IN CONST UINT8 *TrustedCert,\r | |
93 | IN UINTN CertLength,\r | |
94 | IN CONST UINT8 *InData,\r | |
95 | IN UINTN DataLength\r | |
96 | )\r | |
97 | {\r | |
98 | ASSERT (FALSE);\r | |
99 | return FALSE;\r | |
100 | }\r | |
afeb55e4 QL |
101 | \r |
102 | /**\r | |
103 | Extracts the attached content from a PKCS#7 signed data if existed. The input signed\r | |
104 | data could be wrapped in a ContentInfo structure.\r | |
105 | \r | |
106 | Return FALSE to indicate this interface is not supported.\r | |
107 | \r | |
108 | @param[in] P7Data Pointer to the PKCS#7 signed data to process.\r | |
109 | @param[in] P7Length Length of the PKCS#7 signed data in bytes.\r | |
110 | @param[out] Content Pointer to the extracted content from the PKCS#7 signedData.\r | |
111 | It's caller's responsiblity to free the buffer.\r | |
112 | @param[out] ContentSize The size of the extracted content in bytes.\r | |
113 | \r | |
114 | @retval TRUE The P7Data was correctly formatted for processing.\r | |
115 | @retval FALSE The P7Data was not correctly formatted for processing.\r | |
116 | \r | |
b134fe98 | 117 | **/\r |
afeb55e4 QL |
118 | BOOLEAN\r |
119 | EFIAPI\r | |
120 | Pkcs7GetAttachedContent (\r | |
121 | IN CONST UINT8 *P7Data,\r | |
122 | IN UINTN P7Length,\r | |
123 | OUT VOID **Content,\r | |
124 | OUT UINTN *ContentSize\r | |
125 | )\r | |
126 | {\r | |
127 | ASSERT (FALSE);\r | |
128 | return FALSE;\r | |
129 | }\r |