Vboot Reference: Refactor Code.

This CL does the following:
1) It adds a SignatureBuf function which uses the OpenSSL library to generate RSA signature. This is more robust than the previous way of invoking the command line "openssl" utility and capturing its output. No more unnecessary temporary files for signature operations.
2) It adds functions that allow direct manipulation of binary verified Firmware and Kernel Image blobs in memory.
3) It changes the structure field members for FirmwareImage to make it consistent with KernelImage. Now it's clearer which key is used when.
4) Minor bug fixes and slightly improved API for dealing verified boot firmware and kernel images.
5) Renames the RSA_verify function to prevent conflicts with OpenSSL since it's linked into the firmware utility binary.

Review URL: http://codereview.chromium.org/661353
This commit is contained in:
Gaurav Shah
2010-03-02 15:40:01 -08:00
parent 444e1e19f2
commit f5564fa98c
21 changed files with 675 additions and 490 deletions

View File

@@ -41,7 +41,7 @@ typedef struct MemcpyState {
/* Copy [len] bytes into [dst] only if there's enough data to read according
* to [state].
* On success, return [dst] and update [state]..
* On success, return [dst] and update [state].
* On failure, return NULL, set remaining len in state to -1.
*
* Useful for iterating through a binary blob to populate a struct. After the
@@ -49,5 +49,14 @@ typedef struct MemcpyState {
*/
void* StatefulMemcpy(MemcpyState* state, void* dst, int len);
/* Like StatefulMemcpy() but copies in the opposite direction, populating
* data from [src] into the buffer encapsulated in state [state].
* On success, return [src] and update [state].
* On failure, return NULL, set remaining_len in state to -1.
*
* Useful for iterating through a structure to populate a binary blob. After the
* first failure (buffer overrun), successive calls will always fail.
*/
const void* StatefulMemcpy_r(MemcpyState* state, const void* src, int len);
#endif /* VBOOT_REFERENCE_UTILITY_H_ */