TianoCore EDK2 master
Loading...
Searching...
No Matches
OaepEncryptTests.c
Go to the documentation of this file.
1
9#include "TestBaseCryptLib.h"
10
11STATIC CONST UINT8 RandSeed[] = "This is the random seed for PRNG verification.";
12
13//
14// Self signed X509 certificate
15// CN = ca.self
16// O = Intel
17//
18GLOBAL_REMOVE_IF_UNREFERENCED STATIC CONST UINT8 SelfTestCert[] = {
19 0x30, 0x82, 0x03, 0x90, 0x30, 0x82, 0x02, 0x78, 0x02, 0x09, 0x00, 0xE4, 0xDF, 0x47, 0x80, 0xEF,
20 0x4B, 0x3C, 0x6D, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B,
21 0x05, 0x00, 0x30, 0x81, 0x89, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02,
22 0x43, 0x4E, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x08, 0x53, 0x68, 0x61,
23 0x6E, 0x67, 0x48, 0x61, 0x69, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x08,
24 0x53, 0x68, 0x61, 0x6E, 0x67, 0x48, 0x61, 0x69, 0x31, 0x0E, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x04,
25 0x0A, 0x0C, 0x05, 0x49, 0x6E, 0x74, 0x65, 0x6C, 0x31, 0x0C, 0x30, 0x0A, 0x06, 0x03, 0x55, 0x04,
26 0x0B, 0x0C, 0x03, 0x46, 0x49, 0x45, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C,
27 0x07, 0x63, 0x61, 0x2E, 0x73, 0x65, 0x6C, 0x66, 0x31, 0x24, 0x30, 0x22, 0x06, 0x09, 0x2A, 0x86,
28 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x15, 0x7A, 0x68, 0x69, 0x63, 0x68, 0x61, 0x6F,
29 0x2E, 0x67, 0x61, 0x6F, 0x40, 0x69, 0x6E, 0x74, 0x65, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x1E,
30 0x17, 0x0D, 0x31, 0x39, 0x30, 0x33, 0x32, 0x37, 0x30, 0x35, 0x35, 0x37, 0x30, 0x39, 0x5A, 0x17,
31 0x0D, 0x32, 0x30, 0x30, 0x33, 0x32, 0x36, 0x30, 0x35, 0x35, 0x37, 0x30, 0x39, 0x5A, 0x30, 0x81,
32 0x89, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43, 0x4E, 0x31, 0x11,
33 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x08, 0x53, 0x68, 0x61, 0x6E, 0x67, 0x48, 0x61,
34 0x69, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x08, 0x53, 0x68, 0x61, 0x6E,
35 0x67, 0x48, 0x61, 0x69, 0x31, 0x0E, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x05, 0x49,
36 0x6E, 0x74, 0x65, 0x6C, 0x31, 0x0C, 0x30, 0x0A, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x03, 0x46,
37 0x49, 0x45, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x07, 0x63, 0x61, 0x2E,
38 0x73, 0x65, 0x6C, 0x66, 0x31, 0x24, 0x30, 0x22, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D,
39 0x01, 0x09, 0x01, 0x16, 0x15, 0x7A, 0x68, 0x69, 0x63, 0x68, 0x61, 0x6F, 0x2E, 0x67, 0x61, 0x6F,
40 0x40, 0x69, 0x6E, 0x74, 0x65, 0x6C, 0x2E, 0x63, 0x6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x36, 0x20, 0x06, 0xE6, 0xA7, 0x24, 0x22, 0xB0, 0xB1, 0xC4, 0xBC, 0x2C,
75 0x5C, 0xCE, 0x92, 0x11, 0xFF, 0x6F, 0x8C, 0x14, 0x7E, 0xC4, 0x10, 0x02, 0xF6, 0x69, 0x86, 0x6D,
76 0x5B, 0x64, 0x81, 0x13,
77};
78
79GLOBAL_REMOVE_IF_UNREFERENCED STATIC CONST UINT8 PrivateKey[] = {
80 0x30, 0x82, 0x04, 0xA4, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, 0x01, 0x00, 0xBC, 0xE4, 0x67, 0xDC,
81 0xC7, 0xEA, 0x6F, 0x8A, 0xA7, 0xCC, 0xB2, 0x54, 0x47, 0x48, 0x6A, 0xE2, 0x39, 0xFF, 0xC2, 0x48,
82 0x58, 0x34, 0x07, 0x03, 0x6D, 0x39, 0xB3, 0x67, 0x46, 0x4C, 0xBC, 0xA0, 0xFA, 0x4E, 0x64, 0x23,
83 0x56, 0x47, 0x7B, 0xC9, 0x1A, 0x2A, 0x55, 0x42, 0x54, 0x10, 0x18, 0x30, 0x92, 0x60, 0x30, 0x5B,
84 0x9E, 0xC0, 0x65, 0xD2, 0xD4, 0x05, 0x4A, 0xA6, 0x10, 0x66, 0x04, 0xA9, 0x54, 0x4E, 0xEE, 0x49,
85 0x39, 0x43, 0x65, 0x1E, 0x2E, 0x28, 0xDE, 0x79, 0x24, 0xA9, 0x7E, 0xD8, 0x5B, 0xBC, 0x2F, 0x46,
86 0x6A, 0xB7, 0xB6, 0x0D, 0x17, 0x88, 0x37, 0x52, 0x5C, 0xFE, 0x93, 0xC0, 0xE2, 0xFD, 0x6A, 0x08,
87 0x1B, 0xFB, 0xD1, 0x87, 0xBD, 0xBD, 0x58, 0x57, 0x2C, 0x06, 0x5D, 0xD2, 0x7D, 0x52, 0xE2, 0x49,
88 0x8E, 0xDC, 0xE5, 0x26, 0xBD, 0x92, 0x60, 0xB0, 0x3F, 0x58, 0x5E, 0x52, 0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2, 0x64, 0x2F, 0x07,
145 0xEF, 0xB0, 0xA0, 0x71, 0xFD, 0x8F, 0xBD, 0x99, 0xB3, 0x83, 0x80, 0x24, 0x3C, 0x19, 0xE5, 0x42,
146 0x77, 0xD9, 0xA0, 0x3D, 0x02, 0x81, 0x81, 0x00, 0xB7, 0x35, 0xE9, 0x66, 0x4A, 0xCD, 0x5F, 0x5C,
147 0x44, 0x9A, 0x7F, 0x23, 0xAE, 0xC2, 0x7F, 0xF0, 0x8D, 0xE4, 0xDB, 0xCD, 0x1A, 0x8A, 0x40, 0xD7,
148 0x0A, 0xC4, 0x3E, 0xC5, 0x03, 0xFB, 0x47, 0xAB, 0x72, 0xDF, 0xD7, 0x68, 0x27, 0x6E, 0x86, 0x94,
149 0x2A, 0x2A, 0xDA, 0x25, 0x9E, 0xF6, 0x5E, 0xE0, 0x6D, 0x7C, 0x7D, 0xFE, 0x72, 0xDD, 0xC7, 0xBC,
150 0x74, 0xC7, 0xAD, 0xEA, 0x44, 0xBE, 0x5C, 0x8A, 0x03, 0xCD, 0x35, 0x74, 0x6F, 0x4E, 0x92, 0x31,
151 0xBE, 0x57, 0x9A, 0x02, 0x0C, 0xFC, 0xD1, 0xD5, 0xE7, 0x3E, 0x53, 0x0C, 0x47, 0x12, 0x39, 0x45,
152 0x6E, 0x35, 0x24, 0xA6, 0xDA, 0x42, 0x63, 0xC6, 0xBF, 0xCA, 0xE8, 0x32, 0xFD, 0x61, 0xC0, 0x80,
153 0x39, 0xD2, 0xB7, 0x0D, 0xF3, 0xA2, 0xF3, 0xE4, 0x49, 0x26, 0x89, 0xD0, 0xA0, 0x24, 0xC8, 0x27,
154 0x86, 0x10, 0x09, 0x88, 0x6C, 0x35, 0x60, 0xF2,
155};
156
157// The following RSA key componets were extracted from the above private key with openssl.
159 0x00,
160 0xbc,0xe4, 0x67, 0xdc, 0xc7, 0xea, 0x6f, 0x8a, 0xa7, 0xcc, 0xb2, 0x54, 0x47, 0x48, 0x6a, 0xe2,
161 0x39,0xff, 0xc2, 0x48, 0x58, 0x34, 0x07, 0x03, 0x6d, 0x39, 0xb3, 0x67, 0x46, 0x4c, 0xbc, 0xa0,
162 0xfa,0x4e, 0x64, 0x23, 0x56, 0x47, 0x7b, 0xc9, 0x1a, 0x2a, 0x55, 0x42, 0x54, 0x10, 0x18, 0x30,
163 0x92,0x60, 0x30, 0x5b, 0x9e, 0xc0, 0x65, 0xd2, 0xd4, 0x05, 0x4a, 0xa6, 0x10, 0x66, 0x04, 0xa9,
164 0x54,0x4e, 0xee, 0x49, 0x39, 0x43, 0x65, 0x1e, 0x2e, 0x28, 0xde, 0x79, 0x24, 0xa9, 0x7e, 0xd8,
165 0x5b,0xbc, 0x2f, 0x46, 0x6a, 0xb7, 0xb6, 0x0d, 0x17, 0x88, 0x37, 0x52, 0x5c, 0xfe, 0x93, 0xc0,
166 0xe2,0xfd, 0x6a, 0x08, 0x1b, 0xfb, 0xd1, 0x87, 0xbd, 0xbd, 0x58, 0x57, 0x2c, 0x06, 0x5d, 0xd2,
167 0x7d,0x52, 0xe2, 0x49, 0x8e, 0xdc, 0xe5, 0x26, 0xbd, 0x92, 0x60, 0xb0, 0x3f, 0x58, 0x5e, 0x52,
168 0xd7,0x91, 0xda, 0x93, 0x62, 0x8d, 0x71, 0x80, 0x53, 0xba, 0x15, 0xc4, 0x1f, 0xf3, 0xbd, 0xe0,
169 0xc5,0xa4, 0xb8, 0xd3, 0x64, 0x12, 0x14, 0x1b, 0x11, 0x6b, 0x7b, 0xc2, 0x92, 0xc7, 0xe2, 0x94,
170 0x0b,0xb8, 0x67, 0x38, 0x48, 0x63, 0x11, 0x74, 0x25, 0x7c, 0x37, 0xc3, 0xb2, 0xae, 0xd9, 0xa7,
171 0x17,0x9c, 0x4b, 0x9d, 0x6c, 0x27, 0xb0, 0x87, 0x16, 0x6b, 0xf2, 0x96, 0xe5, 0x1d, 0x37, 0x27,
172 0xde,0xf2, 0x98, 0xb7, 0x81, 0x08, 0xd9, 0x7a, 0xba, 0x84, 0x14, 0x61, 0x60, 0x48, 0xce, 0xce,
173 0x51,0x73, 0xf4, 0xdb, 0xf1, 0x5f, 0x7a, 0x17, 0x71, 0x4f, 0xc1, 0x0b, 0xce, 0xc7, 0x31, 0xc1,
174 0x4e,0xa3, 0xee, 0x6f, 0x72, 0x97, 0x90, 0xfb, 0x8b, 0x54, 0x9f, 0x82, 0x5b, 0x48, 0x5a, 0xf1,
175 0xad,0x8b, 0x3a, 0xcd, 0xca, 0xb2, 0x8b, 0x7a, 0x53, 0xd4, 0xf7, 0x71, 0x16, 0x75, 0xa7, 0x35,
176};
177
179 0x01, 0x00, 0x01
180};
181
183 0x13, 0xf7, 0xd1, 0x42, 0xf5, 0x9f, 0x42, 0xcb, 0x55, 0x91, 0xbe, 0x08, 0x4a, 0xc0, 0xcd, 0x0b,
184 0xbd, 0x35, 0xdc, 0x43, 0xe9, 0x8f, 0x16, 0x6e, 0xb6, 0x4d, 0x33, 0x39, 0xe7, 0xa4, 0x95, 0x0c,
185 0x2f, 0x69, 0xba, 0x0c, 0x42, 0x42, 0xac, 0x43, 0x46, 0x10, 0xd3, 0x92, 0x7f, 0x70, 0x74, 0x1e,
186 0x2e, 0x5b, 0x1c, 0xc1, 0x92, 0xb6, 0xa4, 0x0c, 0xf5, 0x7c, 0xd9, 0xb7, 0x54, 0x64, 0x74, 0x79,
187 0xb1, 0xff, 0xe6, 0x10, 0xb7, 0x8c, 0xf8, 0x53, 0x88, 0x6d, 0xa9, 0x97, 0x04, 0xd9, 0x26, 0x1f,
188 0x99, 0x12, 0xfb, 0xac, 0x65, 0xfb, 0xa5, 0xb3, 0x1c, 0x99, 0xb9, 0xbf, 0x6b, 0x35, 0x3e, 0x49,
189 0x55, 0xb5, 0x94, 0x4f, 0xe7, 0x25, 0x67, 0xb1, 0x01, 0xcd, 0xd2, 0x58, 0xe4, 0xbe, 0x87, 0x8c,
190 0x88, 0xd3, 0x0a, 0x38, 0xdc, 0x71, 0x5d, 0x88, 0x0a, 0xe2, 0x3e, 0x76, 0x63, 0x3b, 0xe4, 0x3c,
191 0x8f, 0x2f, 0x29, 0x1d, 0xd1, 0x66, 0x8d, 0xc0, 0x4a, 0x68, 0x15, 0x90, 0x4c, 0x95, 0x61, 0xf4,
192 0xfd, 0xe8, 0xfa, 0x9c, 0x6c, 0x00, 0x22, 0x23, 0xd5, 0x17, 0x6e, 0xee, 0xa8, 0xd8, 0x70, 0xc5,
193 0x74, 0xea, 0x09, 0x13, 0x7f, 0x0c, 0x37, 0x4d, 0x50, 0xcd, 0xe9, 0x16, 0xc2, 0xd5, 0xde, 0x5e,
194 0xc3, 0xfc, 0x46, 0x08, 0xf1, 0x99, 0xc0, 0xb4, 0x28, 0xfd, 0x2b, 0x29, 0xef, 0x76, 0xd7, 0x04,
195 0x4f, 0x02, 0x54, 0x16, 0x54, 0x55, 0x20, 0xec, 0xbc, 0xbf, 0x85, 0x5f, 0x12, 0xcc, 0xfc, 0x0d,
196 0xf2, 0xef, 0xfc, 0x4d, 0x3e, 0xa2, 0x5e, 0x97, 0xfe, 0x35, 0x10, 0x0f, 0x53, 0x1f, 0x80, 0xd5,
197 0xc0, 0xb4, 0xe9, 0xe9, 0x31, 0x4c, 0x89, 0x14, 0x72, 0x39, 0x65, 0x89, 0xef, 0x7a, 0x51, 0x4a,
198 0xb9, 0xa9, 0xcc, 0x1b, 0x52, 0xb0, 0x02, 0x52, 0x65, 0x2f, 0x0b, 0x89, 0x41, 0x70, 0x1e, 0x01,
199};
200
201// test case = "123\0"
203 0x31, 0x32, 0x33, 0x00
204};
205
206// Ciphertext of the test case using RSAES-OAEP2048 with SHA1 MD/BGF1 created with openssl.
207GLOBAL_REMOVE_IF_UNREFERENCED STATIC CONST UINT8 Ct1230RsaesOaepMdSha1Mgf1Sha1[] = {
208 0x88, 0x5d, 0xf3, 0x00, 0x66, 0x77, 0x91, 0x94, 0x5c, 0x8d, 0x45, 0xb6, 0xb2, 0x24, 0x26, 0x26,
209 0x37, 0xbe, 0xe0, 0x87, 0x4f, 0x50, 0xbf, 0x88, 0xde, 0x5d, 0xe9, 0xe0, 0xb2, 0x7e, 0x66, 0xfa,
210 0x6c, 0xfd, 0x0d, 0x19, 0x48, 0x41, 0xfe, 0x7a, 0x86, 0xa8, 0x28, 0xc2, 0x01, 0xcf, 0x76, 0xd7,
211 0xea, 0xab, 0x6d, 0xc3, 0x5e, 0x2c, 0x36, 0x04, 0xc0, 0x54, 0xc2, 0x68, 0x67, 0xe7, 0x04, 0x27,
212 0x56, 0xbe, 0x53, 0xb5, 0x80, 0x94, 0xd8, 0xde, 0x8c, 0x75, 0x69, 0x42, 0xba, 0x55, 0xd6, 0x2c,
213 0xda, 0x22, 0xe6, 0x09, 0xf6, 0x90, 0x27, 0x4b, 0x10, 0x54, 0x40, 0xa0, 0x74, 0x31, 0xdb, 0x5f,
214 0x80, 0x06, 0xc7, 0x67, 0x96, 0xe8, 0x45, 0xea, 0x7f, 0x72, 0x18, 0x24, 0xe8, 0x0d, 0x46, 0xc2,
215 0xa0, 0x83, 0xca, 0x71, 0xca, 0x91, 0x4b, 0x89, 0x80, 0x61, 0x01, 0x8e, 0xcf, 0xa1, 0x68, 0x81,
216 0x2d, 0xf2, 0x08, 0xd2, 0x02, 0x9e, 0xc0, 0xa4, 0x91, 0x71, 0x90, 0x84, 0x2f, 0x4e, 0x18, 0x37,
217 0x9b, 0x61, 0x0b, 0xf5, 0x88, 0xf7, 0x6b, 0x87, 0xb9, 0x4e, 0x31, 0xda, 0xf3, 0xb5, 0xe2, 0x60,
218 0x4d, 0xd9, 0x52, 0x99, 0x6b, 0x19, 0x98, 0xa2, 0x28, 0xaa, 0xeb, 0x5a, 0x33, 0xef, 0xf1, 0x4e,
219 0x29, 0x86, 0xbf, 0x70, 0x08, 0xfd, 0x34, 0x8a, 0x8c, 0x6d, 0xef, 0xc4, 0xa1, 0xfe, 0xdf, 0x4d,
220 0xeb, 0xf0, 0x2c, 0x4c, 0xf5, 0xb3, 0xe8, 0xf8, 0xc3, 0x45, 0xc7, 0x6b, 0x59, 0x1c, 0x9b, 0xd9,
221 0x52, 0xdf, 0x65, 0x87, 0x18, 0xd2, 0x6d, 0xff, 0x8b, 0x98, 0x2a, 0x97, 0xeb, 0x93, 0xea, 0x6a,
222 0x23, 0x23, 0xc6, 0x32, 0xf5, 0xea, 0x45, 0xe3, 0x99, 0xa0, 0x4d, 0x4b, 0x8f, 0xf8, 0x1d, 0xad,
223 0xa9, 0x97, 0xa2, 0xd6, 0xaf, 0x5e, 0x11, 0xf7, 0x5f, 0x28, 0xfb, 0x38, 0x80, 0x38, 0x50, 0xc4,
224};
225
226// Ciphertext of the test case using RSAES-OAEP2048 with SHA256 MD/BGF1 created with openssl.
227GLOBAL_REMOVE_IF_UNREFERENCED STATIC CONST UINT8 Ct1230RsaesOaep2048MdSha256Mgf1Sha256[] = {
228 0xa7, 0x20, 0xa9, 0x31, 0xb5, 0xad, 0x83, 0x0a, 0x07, 0xee, 0x36, 0x46, 0xa5, 0x78, 0x3a, 0xda,
229 0x9d, 0xdf, 0xe6, 0x05, 0x0f, 0x7c, 0x46, 0xfe, 0x5f, 0xd6, 0x58, 0x16, 0xb6, 0xaa, 0x82, 0x7c,
230 0x58, 0x8a, 0x52, 0x14, 0x12, 0x29, 0x6f, 0x62, 0x80, 0xa7, 0x61, 0xfe, 0x29, 0x72, 0x6f, 0x73,
231 0xf6, 0x2f, 0x54, 0x38, 0x58, 0x7b, 0xbd, 0xa1, 0x2f, 0x9d, 0x12, 0x83, 0x72, 0xbc, 0x3d, 0x29,
232 0x65, 0x39, 0xcb, 0x93, 0x95, 0x3e, 0x73, 0xc9, 0x6f, 0xb9, 0xe8, 0xd5, 0x8b, 0x91, 0x0d, 0x87,
233 0x7e, 0x22, 0xb5, 0x93, 0x3d, 0xa8, 0x4a, 0xd9, 0x1a, 0x13, 0xf7, 0xf4, 0x7f, 0x16, 0x42, 0xfe,
234 0x63, 0x10, 0x7e, 0xa1, 0xe5, 0x04, 0xcf, 0xed, 0x93, 0x2d, 0x16, 0x3b, 0x79, 0x1f, 0x53, 0x41,
235 0xe3, 0xca, 0x69, 0x18, 0x6a, 0xe5, 0xec, 0x9a, 0xce, 0xbc, 0x47, 0xf6, 0x77, 0x9a, 0x5c, 0xea,
236 0xac, 0x7e, 0x28, 0xeb, 0x1e, 0xfe, 0x75, 0xa6, 0xbf, 0x1e, 0xfd, 0x1c, 0x63, 0x69, 0x47, 0x04,
237 0xaf, 0x69, 0x7e, 0x1c, 0xa1, 0x7f, 0x00, 0xcf, 0xec, 0x16, 0x34, 0xd9, 0xde, 0x91, 0x0e, 0x0f,
238 0x0b, 0x1e, 0x66, 0xc3, 0x41, 0x88, 0x43, 0xbe, 0xa3, 0x2a, 0x7c, 0x87, 0xff, 0xc0, 0x67, 0xdc,
239 0xc7, 0xeb, 0x28, 0x07, 0x00, 0x72, 0x85, 0x17, 0xca, 0x05, 0x9f, 0x29, 0x6b, 0xad, 0xc6, 0xae,
240 0x1c, 0x4a, 0xf2, 0xfe, 0x97, 0xc7, 0x6e, 0x4b, 0xbf, 0xfd, 0x46, 0xbe, 0xf8, 0x76, 0xc9, 0x70,
241 0x58, 0x3a, 0x73, 0xcc, 0x34, 0xda, 0xfe, 0x5b, 0x6d, 0x98, 0x74, 0x95, 0x85, 0xc7, 0xc9, 0x84,
242 0x02, 0xa8, 0x97, 0x13, 0xa3, 0x83, 0xcb, 0x28, 0x3d, 0xbb, 0x2b, 0x3b, 0x45, 0xf1, 0x6e, 0xc5,
243 0x37, 0x23, 0x21, 0xe6, 0x74, 0x2d, 0x48, 0x19, 0x97, 0xaf, 0xee, 0x3d, 0x9b, 0xd0, 0x05, 0xc7
244};
245
247typedef
248BOOLEAN
249(EFIAPI *OAEP_TEST_ENCRYPT)(
250 IN OAEP_ENC_DEC_TEST_CONTEXT *TestContext,
251 IN CONST UINT8 *ClearText,
252 IN UINTN ClearTextSize,
253 IN CONST UINT8 *PrngSeed,
254 IN UINTN PrngSeedSize,
255 IN UINT16 DigestLen,
256 OUT UINT8 **CipherText,
257 OUT UINTN *CipherTextSize
258 );
259
260typedef
261BOOLEAN
262(EFIAPI *OAEP_TEST_DECRYPT)(
263 IN OAEP_ENC_DEC_TEST_CONTEXT *TestContext,
264 IN CONST UINT8 *CipherText,
265 IN UINTN CipherTextSize,
266 IN UINT16 DigestLen,
267 OUT UINT8 **ClearText,
268 OUT UINTN *ClearTextSize
269 );
270
272 CONST UINT8 *SelfTestCert;
273 UINTN SelfTestCertSize;
274 CONST UINT8 *PrivateKey;
275 UINTN PrivateKeySize;
276 CONST UINT8 *RsaN;
277 UINTN RsaNSize;
278 CONST UINT8 *RsaE;
279 UINTN RsaESize;
280 CONST UINT8 *RsaD;
281 UINTN RsaDSize;
282 CONST UINT8 *PrngSeed;
283 UINTN PrngSeedSize;
284 CONST UINT8 *ClearText;
285 UINTN ClearTextSize;
286 CONST UINT8 *CipherText;
287 UINTN CipherTextSize;
288 UINT16 DigestLen;
289 OAEP_TEST_ENCRYPT Encrypt;
290 OAEP_TEST_DECRYPT Decrypt;
291 UNIT_TEST_STATUS Expect;
293
294BOOLEAN
295EFIAPI
296CallPkcs1v2Encrypt (
298 CONST UINT8 *ClearText,
299 UINTN ClearTextSize,
300 CONST UINT8 *PrngSeed,
301 UINTN PrngSeedSize,
302 UINT16 DigestLen,
303 UINT8 **CipherText,
304 UINTN *CipherTextSize
305 )
306{
307 BOOLEAN Status;
308
309 Status = Pkcs1v2Encrypt (
310 TestCtx->SelfTestCert,
311 TestCtx->SelfTestCertSize,
312 (UINT8 *)ClearText,
313 ClearTextSize,
314 PrngSeed,
315 PrngSeedSize,
316 CipherText,
317 CipherTextSize
318 );
319
320 return Status;
321}
322
323BOOLEAN
324EFIAPI
325CallPkcs1v2Decrypt (
327 CONST UINT8 *CipherText,
328 UINTN CipherTextSize,
329 UINT16 DigestLen,
330 UINT8 **ClearText,
331 UINTN *ClearTextSize
332 )
333{
334 BOOLEAN Status;
335
336 Status = Pkcs1v2Decrypt (
337 TestCtx->PrivateKey,
338 TestCtx->PrivateKeySize,
339 (UINT8 *)CipherText,
340 CipherTextSize,
341 ClearText,
342 ClearTextSize
343 );
344 return Status;
345}
346
347BOOLEAN
348EFIAPI
349CallRsaOaepEncrypt (
351 CONST UINT8 *ClearText,
352 UINTN ClearTextSize,
353 CONST UINT8 *RandSeedIn,
354 UINTN RandSeedSizeIn,
355 UINT16 DigestLen,
356 UINT8 **CipherText,
357 UINTN *CipherTextSize
358 )
359{
360 VOID *RsaContext = NULL;
361 BOOLEAN Status;
362
363 RsaContext = RsaNew ();
364 UT_ASSERT_FALSE (RsaContext == NULL);
365
366 Status = RsaSetKey (RsaContext, RsaKeyN, TestCtx->RsaN, TestCtx->RsaNSize);
367 UT_ASSERT_TRUE (Status);
368
369 Status = RsaSetKey (RsaContext, RsaKeyE, TestCtx->RsaE, TestCtx->RsaESize);
370 UT_ASSERT_TRUE (Status);
371
372 Status = RsaOaepEncrypt (
373 RsaContext,
374 (UINT8 *)ClearText,
375 ClearTextSize,
376 RandSeedIn,
377 RandSeedSizeIn,
378 DigestLen,
379 CipherText,
380 CipherTextSize
381 );
382
383 return Status;
384}
385
386BOOLEAN
387EFIAPI
388CallRsaOaepDecrypt (
390 CONST UINT8 *CipherText,
391 UINTN CipherTextSize,
392 UINT16 DigestLen,
393 UINT8 **ClearText,
394 UINTN *ClearTextSize
395 )
396{
397 VOID *RsaContext = NULL;
398 BOOLEAN Status;
399
400 RsaContext = RsaNew ();
401 UT_ASSERT_FALSE (RsaContext == NULL);
402
403 Status = RsaSetKey (RsaContext, RsaKeyN, TestCtx->RsaN, TestCtx->RsaNSize);
404 UT_ASSERT_TRUE (Status);
405
406 Status = RsaSetKey (RsaContext, RsaKeyE, TestCtx->RsaE, TestCtx->RsaESize);
407 UT_ASSERT_TRUE (Status);
408
409 Status = RsaSetKey (RsaContext, RsaKeyD, TestCtx->RsaD, TestCtx->RsaDSize);
410 UT_ASSERT_TRUE (Status);
411
412 Status = RsaOaepDecrypt (
413 RsaContext,
414 (UINT8 *)CipherText,
415 CipherTextSize,
416 DigestLen,
417 ClearText,
418 ClearTextSize
419 );
420
421 return Status;
422}
423
425EFIAPI
426TestVerifyEncrypt (
427 IN UNIT_TEST_CONTEXT Context
428 )
429{
430 BOOLEAN Status;
431 UINT8 *OutBuffer = NULL;
432 UINTN OutBufferSize = 0;
433 UINT8 *OutBuffer2 = NULL;
434 UINTN OutBuffer2Size = 0;
436
437 TestCtx = (OAEP_ENC_DEC_TEST_CONTEXT *)Context;
438
439 Status = TestCtx->Encrypt (
440 TestCtx,
441 TestCtx->ClearText,
442 TestCtx->ClearTextSize,
443 TestCtx->PrngSeed,
444 TestCtx->PrngSeedSize,
445 TestCtx->DigestLen,
446 &OutBuffer,
447 &OutBufferSize
448 );
449 UT_ASSERT_TRUE (Status);
450
451 Status = TestCtx->Encrypt (
452 TestCtx,
453 TestCtx->ClearText,
454 TestCtx->ClearTextSize,
455 TestCtx->PrngSeed,
456 TestCtx->PrngSeedSize,
457 TestCtx->DigestLen,
458 &OutBuffer2,
459 &OutBuffer2Size
460 );
461 UT_ASSERT_TRUE (Status);
462
463 // TRUE - the two OutBuffers are indentical. That means the Oaep encrypt result is incorrect.
464 Status = (CompareMem (OutBuffer, OutBuffer2, OutBufferSize >= OutBuffer2Size ? OutBufferSize : OutBuffer2Size) == 0);
465 UT_ASSERT_FALSE (Status);
466
467 if (OutBuffer) {
468 FreePool (OutBuffer);
469 OutBuffer = NULL;
470 OutBufferSize = 0;
471 }
472
473 if (OutBuffer2) {
474 FreePool (OutBuffer2);
475 OutBuffer2 = NULL;
476 OutBuffer2Size = 0;
477 }
478
479 return UNIT_TEST_PASSED;
480}
481
483EFIAPI
484TestVerifyDecrypt (
485 IN UNIT_TEST_CONTEXT Context
486 )
487{
488 BOOLEAN Status;
489 UINT8 *OutBuffer = NULL;
490 UINTN OutBufferSize = 0;
492
493 TestCtx = Context;
494
495 Status = TestCtx->Decrypt (
496 TestCtx,
497 TestCtx->CipherText,
498 TestCtx->CipherTextSize,
499 TestCtx->DigestLen,
500 &OutBuffer,
501 &OutBufferSize
502 );
503 UT_ASSERT_TRUE (Status);
504
505 UT_ASSERT_TRUE (CompareMem (OutBuffer, TestCtx->ClearText, OutBufferSize >= TestCtx->ClearTextSize ? OutBufferSize : TestCtx->ClearTextSize) == 0);
506 UT_ASSERT_TRUE (OutBufferSize == TestCtx->ClearTextSize);
507
508 if (OutBuffer) {
509 FreePool (OutBuffer);
510 OutBuffer = NULL;
511 OutBufferSize = 0;
512 }
513
514 return UNIT_TEST_PASSED;
515}
516
518EFIAPI
519TestVerifyEncryptDecrypt (
520 IN UNIT_TEST_CONTEXT Context
521 )
522{
523 BOOLEAN Status;
524 UINT8 *ClearText = NULL;
525 UINTN ClearTextSize = 0;
526 UINT8 *CipherText = NULL;
527 UINTN CipherTextSize = 0;
529
530 TestCtx = Context;
531
532 Status = TestCtx->Encrypt (
533 TestCtx,
534 TestCtx->ClearText,
535 TestCtx->ClearTextSize,
536 TestCtx->PrngSeed,
537 TestCtx->PrngSeedSize,
538 TestCtx->DigestLen,
539 &CipherText,
540 &CipherTextSize
541 );
542 UT_ASSERT_TRUE (Status);
543
544 Status = TestCtx->Decrypt (
545 TestCtx,
546 CipherText,
547 CipherTextSize,
548 TestCtx->DigestLen,
549 &ClearText,
550 &ClearTextSize
551 );
552
553 if (TestCtx->Expect == UNIT_TEST_PASSED) {
554 UT_ASSERT_TRUE (Status);
555 } else {
556 UT_ASSERT_FALSE (Status);
557 }
558
559 if (TestCtx->Expect == UNIT_TEST_PASSED) {
560 UT_ASSERT_TRUE (CompareMem (ClearText, TestCtx->ClearText, ClearTextSize >= TestCtx->ClearTextSize ? ClearTextSize : TestCtx->ClearTextSize) == 0);
561 UT_ASSERT_TRUE (ClearTextSize == TestCtx->ClearTextSize);
562 }
563
564 if (CipherText) {
565 FreePool (CipherText);
566 CipherText = NULL;
567 CipherTextSize = 0;
568 }
569
570 if (ClearText) {
571 FreePool (ClearText);
572 ClearText = NULL;
573 ClearTextSize = 0;
574 }
575
576 return UNIT_TEST_PASSED;
577}
578
580EFIAPI
581TestVerifyPkcs1v2EncryptInterface (
582 IN UNIT_TEST_CONTEXT Context
583 )
584{
585 BOOLEAN Status;
586 UINT8 *OutBuffer;
587 UINTN OutBufferSize;
588
589 Status = Pkcs1v2Encrypt (
590 NULL,
591 (UINTN)sizeof (SelfTestCert),
592 (UINT8 *)Msg1230,
593 (UINTN)4,
594 NULL,
595 0,
596 &OutBuffer,
597 (UINTN *)&OutBufferSize
598 );
599 UT_ASSERT_FALSE (Status);
600
601 Status = Pkcs1v2Encrypt (
602 SelfTestCert,
603 (UINTN)sizeof (SelfTestCert),
604 (UINT8 *)Msg1230,
605 (UINTN)4,
606 NULL,
607 0,
608 (UINT8 **)NULL,
609 (UINTN *)&OutBufferSize
610 );
611 UT_ASSERT_FALSE (Status);
612
613 Status = Pkcs1v2Encrypt (
614 SelfTestCert,
615 (UINTN)sizeof (SelfTestCert),
616 (UINT8 *)Msg1230,
617 (UINTN)4,
618 NULL,
619 0,
620 &OutBuffer,
621 (UINTN *)NULL
622 );
623 UT_ASSERT_FALSE (Status);
624
625 return UNIT_TEST_PASSED;
626}
627
629EFIAPI
630TestVerifyRsaOaepEncryptInterface (
631 IN UNIT_TEST_CONTEXT Context
632 )
633{
634 VOID *RsaContext = NULL;
635 BOOLEAN Status;
636 UINT8 *OutBuffer;
637 UINTN OutBufferSize;
638
639 RsaContext = RsaNew ();
640 UT_ASSERT_FALSE (RsaContext == NULL);
641
642 Status = RsaSetKey (RsaContext, RsaKeyN, RsaN, sizeof (RsaN));
643 UT_ASSERT_TRUE (Status);
644
645 Status = RsaSetKey (RsaContext, RsaKeyE, RsaE, sizeof (RsaE));
646 UT_ASSERT_TRUE (Status);
647
648 Status = RsaOaepEncrypt (
649 NULL,
650 (UINT8 *)Msg1230,
651 (UINTN)4,
652 NULL,
653 0,
654 0,
655 &OutBuffer,
656 (UINTN *)&OutBufferSize
657 );
658 UT_ASSERT_FALSE (Status);
659
660 Status = RsaOaepEncrypt (
661 RsaContext,
662 (UINT8 *)Msg1230,
663 (UINTN)4,
664 NULL,
665 0,
666 0,
667 (UINT8 **)NULL,
668 (UINTN *)&OutBufferSize
669 );
670 UT_ASSERT_FALSE (Status);
671
672 Status = RsaOaepEncrypt (
673 RsaContext,
674 (UINT8 *)Msg1230,
675 (UINTN)4,
676 NULL,
677 0,
678 0,
679 &OutBuffer,
680 (UINTN *)NULL
681 );
682 UT_ASSERT_FALSE (Status);
683
684 return UNIT_TEST_PASSED;
685}
686
687OAEP_ENC_DEC_TEST_CONTEXT mTestVerifyPkcs1v2Msg1230 = {
688 .SelfTestCert = SelfTestCert,
689 .SelfTestCertSize = sizeof (SelfTestCert),
690 .PrivateKey = PrivateKey,
691 .PrivateKeySize = sizeof (PrivateKey),
692 .RsaN = NULL,
693 .RsaNSize = 0,
694 .RsaE = NULL,
695 .RsaESize = 0,
696 .RsaD = NULL,
697 .RsaDSize = 0,
698 .PrngSeed = NULL,
699 .PrngSeedSize = 0,
700 .ClearText = Msg1230,
701 .ClearTextSize = sizeof (Msg1230),
702 .CipherText = Ct1230RsaesOaepMdSha1Mgf1Sha1,
703 .CipherTextSize = sizeof (Ct1230RsaesOaepMdSha1Mgf1Sha1),
704 .DigestLen = 0,
705 .Encrypt = CallPkcs1v2Encrypt,
706 .Decrypt = CallPkcs1v2Decrypt,
707 .Expect = UNIT_TEST_PASSED
708};
709
710OAEP_ENC_DEC_TEST_CONTEXT mTestVerifyPkcs1v2Msg1230PrngSeed = {
711 .SelfTestCert = SelfTestCert,
712 .SelfTestCertSize = sizeof (SelfTestCert),
713 .PrivateKey = PrivateKey,
714 .PrivateKeySize = sizeof (PrivateKey),
715 .RsaN = NULL,
716 .RsaNSize = 0,
717 .RsaE = NULL,
718 .RsaESize = 0,
719 .RsaD = NULL,
720 .RsaDSize = 0,
721 .PrngSeed = RandSeed,
722 .PrngSeedSize = sizeof (RandSeed),
723 .ClearText = Msg1230,
724 .ClearTextSize = sizeof (Msg1230),
725 .CipherText = Ct1230RsaesOaepMdSha1Mgf1Sha1,
726 .CipherTextSize = sizeof (Ct1230RsaesOaepMdSha1Mgf1Sha1),
727 .DigestLen = 0,
728 .Encrypt = CallPkcs1v2Encrypt,
729 .Decrypt = CallPkcs1v2Decrypt,
730 .Expect = UNIT_TEST_PASSED
731};
732
733OAEP_ENC_DEC_TEST_CONTEXT mTestVerifyRsaOaepMsg1230 = {
734 .SelfTestCert = NULL,
735 .SelfTestCertSize = 0,
736 .PrivateKey = NULL,
737 .PrivateKeySize = 0,
738 .RsaN = RsaN,
739 .RsaNSize = sizeof (RsaN),
740 .RsaE = RsaE,
741 .RsaESize = sizeof (RsaE),
742 .RsaD = RsaD,
743 .RsaDSize = sizeof (RsaD),
744 .PrngSeed = NULL,
745 .PrngSeedSize = 0,
746 .ClearText = Msg1230,
747 .ClearTextSize = sizeof (Msg1230),
748 .CipherText = Ct1230RsaesOaepMdSha1Mgf1Sha1,
749 .CipherTextSize = sizeof (Ct1230RsaesOaepMdSha1Mgf1Sha1),
750 .DigestLen = 0,
751 .Encrypt = CallRsaOaepEncrypt,
752 .Decrypt = CallRsaOaepDecrypt,
753 .Expect = UNIT_TEST_PASSED
754};
755
756OAEP_ENC_DEC_TEST_CONTEXT mTestVerifyRsaOaepMsg1230PrngSeed = {
757 .SelfTestCert = NULL,
758 .SelfTestCertSize = 0,
759 .PrivateKey = NULL,
760 .PrivateKeySize = 0,
761 .RsaN = RsaN,
762 .RsaNSize = sizeof (RsaN),
763 .RsaE = RsaE,
764 .RsaESize = sizeof (RsaE),
765 .RsaD = RsaD,
766 .RsaDSize = sizeof (RsaD),
767 .PrngSeed = RandSeed,
768 .PrngSeedSize = sizeof (RandSeed),
769 .ClearText = Msg1230,
770 .ClearTextSize = sizeof (Msg1230),
771 .CipherText = Ct1230RsaesOaepMdSha1Mgf1Sha1,
772 .CipherTextSize = sizeof (Ct1230RsaesOaepMdSha1Mgf1Sha1),
773 .DigestLen = 0,
774 .Encrypt = CallRsaOaepEncrypt,
775 .Decrypt = CallRsaOaepDecrypt,
776 .Expect = UNIT_TEST_PASSED
777};
778
779OAEP_ENC_DEC_TEST_CONTEXT mTestVerifyPkcs1v2EncryptRsaOaepDecrypt = {
780 .SelfTestCert = SelfTestCert,
781 .SelfTestCertSize = sizeof (SelfTestCert),
782 .PrivateKey = PrivateKey,
783 .PrivateKeySize = sizeof (PrivateKey),
784 .RsaN = RsaN,
785 .RsaNSize = sizeof (RsaN),
786 .RsaE = RsaE,
787 .RsaESize = sizeof (RsaE),
788 .RsaD = RsaD,
789 .RsaDSize = sizeof (RsaD),
790 .ClearText = Msg1230,
791 .ClearTextSize = sizeof (Msg1230),
792 .CipherText = Ct1230RsaesOaepMdSha1Mgf1Sha1,
793 .CipherTextSize = sizeof (Ct1230RsaesOaepMdSha1Mgf1Sha1),
794 .DigestLen = 0,
795 .Encrypt = CallPkcs1v2Encrypt,
796 .Decrypt = CallRsaOaepDecrypt,
797 .Expect = UNIT_TEST_PASSED
798};
799
800OAEP_ENC_DEC_TEST_CONTEXT mTestVerifyRsaOaepEncryptPkcs1v2Decrypt = {
801 .SelfTestCert = SelfTestCert,
802 .SelfTestCertSize = sizeof (SelfTestCert),
803 .PrivateKey = PrivateKey,
804 .PrivateKeySize = sizeof (PrivateKey),
805 .RsaN = RsaN,
806 .RsaNSize = sizeof (RsaN),
807 .RsaE = RsaE,
808 .RsaESize = sizeof (RsaE),
809 .RsaD = RsaD,
810 .RsaDSize = sizeof (RsaD),
811 .ClearText = Msg1230,
812 .ClearTextSize = sizeof (Msg1230),
813 .CipherText = Ct1230RsaesOaepMdSha1Mgf1Sha1,
814 .CipherTextSize = sizeof (Ct1230RsaesOaepMdSha1Mgf1Sha1),
815 .DigestLen = 0,
816 .Encrypt = CallRsaOaepEncrypt,
817 .Decrypt = CallPkcs1v2Decrypt,
818 .Expect = UNIT_TEST_PASSED
819};
820
821OAEP_ENC_DEC_TEST_CONTEXT mTestVerifyRsaesOaep2048MdDefaultBgf1Default = {
822 .SelfTestCert = NULL,
823 .SelfTestCertSize = 0,
824 .PrivateKey = NULL,
825 .PrivateKeySize = 0,
826 .RsaN = RsaN,
827 .RsaNSize = sizeof (RsaN),
828 .RsaE = RsaE,
829 .RsaESize = sizeof (RsaE),
830 .RsaD = RsaD,
831 .RsaDSize = sizeof (RsaD),
832 .ClearText = Msg1230,
833 .ClearTextSize = sizeof (Msg1230),
834 .CipherText = Ct1230RsaesOaepMdSha1Mgf1Sha1,
835 .CipherTextSize = sizeof (Ct1230RsaesOaepMdSha1Mgf1Sha1),
836 .DigestLen = 0,
837 .Encrypt = CallRsaOaepEncrypt,
838 .Decrypt = CallRsaOaepDecrypt,
839 .Expect = UNIT_TEST_PASSED
840};
841
842OAEP_ENC_DEC_TEST_CONTEXT mTestVerifyRsaesOaep2048MdSha1Mgf1Sha1 = {
843 .SelfTestCert = NULL,
844 .SelfTestCertSize = 0,
845 .PrivateKey = NULL,
846 .PrivateKeySize = 0,
847 .RsaN = RsaN,
848 .RsaNSize = sizeof (RsaN),
849 .RsaE = RsaE,
850 .RsaESize = sizeof (RsaE),
851 .RsaD = RsaD,
852 .RsaDSize = sizeof (RsaD),
853 .ClearText = Msg1230,
854 .ClearTextSize = sizeof (Msg1230),
855 .CipherText = Ct1230RsaesOaepMdSha1Mgf1Sha1,
856 .CipherTextSize = sizeof (Ct1230RsaesOaepMdSha1Mgf1Sha1),
857 .DigestLen = SHA1_DIGEST_SIZE,
858 .Encrypt = CallRsaOaepEncrypt,
859 .Decrypt = CallRsaOaepDecrypt,
860 .Expect = UNIT_TEST_PASSED
861};
862
863OAEP_ENC_DEC_TEST_CONTEXT mTestVerifyRsaesOaep2048MdSha256Mgf1Sha256 = {
864 .SelfTestCert = NULL,
865 .SelfTestCertSize = 0,
866 .PrivateKey = NULL,
867 .PrivateKeySize = 0,
868 .RsaN = RsaN,
869 .RsaNSize = sizeof (RsaN),
870 .RsaE = RsaE,
871 .RsaESize = sizeof (RsaE),
872 .RsaD = RsaD,
873 .RsaDSize = sizeof (RsaD),
874 .ClearText = Msg1230,
875 .ClearTextSize = sizeof (Msg1230),
876 .CipherText = Ct1230RsaesOaep2048MdSha256Mgf1Sha256,
877 .CipherTextSize = sizeof (Ct1230RsaesOaep2048MdSha256Mgf1Sha256),
878 .DigestLen = SHA256_DIGEST_SIZE,
879 .Encrypt = CallRsaOaepEncrypt,
880 .Decrypt = CallRsaOaepDecrypt,
881 .Expect = UNIT_TEST_PASSED
882};
883
884TEST_DESC mOaepTest[] = {
885 //
886 // -----Description--------------------------------------Class----------------------Function-----------------Pre---Post--Context
887 //
888 // Pkcs1v2Encrypt / Decrypt
889 { "Pkcs1v2Encrypt (Interface)", "CryptoPkg.BaseCryptLib.Pkcs1v2Encrypt.Interface", TestVerifyPkcs1v2EncryptInterface, NULL, NULL, &mTestVerifyPkcs1v2Msg1230 },
890 { "Pkcs1v2Encrypt (NoSeed)", "CryptoPkg.BaseCryptLib.Pkcs1v2Encrypt.NoSeed", TestVerifyEncrypt, NULL, NULL, &mTestVerifyPkcs1v2Msg1230 },
891 { "Pkcs1v2Encrypt (Seeded)", "CryptoPkg.BaseCryptLib.Pkcs1v2Encrypt.Seeded", TestVerifyEncrypt, NULL, NULL, &mTestVerifyPkcs1v2Msg1230PrngSeed },
892 { "Pkcs1v2Decrypt", "CryptoPkg.BaseCryptLib.Pkcs1v2Decrypt", TestVerifyDecrypt, NULL, NULL, &mTestVerifyPkcs1v2Msg1230 },
893 { "Pkcs1v2EncryptDecrypt", "CryptoPkg.BaseCryptLib.Pkcs1v2EncryptDecrypt", TestVerifyEncryptDecrypt, NULL, NULL, &mTestVerifyPkcs1v2Msg1230 },
894
895 // RsaOaepEncrypt / Decrypt
896 { "RsaOaepEncrypt (Interface)", "CryptoPkg.BaseCryptLib.RsaOaepEncrypt.Interface", TestVerifyRsaOaepEncryptInterface, NULL, NULL, &mTestVerifyRsaOaepMsg1230 },
897 { "RsaOaepEncrypt (NoSeed)", "CryptoPkg.BaseCryptLib.RsaOaepEncrypt.NoSeed", TestVerifyEncrypt, NULL, NULL, &mTestVerifyRsaOaepMsg1230 },
898 { "RsaOaepEncrypt (Seeded)", "CryptoPkg.BaseCryptLib.RsaOaepEncrypt.Seeded", TestVerifyEncrypt, NULL, NULL, &mTestVerifyRsaOaepMsg1230PrngSeed },
899 { "RsaOaepDecrypt", "CryptoPkg.BaseCryptLib.RsaOaepDecrypt", TestVerifyDecrypt, NULL, NULL, &mTestVerifyRsaOaepMsg1230 },
900 { "RsaOaepEncryptDecrypt", "CryptoPkg.BaseCryptLib.RsaOaepEncryptDecrypt", TestVerifyEncryptDecrypt, NULL, NULL, &mTestVerifyRsaOaepMsg1230 },
901
902 // Mix interfaces
903 { "RsaOaepEncryptPkcs1v2Decrypt", "CryptoPkg.BaseCryptLib.RsaOaepEncryptPkcs1v2Decrypt", TestVerifyEncryptDecrypt, NULL, NULL, &mTestVerifyRsaOaepEncryptPkcs1v2Decrypt },
904 { "Pkcs1v2EncryptRsaOaepDecrypt", "CryptoPkg.BaseCryptLib.Pkcs1v2EncryptRsaOaepDecrypt", TestVerifyEncryptDecrypt, NULL, NULL, &mTestVerifyPkcs1v2EncryptRsaOaepDecrypt },
905
906 // Message digest default / MGF1 default (SHA1)
907 { "RsaOaepEncrypt (MdDefaultMgf1Default)", "CryptoPkg.BaseCryptLib.RsaOaepEncrypt.MdDefaultMgf1Default", TestVerifyEncrypt, NULL, NULL, &mTestVerifyRsaesOaep2048MdDefaultBgf1Default },
908 { "RsaOaepDecrypt (MdDefaultMgf1Default)", "CryptoPkg.BaseCryptLib.RsaOaepDecrypt.MdDefaultMgf1Default", TestVerifyDecrypt, NULL, NULL, &mTestVerifyRsaesOaep2048MdDefaultBgf1Default },
909 { "RsaOaepEncryptDecrypt (MdDefaultMgf1Default)", "CryptoPkg.BaseCryptLib.RsaOaepEncryptDecrypt.MdDefaultMgf1Default", TestVerifyEncryptDecrypt, NULL, NULL, &mTestVerifyRsaesOaep2048MdDefaultBgf1Default },
910
911 // Message digest SHA1 / MGF1 SHA1
912 { "RsaOaepEncrypt (MdSha1Bgf1Sha1", "CryptoPkg.BaseCryptLib.RsaOaepEncrypt.MdSha1Bgf1Sha1", TestVerifyEncrypt, NULL, NULL, &mTestVerifyRsaesOaep2048MdSha1Mgf1Sha1 },
913 { "RsaOaepDecrypt (MdSha1Bgf1Sha1)", "CryptoPkg.BaseCryptLib.RsaOaepDecrypt.MdSha1Bgf1Sha1", TestVerifyDecrypt, NULL, NULL, &mTestVerifyRsaesOaep2048MdSha1Mgf1Sha1 },
914 { "RsaOaepEncryptDecrypt (MdSha1Bgf1Sha1)", "CryptoPkg.BaseCryptLib.RsaOaepEncryptDecrypt.MdSha1Bgf1Sha1", TestVerifyEncryptDecrypt, NULL, NULL, &mTestVerifyRsaesOaep2048MdSha1Mgf1Sha1 },
915
916 // Message digest SHA256 / MGF1 SHA256
917 { "RsaOaepEncrypt (MdSha256Bgf1Sha256)", "CryptoPkg.BaseCryptLib.RsaOaepEncrypt.MdSha256Bgf1Sha256", TestVerifyEncrypt, NULL, NULL, &mTestVerifyRsaesOaep2048MdSha256Mgf1Sha256 },
918 { "RsaOaepDecrypt (MdSha256Bgf1Sha256)", "CryptoPkg.BaseCryptLib.RsaOaepDecrypt.MdSha256Bgf1Sha256", TestVerifyDecrypt, NULL, NULL, &mTestVerifyRsaesOaep2048MdSha256Mgf1Sha256 },
919 { "RsaOaepEncryptDecrypt (MdSha256Bgf1Sha256)", "CryptoPkg.BaseCryptLib.RsaOaepEncryptDecryptMdSha256Bgf1Sha256", TestVerifyEncryptDecrypt, NULL, NULL, &mTestVerifyRsaesOaep2048MdSha256Mgf1Sha256 },
920};
921
922UINTN mOaepTestNum = ARRAY_SIZE (mOaepTest);
UINT64 UINTN
@ RsaKeyD
RSA Private exponent (d)
Definition: BaseCryptLib.h:77
@ RsaKeyN
RSA public Modulus (N)
Definition: BaseCryptLib.h:75
@ RsaKeyE
RSA Public exponent (e)
Definition: BaseCryptLib.h:76
#define SHA1_DIGEST_SIZE
Definition: BaseCryptLib.h:39
VOID *EFIAPI RsaNew(VOID)
Definition: CryptRsaBasic.c:30
#define SHA256_DIGEST_SIZE
Definition: BaseCryptLib.h:44
BOOLEAN EFIAPI Pkcs1v2Encrypt(IN CONST UINT8 *PublicKey, IN UINTN PublicKeySize, IN UINT8 *InData, IN UINTN InDataSize, IN CONST UINT8 *PrngSeed OPTIONAL, IN UINTN PrngSeedSize OPTIONAL, OUT UINT8 **EncryptedData, OUT UINTN *EncryptedDataSize)
BOOLEAN EFIAPI RsaOaepEncrypt(IN VOID *RsaContext, IN UINT8 *InData, IN UINTN InDataSize, IN CONST UINT8 *PrngSeed OPTIONAL, IN UINTN PrngSeedSize OPTIONAL, IN UINT16 DigestLen OPTIONAL, OUT UINT8 **EncryptedData, OUT UINTN *EncryptedDataSize)
BOOLEAN EFIAPI RsaOaepDecrypt(IN VOID *RsaContext, IN UINT8 *EncryptedData, IN UINTN EncryptedDataSize, IN UINT16 DigestLen OPTIONAL, OUT UINT8 **OutData, OUT UINTN *OutDataSize)
BOOLEAN EFIAPI RsaSetKey(IN OUT VOID *RsaContext, IN RSA_KEY_TAG KeyTag, IN CONST UINT8 *BigNumber, IN UINTN BnSize)
Definition: CryptRsaBasic.c:82
BOOLEAN EFIAPI Pkcs1v2Decrypt(IN CONST UINT8 *PrivateKey, IN UINTN PrivateKeySize, IN UINT8 *EncryptedData, IN UINTN EncryptedDataSize, OUT UINT8 **OutData, OUT UINTN *OutDataSize)
INTN EFIAPI CompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define STATIC
Definition: Base.h:264
#define ARRAY_SIZE(Array)
Definition: Base.h:1393
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define GLOBAL_REMOVE_IF_UNREFERENCED
Definition: Base.h:48
VOID * UNIT_TEST_CONTEXT
Definition: UnitTestLib.h:54
#define UT_ASSERT_TRUE(Expression)
Definition: UnitTestLib.h:350
UINT32 UNIT_TEST_STATUS
Definition: UnitTestLib.h:16
#define UT_ASSERT_FALSE(Expression)
Definition: UnitTestLib.h:362