summaryrefslogtreecommitdiff
path: root/host/include
diff options
context:
space:
mode:
authorGaurav Shah <gauravsh@chromium.org>2010-08-17 15:48:22 -0700
committerGaurav Shah <gauravsh@chromium.org>2010-08-17 15:48:22 -0700
commit47b593d84920479ae5955fcc6664635328376a10 (patch)
tree93ad19fec797e04f1fed53050225a5b0f5c51f7b /host/include
parent138acfe1ba4b567f470c67e22a8d9e2225beafb0 (diff)
downloadvboot-47b593d84920479ae5955fcc6664635328376a10.tar.gz
Add additional sanity checks to RSA verification code.
Also, make algorithm unsigned int in most places. BUG=chrome-os-partner:701 TEST=existing RSA verification tests still pass Review URL: http://codereview.chromium.org/3136017
Diffstat (limited to 'host/include')
-rw-r--r--host/include/file_keys.h2
-rw-r--r--host/include/signature_digest.h9
2 files changed, 6 insertions, 5 deletions
diff --git a/host/include/file_keys.h b/host/include/file_keys.h
index 285a3e5b..39fdc5ac 100644
--- a/host/include/file_keys.h
+++ b/host/include/file_keys.h
@@ -38,6 +38,6 @@ uint8_t* DigestFile(char* input_file, int sig_algorithm);
* Returns the signature. Caller owns the buffer and must Free() it.
*/
uint8_t* SignatureFile(const char* input_file, const char* key_file,
- int algorithm);
+ unsigned int algorithm);
#endif /* VBOOT_REFERENCE_FILE_KEYS_H_ */
diff --git a/host/include/signature_digest.h b/host/include/signature_digest.h
index 55662b94..40c27036 100644
--- a/host/include/signature_digest.h
+++ b/host/include/signature_digest.h
@@ -6,12 +6,12 @@
#ifndef VBOOT_REFERENCE_SIGNATURE_DIGEST_H_
#define VBOOT_REFERENCE_SIGNATURE_DIGEST_H_
-#include <inttypes.h>
+#include <stdint.h>
/* Returns a buffer with DigestInfo (which depends on [algorithm])
* prepended to [digest].
*/
-uint8_t* PrependDigestInfo(int algorithm, uint8_t* digest);
+uint8_t* PrependDigestInfo(unsigned int algorithm, uint8_t* digest);
/* Function that outputs the message digest of the contents of a buffer in a
* format that can be used as input to OpenSSL for an RSA signature.
@@ -22,7 +22,8 @@ uint8_t* PrependDigestInfo(int algorithm, uint8_t* digest);
* choice of the hash algorithm (see padding.c). Caller owns the returned
* pointer and must Free() it.
*/
-uint8_t* SignatureDigest(const uint8_t* buf, uint64_t len, int algorithm);
+uint8_t* SignatureDigest(const uint8_t* buf, uint64_t len,
+ unsigned int algorithm);
/* Calculates the signature on a buffer [buf] of length [len] using
* the private RSA key file from [key_file] and signature algorithm
@@ -31,5 +32,5 @@ uint8_t* SignatureDigest(const uint8_t* buf, uint64_t len, int algorithm);
* Returns the signature. Caller owns the buffer and must Free() it.
*/
uint8_t* SignatureBuf(const uint8_t* buf, uint64_t len, const char* key_file,
- int algorithm);
+ unsigned int algorithm);
#endif /* VBOOT_REFERENCE_SIGNATURE_DIGEST_H_ */