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

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

Issue 572025: Make SHA* function prototypes consistent. (Closed)
Patch Set: Created 10 years, 10 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 | « no previous file | src/platform/vboot_reference/include/sha.h » ('j') | 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 5
6 /* SHA-1 implementation largely based on libmincrypt in the the Android 6 /* SHA-1 implementation largely based on libmincrypt in the the Android
7 * Open Source Project (platorm/system/core.git/libmincrypt/sha.c 7 * Open Source Project (platorm/system/core.git/libmincrypt/sha.c
8 */ 8 */
9 9
10 #include "sha.h" 10 #include "sha.h"
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 268
269 void SHA1_init(SHA1_CTX* ctx) { 269 void SHA1_init(SHA1_CTX* ctx) {
270 ctx->state[0] = 0x67452301; 270 ctx->state[0] = 0x67452301;
271 ctx->state[1] = 0xEFCDAB89; 271 ctx->state[1] = 0xEFCDAB89;
272 ctx->state[2] = 0x98BADCFE; 272 ctx->state[2] = 0x98BADCFE;
273 ctx->state[3] = 0x10325476; 273 ctx->state[3] = 0x10325476;
274 ctx->state[4] = 0xC3D2E1F0; 274 ctx->state[4] = 0xC3D2E1F0;
275 ctx->count = 0; 275 ctx->count = 0;
276 } 276 }
277 277
278 uint8_t* SHA1(const void *data, int len, uint8_t *digest) { 278 uint8_t* SHA1(const uint8_t *data, int len, uint8_t *digest) {
279 const uint8_t *p; 279 const uint8_t *p;
280 int i; 280 int i;
281 SHA1_CTX ctx; 281 SHA1_CTX ctx;
282 SHA1_init(&ctx); 282 SHA1_init(&ctx);
283 SHA1_update(&ctx, data, len); 283 SHA1_update(&ctx, data, len);
284 p = SHA1_final(&ctx); 284 p = SHA1_final(&ctx);
285 for (i = 0; i < SHA1_DIGEST_SIZE; ++i) { 285 for (i = 0; i < SHA1_DIGEST_SIZE; ++i) {
286 digest[i] = *p++; 286 digest[i] = *p++;
287 } 287 }
288 return digest; 288 return digest;
289 } 289 }
OLDNEW
« no previous file with comments | « no previous file | src/platform/vboot_reference/include/sha.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698