]>
Commit | Line | Data |
---|---|---|
d95de082 SB |
1 | /** @file\r |
2 | Diffie-Hellman Wrapper Implementation which does not provide\r | |
3 | real capabilities.\r | |
4 | \r | |
5 | Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>\r | |
6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
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 | |
19 | VOID *\r | |
20 | EFIAPI\r | |
21 | DhNew (\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 | |
37 | VOID\r | |
38 | EFIAPI\r | |
39 | DhFree (\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 | |
59 | BOOLEAN\r | |
60 | EFIAPI\r | |
61 | DhGenerateParameter (\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 | |
85 | BOOLEAN\r | |
86 | EFIAPI\r | |
87 | DhSetParameter (\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 | |
95 | return FALSE;\r | |
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 | |
111 | BOOLEAN\r | |
112 | EFIAPI\r | |
113 | DhGenerateKey (\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 | |
138 | BOOLEAN\r | |
139 | EFIAPI\r | |
140 | DhComputeKey (\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 |