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

Unified Diff: src/platform/vboot_reference/utils/file_keys.c

Issue 652216: Vboot reference: A basic user-land verified boot firmware signing and verification utility. (Closed)
Patch Set: Style fixes. Segfault fix. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/platform/vboot_reference/utils/Makefile ('k') | src/platform/vboot_reference/utils/firmware_image.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform/vboot_reference/utils/file_keys.c
diff --git a/src/platform/vboot_reference/utils/file_keys.c b/src/platform/vboot_reference/utils/file_keys.c
index bcba749a4bb92c1d629959db629a3138d5d07453..2401a15e70d589447cb5c4103003e542817a4025 100644
--- a/src/platform/vboot_reference/utils/file_keys.c
+++ b/src/platform/vboot_reference/utils/file_keys.c
@@ -19,7 +19,7 @@
#include "rsa_utility.h"
#include "utility.h"
-uint8_t* BufferFromFile(char* input_file, int* len) {
+uint8_t* BufferFromFile(const char* input_file, uint32_t* len) {
int fd;
struct stat stat_fd;
uint8_t* buf = NULL;
@@ -49,15 +49,18 @@ uint8_t* BufferFromFile(char* input_file, int* len) {
return buf;
}
-RSAPublicKey* RSAPublicKeyFromFile(char* input_file) {
- int len;
+RSAPublicKey* RSAPublicKeyFromFile(const char* input_file) {
+ uint32_t len;
+ RSAPublicKey* key;
uint8_t* buf = BufferFromFile(input_file, &len);
- RSAPublicKey* key = RSAPublicKeyFromBuf(buf, len);
+ if (buf)
+ key = RSAPublicKeyFromBuf(buf, len);
Free(buf);
return key;
}
-uint8_t* SignatureFile(char* input_file, char* key_file, int algorithm) {
+uint8_t* SignatureFile(const char* input_file, const char* key_file,
+ int algorithm) {
char* sign_utility = "./sign_data.sh";
char* cmd; /* Command line to invoke. */
int cmd_len;
« no previous file with comments | « src/platform/vboot_reference/utils/Makefile ('k') | src/platform/vboot_reference/utils/firmware_image.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698