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

Side by Side Diff: firmware/lib/cryptolib/include/sha.h

Issue 6760017: Make SHA256 and SHA512 handle >UINT32_MAX data correctly (now with fix for ARM compilation) (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git@master
Patch Set: arm firmware compilation fix Created 9 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « firmware/arch/arm/include/biosincludes.h ('k') | firmware/lib/cryptolib/sha2.c » ('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, 256 and 512 functions. */ 6 /* SHA-1, 256 and 512 functions. */
7 7
8 #ifndef VBOOT_REFERENCE_SHA_H_ 8 #ifndef VBOOT_REFERENCE_SHA_H_
9 #define VBOOT_REFERENCE_SHA_H_ 9 #define VBOOT_REFERENCE_SHA_H_
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 uint8_t block[2 * SHA512_BLOCK_SIZE]; 51 uint8_t block[2 * SHA512_BLOCK_SIZE];
52 uint8_t buf[SHA512_DIGEST_SIZE]; /* Used for storing the final digest. */ 52 uint8_t buf[SHA512_DIGEST_SIZE]; /* Used for storing the final digest. */
53 } SHA512_CTX; 53 } SHA512_CTX;
54 54
55 55
56 void SHA1_init(SHA1_CTX* ctx); 56 void SHA1_init(SHA1_CTX* ctx);
57 void SHA1_update(SHA1_CTX* ctx, const uint8_t* data, uint64_t len); 57 void SHA1_update(SHA1_CTX* ctx, const uint8_t* data, uint64_t len);
58 uint8_t* SHA1_final(SHA1_CTX* ctx); 58 uint8_t* SHA1_final(SHA1_CTX* ctx);
59 59
60 void SHA256_init(SHA256_CTX* ctx); 60 void SHA256_init(SHA256_CTX* ctx);
61 void SHA256_update(SHA256_CTX* ctx, const uint8_t* data, uint64_t len); 61 void SHA256_update(SHA256_CTX* ctx, const uint8_t* data, uint32_t len);
62 uint8_t* SHA256_final(SHA256_CTX* ctx); 62 uint8_t* SHA256_final(SHA256_CTX* ctx);
63 63
64 void SHA512_init(SHA512_CTX* ctx); 64 void SHA512_init(SHA512_CTX* ctx);
65 void SHA512_update(SHA512_CTX* ctx, const uint8_t* data, uint64_t len); 65 void SHA512_update(SHA512_CTX* ctx, const uint8_t* data, uint32_t len);
66 uint8_t* SHA512_final(SHA512_CTX* ctx); 66 uint8_t* SHA512_final(SHA512_CTX* ctx);
67 67
68 /* Convenience function for SHA-1. Computes hash on [data] of length [len]. 68 /* Convenience function for SHA-1. Computes hash on [data] of length [len].
69 * and stores it into [digest]. [digest] should be pre-allocated to 69 * and stores it into [digest]. [digest] should be pre-allocated to
70 * SHA1_DIGEST_SIZE bytes. 70 * SHA1_DIGEST_SIZE bytes.
71 */ 71 */
72 uint8_t* SHA1(const uint8_t* data, uint64_t len, uint8_t* digest); 72 uint8_t* SHA1(const uint8_t* data, uint64_t len, uint8_t* digest);
73 73
74 /* Convenience function for SHA-256. Computes hash on [data] of length [len]. 74 /* Convenience function for SHA-256. Computes hash on [data] of length [len].
75 * and stores it into [digest]. [digest] should be pre-allocated to 75 * and stores it into [digest]. [digest] should be pre-allocated to
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 uint8_t* DigestFile(char* input_file, int sig_algorithm); 119 uint8_t* DigestFile(char* input_file, int sig_algorithm);
120 120
121 /* Returns the appropriate digest of [buf] of length 121 /* Returns the appropriate digest of [buf] of length
122 * [len] based on the signature [algorithm]. 122 * [len] based on the signature [algorithm].
123 * Caller owns the returned digest and must free it. 123 * Caller owns the returned digest and must free it.
124 */ 124 */
125 uint8_t* DigestBuf(const uint8_t* buf, uint64_t len, int sig_algorithm); 125 uint8_t* DigestBuf(const uint8_t* buf, uint64_t len, int sig_algorithm);
126 126
127 127
128 #endif /* VBOOT_REFERENCE_SHA_H_ */ 128 #endif /* VBOOT_REFERENCE_SHA_H_ */
OLDNEW
« no previous file with comments | « firmware/arch/arm/include/biosincludes.h ('k') | firmware/lib/cryptolib/sha2.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698