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

Side by Side Diff: src/platform/vboot_reference/crypto/rsa.c

Issue 661353: Vboot Reference: Refactor Code. (Closed)
Patch Set: Review Fixes. Created 10 years, 9 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
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 5
6 /* Implementation of RSA signature verification which uses a pre-processed 6 /* Implementation of RSA signature verification which uses a pre-processed
7 * key for computation. The code extends Android's RSA verification code to 7 * key for computation. The code extends Android's RSA verification code to
8 * support multiple RSA key lengths and hash digest algorithms. 8 * support multiple RSA key lengths and hash digest algorithms.
9 */ 9 */
10 10
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 } 120 }
121 121
122 Free(a); 122 Free(a);
123 Free(aR); 123 Free(aR);
124 Free(aaR); 124 Free(aaR);
125 } 125 }
126 126
127 /* Verify a RSA PKCS1.5 signature against an expected hash. 127 /* Verify a RSA PKCS1.5 signature against an expected hash.
128 * Returns 0 on failure, 1 on success. 128 * Returns 0 on failure, 1 on success.
129 */ 129 */
130 int RSA_verify(const RSAPublicKey *key, 130 int RSAVerify(const RSAPublicKey *key,
131 const uint8_t *sig, 131 const uint8_t *sig,
132 const int sig_len, 132 const int sig_len,
133 const uint8_t sig_type, 133 const uint8_t sig_type,
134 const uint8_t *hash) { 134 const uint8_t *hash) {
135 int i; 135 int i;
136 uint8_t* buf; 136 uint8_t* buf;
137 const uint8_t* padding; 137 const uint8_t* padding;
138 int success = 1; 138 int success = 1;
139 139
140 if (sig_len != (key->len * sizeof(uint32_t))) { 140 if (sig_len != (key->len * sizeof(uint32_t))) {
141 fprintf(stderr, "Signature is of incorrect length!\n"); 141 fprintf(stderr, "Signature is of incorrect length!\n");
142 return 0; 142 return 0;
143 } 143 }
144 144
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 buf[i]); 181 buf[i]);
182 #endif 182 #endif
183 success = 0; 183 success = 0;
184 } 184 }
185 } 185 }
186 186
187 Free(buf); 187 Free(buf);
188 188
189 return success; 189 return success;
190 } 190 }
OLDNEW
« no previous file with comments | « src/platform/vboot_reference/common/utility_stub.c ('k') | src/platform/vboot_reference/crypto/rsa_utility.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698