| 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 * Utility functions for message digests. | 5 * Utility functions for message digests. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef VBOOT_REFERENCE_SHA_UTILITY_H_ | 8 #ifndef VBOOT_REFERENCE_SHA_UTILITY_H_ |
| 9 #define VBOOT_REFERENCE_SHA_UTILITY_H_ | 9 #define VBOOT_REFERENCE_SHA_UTILITY_H_ |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 int algorithm; /* Hashing algorithm to use. */ | 26 int algorithm; /* Hashing algorithm to use. */ |
| 27 } DigestContext; | 27 } DigestContext; |
| 28 | 28 |
| 29 /* Wrappers for message digest algorithms. These are useful when the hashing | 29 /* Wrappers for message digest algorithms. These are useful when the hashing |
| 30 * operation is being done in parallel with something else. DigestContext tracks | 30 * operation is being done in parallel with something else. DigestContext tracks |
| 31 * and stores the state of any digest algorithm (one at any given time). | 31 * and stores the state of any digest algorithm (one at any given time). |
| 32 */ | 32 */ |
| 33 | 33 |
| 34 /* Initialize a digest context for use with signature algorithm [algorithm]. */ | 34 /* Initialize a digest context for use with signature algorithm [algorithm]. */ |
| 35 void DigestInit(DigestContext* ctx, int sig_algorithm); | 35 void DigestInit(DigestContext* ctx, int sig_algorithm); |
| 36 void DigestUpdate(DigestContext* ctx, const uint8_t* data, int len); | 36 void DigestUpdate(DigestContext* ctx, const uint8_t* data, uint64_t len); |
| 37 | 37 |
| 38 /* Caller owns the returned digest and must free it. */ | 38 /* Caller owns the returned digest and must free it. */ |
| 39 uint8_t* DigestFinal(DigestContext* ctx); | 39 uint8_t* DigestFinal(DigestContext* ctx); |
| 40 | 40 |
| 41 /* Returns the appropriate digest for the data in [input_file] | 41 /* Returns the appropriate digest for the data in [input_file] |
| 42 * based on the signature [algorithm]. | 42 * based on the signature [algorithm]. |
| 43 * Caller owns the returned digest and must free it. | 43 * Caller owns the returned digest and must free it. |
| 44 */ | 44 */ |
| 45 uint8_t* DigestFile(char* input_file, int sig_algorithm); | 45 uint8_t* DigestFile(char* input_file, int sig_algorithm); |
| 46 | 46 |
| 47 /* Returns the appropriate digest of [buf] of length | 47 /* Returns the appropriate digest of [buf] of length |
| 48 * [len] based on the signature [algorithm]. | 48 * [len] based on the signature [algorithm]. |
| 49 * Caller owns the returned digest and must free it. | 49 * Caller owns the returned digest and must free it. |
| 50 */ | 50 */ |
| 51 uint8_t* DigestBuf(const uint8_t* buf, int len, int sig_algorithm); | 51 uint8_t* DigestBuf(const uint8_t* buf, uint64_t len, int sig_algorithm); |
| 52 | 52 |
| 53 #endif /* VBOOT_REFERENCE_SHA_UTILITY_H_ */ | 53 #endif /* VBOOT_REFERENCE_SHA_UTILITY_H_ */ |
| OLD | NEW |