]>
Commit | Line | Data |
---|---|---|
a23f76e1 QZ |
1 | /** @file\r |
2 | AEAD Wrapper Implementation which does not provide real capabilities.\r | |
3 | \r | |
4 | Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>\r | |
5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
6 | \r | |
7 | **/\r | |
8 | \r | |
9 | #include "InternalCryptLib.h"\r | |
10 | \r | |
11 | /**\r | |
12 | Performs AEAD AES-GCM authenticated encryption on a data buffer and additional authenticated data (AAD).\r | |
13 | \r | |
14 | IvSize must be 12, otherwise FALSE is returned.\r | |
15 | KeySize must be 16, 24 or 32, otherwise FALSE is returned.\r | |
16 | TagSize must be 12, 13, 14, 15, 16, otherwise FALSE is returned.\r | |
17 | \r | |
18 | @param[in] Key Pointer to the encryption key.\r | |
19 | @param[in] KeySize Size of the encryption key in bytes.\r | |
20 | @param[in] Iv Pointer to the IV value.\r | |
21 | @param[in] IvSize Size of the IV value in bytes.\r | |
22 | @param[in] AData Pointer to the additional authenticated data (AAD).\r | |
23 | @param[in] ADataSize Size of the additional authenticated data (AAD) in bytes.\r | |
24 | @param[in] DataIn Pointer to the input data buffer to be encrypted.\r | |
25 | @param[in] DataInSize Size of the input data buffer in bytes.\r | |
26 | @param[out] TagOut Pointer to a buffer that receives the authentication tag output.\r | |
27 | @param[in] TagSize Size of the authentication tag in bytes.\r | |
28 | @param[out] DataOut Pointer to a buffer that receives the encryption output.\r | |
29 | @param[out] DataOutSize Size of the output data buffer in bytes.\r | |
30 | \r | |
31 | @retval TRUE AEAD AES-GCM authenticated encryption succeeded.\r | |
32 | @retval FALSE AEAD AES-GCM authenticated encryption failed.\r | |
33 | \r | |
34 | **/\r | |
35 | BOOLEAN\r | |
36 | EFIAPI\r | |
37 | AeadAesGcmEncrypt (\r | |
38 | IN CONST UINT8 *Key,\r | |
39 | IN UINTN KeySize,\r | |
40 | IN CONST UINT8 *Iv,\r | |
41 | IN UINTN IvSize,\r | |
42 | IN CONST UINT8 *AData,\r | |
43 | IN UINTN ADataSize,\r | |
44 | IN CONST UINT8 *DataIn,\r | |
45 | IN UINTN DataInSize,\r | |
46 | OUT UINT8 *TagOut,\r | |
47 | IN UINTN TagSize,\r | |
48 | OUT UINT8 *DataOut,\r | |
49 | OUT UINTN *DataOutSize\r | |
50 | )\r | |
51 | {\r | |
52 | ASSERT (FALSE);\r | |
53 | return FALSE;\r | |
54 | }\r | |
55 | \r | |
56 | /**\r | |
57 | Performs AEAD AES-GCM authenticated decryption on a data buffer and additional authenticated data (AAD).\r | |
58 | \r | |
59 | IvSize must be 12, otherwise FALSE is returned.\r | |
60 | KeySize must be 16, 24 or 32, otherwise FALSE is returned.\r | |
61 | TagSize must be 12, 13, 14, 15, 16, otherwise FALSE is returned.\r | |
62 | If additional authenticated data verification fails, FALSE is returned.\r | |
63 | \r | |
64 | @param[in] Key Pointer to the encryption key.\r | |
65 | @param[in] KeySize Size of the encryption key in bytes.\r | |
66 | @param[in] Iv Pointer to the IV value.\r | |
67 | @param[in] IvSize Size of the IV value in bytes.\r | |
68 | @param[in] AData Pointer to the additional authenticated data (AAD).\r | |
69 | @param[in] ADataSize Size of the additional authenticated data (AAD) in bytes.\r | |
70 | @param[in] DataIn Pointer to the input data buffer to be decrypted.\r | |
71 | @param[in] DataInSize Size of the input data buffer in bytes.\r | |
72 | @param[in] Tag Pointer to a buffer that contains the authentication tag.\r | |
73 | @param[in] TagSize Size of the authentication tag in bytes.\r | |
74 | @param[out] DataOut Pointer to a buffer that receives the decryption output.\r | |
75 | @param[out] DataOutSize Size of the output data buffer in bytes.\r | |
76 | \r | |
77 | @retval TRUE AEAD AES-GCM authenticated decryption succeeded.\r | |
78 | @retval FALSE AEAD AES-GCM authenticated decryption failed.\r | |
79 | \r | |
80 | **/\r | |
81 | BOOLEAN\r | |
82 | EFIAPI\r | |
83 | AeadAesGcmDecrypt (\r | |
84 | IN CONST UINT8 *Key,\r | |
85 | IN UINTN KeySize,\r | |
86 | IN CONST UINT8 *Iv,\r | |
87 | IN UINTN IvSize,\r | |
88 | IN CONST UINT8 *AData,\r | |
89 | IN UINTN ADataSize,\r | |
90 | IN CONST UINT8 *DataIn,\r | |
91 | IN UINTN DataInSize,\r | |
92 | IN CONST UINT8 *Tag,\r | |
93 | IN UINTN TagSize,\r | |
94 | OUT UINT8 *DataOut,\r | |
95 | OUT UINTN *DataOutSize\r | |
96 | )\r | |
97 | {\r | |
98 | ASSERT (FALSE);\r | |
99 | return FALSE;\r | |
100 | }\r |