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