]> git.proxmox.com Git - mirror_edk2.git/blame - CryptoPkg/Library/BaseCryptLib/Pk/CryptDhNull.c
CryptoPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / CryptoPkg / Library / BaseCryptLib / Pk / CryptDhNull.c
CommitLineData
532616bb 1/** @file\r
2 Diffie-Hellman Wrapper Implementation which does not provide\r
3 real capabilities.\r
4\r
630f67dd 5Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>\r
2009f6b4 6SPDX-License-Identifier: BSD-2-Clause-Patent\r
532616bb 7\r
8**/\r
9\r
10#include "InternalCryptLib.h"\r
11\r
12/**\r
13 Allocates and Initializes one Diffie-Hellman Context for subsequent use.\r
14\r
15 @return Pointer to the Diffie-Hellman Context that has been initialized.\r
16 If the interface is not supported, DhNew() returns NULL.\r
17\r
18**/\r
19VOID *\r
20EFIAPI\r
21DhNew (\r
22 VOID\r
23 )\r
24{\r
25 ASSERT (FALSE);\r
26 return NULL;\r
27}\r
28\r
29/**\r
30 Release the specified DH context.\r
31\r
32 If the interface is not supported, then ASSERT().\r
33\r
34 @param[in] DhContext Pointer to the DH context to be released.\r
35\r
36**/\r
37VOID\r
38EFIAPI\r
39DhFree (\r
40 IN VOID *DhContext\r
41 )\r
42{\r
43 ASSERT (FALSE);\r
44}\r
45\r
46/**\r
47 Generates DH parameter.\r
48\r
49 Return FALSE to indicate this interface is not supported.\r
50\r
51 @param[in, out] DhContext Pointer to the DH context.\r
52 @param[in] Generator Value of generator.\r
53 @param[in] PrimeLength Length in bits of prime to be generated.\r
54 @param[out] Prime Pointer to the buffer to receive the generated prime number.\r
55\r
56 @retval FALSE This interface is not supported.\r
57\r
58**/\r
59BOOLEAN\r
60EFIAPI\r
61DhGenerateParameter (\r
62 IN OUT VOID *DhContext,\r
63 IN UINTN Generator,\r
64 IN UINTN PrimeLength,\r
65 OUT UINT8 *Prime\r
66 )\r
67{\r
68 ASSERT (FALSE);\r
69 return FALSE;\r
70}\r
71\r
72/**\r
73 Sets generator and prime parameters for DH.\r
74\r
75 Return FALSE to indicate this interface is not supported.\r
76\r
77 @param[in, out] DhContext Pointer to the DH context.\r
78 @param[in] Generator Value of generator.\r
79 @param[in] PrimeLength Length in bits of prime to be generated.\r
80 @param[in] Prime Pointer to the prime number.\r
81\r
82 @retval FALSE This interface is not supported.\r
83\r
84**/\r
85BOOLEAN\r
86EFIAPI\r
87DhSetParameter (\r
88 IN OUT VOID *DhContext,\r
89 IN UINTN Generator,\r
90 IN UINTN PrimeLength,\r
91 IN CONST UINT8 *Prime\r
92 )\r
93{\r
94 ASSERT (FALSE);\r
630f67dd 95 return FALSE;\r
532616bb 96}\r
97\r
98/**\r
99 Generates DH public key.\r
100\r
101 Return FALSE to indicate this interface is not supported.\r
102\r
103 @param[in, out] DhContext Pointer to the DH context.\r
104 @param[out] PublicKey Pointer to the buffer to receive generated public key.\r
105 @param[in, out] PublicKeySize On input, the size of PublicKey buffer in bytes.\r
106 On output, the size of data returned in PublicKey buffer in bytes.\r
107\r
108 @retval FALSE This interface is not supported.\r
109\r
110**/\r
111BOOLEAN\r
112EFIAPI\r
113DhGenerateKey (\r
114 IN OUT VOID *DhContext,\r
115 OUT UINT8 *PublicKey,\r
116 IN OUT UINTN *PublicKeySize\r
117 )\r
118{\r
119 ASSERT (FALSE);\r
120 return FALSE;\r
121}\r
122\r
123/**\r
124 Computes exchanged common key.\r
125\r
126 Return FALSE to indicate this interface is not supported.\r
127\r
128 @param[in, out] DhContext Pointer to the DH context.\r
129 @param[in] PeerPublicKey Pointer to the peer's public key.\r
130 @param[in] PeerPublicKeySize Size of peer's public key in bytes.\r
131 @param[out] Key Pointer to the buffer to receive generated key.\r
132 @param[in, out] KeySize On input, the size of Key buffer in bytes.\r
133 On output, the size of data returned in Key buffer in bytes.\r
134\r
135 @retval FALSE This interface is not supported.\r
136\r
137**/\r
138BOOLEAN\r
139EFIAPI\r
140DhComputeKey (\r
141 IN OUT VOID *DhContext,\r
142 IN CONST UINT8 *PeerPublicKey,\r
143 IN UINTN PeerPublicKeySize,\r
144 OUT UINT8 *Key,\r
145 IN OUT UINTN *KeySize\r
146 )\r
147{\r
148 ASSERT (FALSE);\r
149 return FALSE;\r
150}\r