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

Side by Side Diff: src/platform/vboot_reference/include/sha.h

Issue 744002: Vboot Reference: Make length types explicitly sized. (Closed)
Patch Set: 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 /* 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 typedef struct { 44 typedef struct {
45 uint64_t h[8]; 45 uint64_t h[8];
46 uint32_t tot_len; 46 uint32_t tot_len;
47 uint32_t len; 47 uint32_t len;
48 uint8_t block[2 * SHA512_BLOCK_SIZE]; 48 uint8_t block[2 * SHA512_BLOCK_SIZE];
49 uint8_t buf[SHA512_DIGEST_SIZE]; /* Used for storing the final digest. */ 49 uint8_t buf[SHA512_DIGEST_SIZE]; /* Used for storing the final digest. */
50 } SHA512_CTX; 50 } SHA512_CTX;
51 51
52 52
53 void SHA1_init(SHA1_CTX* ctx); 53 void SHA1_init(SHA1_CTX* ctx);
54 void SHA1_update(SHA1_CTX* ctx, const uint8_t* data, int len); 54 void SHA1_update(SHA1_CTX* ctx, const uint8_t* data, uint64_t len);
55 uint8_t* SHA1_final(SHA1_CTX* ctx); 55 uint8_t* SHA1_final(SHA1_CTX* ctx);
56 56
57 void SHA256_init(SHA256_CTX* ctx); 57 void SHA256_init(SHA256_CTX* ctx);
58 void SHA256_update(SHA256_CTX* ctx, const uint8_t* data, int len); 58 void SHA256_update(SHA256_CTX* ctx, const uint8_t* data, uint64_t len);
59 uint8_t* SHA256_final(SHA256_CTX* ctx); 59 uint8_t* SHA256_final(SHA256_CTX* ctx);
60 60
61 void SHA512_init(SHA512_CTX* ctx); 61 void SHA512_init(SHA512_CTX* ctx);
62 void SHA512_update(SHA512_CTX* ctx, const uint8_t* data, int len); 62 void SHA512_update(SHA512_CTX* ctx, const uint8_t* data, uint64_t len);
63 uint8_t* SHA512_final(SHA512_CTX* ctx); 63 uint8_t* SHA512_final(SHA512_CTX* ctx);
64 64
65 /* Convenience function for SHA-1. Computes hash on [data] of length [len]. 65 /* Convenience function for SHA-1. Computes hash on [data] of length [len].
66 * and stores it into [digest]. [digest] should be pre-allocated to 66 * and stores it into [digest]. [digest] should be pre-allocated to
67 * SHA1_DIGEST_SIZE bytes. 67 * SHA1_DIGEST_SIZE bytes.
68 */ 68 */
69 uint8_t* SHA1(const uint8_t* data, int len, uint8_t* digest); 69 uint8_t* SHA1(const uint8_t* data, uint64_t len, uint8_t* digest);
70 70
71 /* Convenience function for SHA-256. Computes hash on [data] of length [len]. 71 /* Convenience function for SHA-256. Computes hash on [data] of length [len].
72 * and stores it into [digest]. [digest] should be pre-allocated to 72 * and stores it into [digest]. [digest] should be pre-allocated to
73 * SHA256_DIGEST_SIZE bytes. 73 * SHA256_DIGEST_SIZE bytes.
74 */ 74 */
75 uint8_t* SHA256(const uint8_t* data, int len, uint8_t* digest); 75 uint8_t* SHA256(const uint8_t* data, uint64_t len, uint8_t* digest);
76 76
77 /* Convenience function for SHA-512. Computes hash on [data] of length [len]. 77 /* Convenience function for SHA-512. Computes hash on [data] of length [len].
78 * and stores it into [digest]. [digest] should be pre-allocated to 78 * and stores it into [digest]. [digest] should be pre-allocated to
79 * SHA512_DIGEST_SIZE bytes. 79 * SHA512_DIGEST_SIZE bytes.
80 */ 80 */
81 uint8_t* SHA512(const uint8_t* data, int len, uint8_t* digest); 81 uint8_t* SHA512(const uint8_t* data, uint64_t len, uint8_t* digest);
82 82
83 83
84 #endif /* VBOOT_REFERENCE_SHA_H_ */ 84 #endif /* VBOOT_REFERENCE_SHA_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698