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