Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: tests/vboot_common2_tests.c

Issue 2873033: Add a script to generate test vboot-format public keys. (Closed) Base URL: ssh://git@chromiumos-git/vboot_reference.git
Patch Set: Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/testkeys/key_rsa8192.sha512.vbpubk ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be 2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. 3 * found in the LICENSE file.
4 * 4 *
5 * Tests for firmware image library. 5 * Tests for firmware image library.
6 */ 6 */
7 7
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 10
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 GetSignatureData(sig)[0] ^= 0x5A; 63 GetSignatureData(sig)[0] ^= 0x5A;
64 TEST_EQ(VerifyData(test_data, sig, rsa), 1, "VerifyData() wrong sig"); 64 TEST_EQ(VerifyData(test_data, sig, rsa), 1, "VerifyData() wrong sig");
65 65
66 RSAPublicKeyFree(rsa); 66 RSAPublicKeyFree(rsa);
67 Free(sig); 67 Free(sig);
68 } 68 }
69 69
70 70
71 static void VerifyDigestTest(const VbPublicKey* public_key, 71 static void VerifyDigestTest(const VbPublicKey* public_key,
72 const VbPrivateKey* private_key) { 72 const VbPrivateKey* private_key) {
73 73
74 const uint8_t test_data[] = "This is some other test data to sign."; 74 const uint8_t test_data[] = "This is some other test data to sign.";
75 VbSignature* sig; 75 VbSignature* sig;
76 RSAPublicKey* rsa; 76 RSAPublicKey* rsa;
77 uint8_t* digest; 77 uint8_t* digest;
78 78
79 sig = CalculateSignature(test_data, sizeof(test_data), private_key); 79 sig = CalculateSignature(test_data, sizeof(test_data), private_key);
80 rsa = PublicKeyToRSA(public_key); 80 rsa = PublicKeyToRSA(public_key);
81 digest = DigestBuf(test_data, sizeof(test_data), (int)public_key->algorithm); 81 digest = DigestBuf(test_data, sizeof(test_data), (int)public_key->algorithm);
82 TEST_NEQ(sig && rsa && digest, 0, "VerifyData() prerequisites"); 82 TEST_NEQ(sig && rsa && digest, 0, "VerifyData() prerequisites");
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 VerifyDigestTest(public_key, private_key); 230 VerifyDigestTest(public_key, private_key);
231 VerifyKernelPreambleTest(public_key, private_key); 231 VerifyKernelPreambleTest(public_key, private_key);
232 232
233 if (public_key) 233 if (public_key)
234 Free(public_key); 234 Free(public_key);
235 if (private_key) 235 if (private_key)
236 Free(private_key); 236 Free(private_key);
237 237
238 return error_code; 238 return error_code;
239 } 239 }
OLDNEW
« no previous file with comments | « tests/testkeys/key_rsa8192.sha512.vbpubk ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698