OLD | NEW |
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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 #ifndef NDEBUG | 163 #ifndef NDEBUG |
164 /* TODO(gauravsh): Replace with a macro call for logging. */ | 164 /* TODO(gauravsh): Replace with a macro call for logging. */ |
165 debug("Padding: Expecting = %02x Got = %02x\n", padding[i], | 165 debug("Padding: Expecting = %02x Got = %02x\n", padding[i], |
166 buf[i]); | 166 buf[i]); |
167 #endif | 167 #endif |
168 success = 0; | 168 success = 0; |
169 } | 169 } |
170 } | 170 } |
171 | 171 |
172 /* Check if digest matches. */ | 172 /* Check if digest matches. */ |
173 for (; i < sig_len; ++i) { | 173 for (; i < (int)sig_len; ++i) { |
174 if (buf[i] != *hash++) { | 174 if (buf[i] != *hash++) { |
175 #ifndef NDEBUG | 175 #ifndef NDEBUG |
176 /* TODO(gauravsh): Replace with a macro call for logging. */ | 176 /* TODO(gauravsh): Replace with a macro call for logging. */ |
177 debug("Digest: Expecting = %02x Got = %02x\n", padding[i], | 177 debug("Digest: Expecting = %02x Got = %02x\n", padding[i], |
178 buf[i]); | 178 buf[i]); |
179 #endif | 179 #endif |
180 success = 0; | 180 success = 0; |
181 } | 181 } |
182 } | 182 } |
183 | 183 |
184 Free(buf); | 184 Free(buf); |
185 | 185 |
186 return success; | 186 return success; |
187 } | 187 } |
OLD | NEW |