diff options
author | Gaurav Shah <gauravsh@chromium.org> | 2011-03-25 14:02:13 -0700 |
---|---|---|
committer | Gaurav Shah <gauravsh@chromium.org> | 2011-03-25 14:02:13 -0700 |
commit | d583a30a7c3bd369f82c0428666c7a708d5341d5 (patch) | |
tree | 1e6bde436996b6e0127833db4f1225afb682b75a /firmware/lib/cryptolib | |
parent | 2c7213d4dc5cef71b5cf76c44a12ff14e15dfeb4 (diff) | |
download | vboot-d583a30a7c3bd369f82c0428666c7a708d5341d5.tar.gz |
Use uint64_t and avoid down casting as much as possible.
Change-Id: I231d1b3a059907c3806feced7e1b8f1c06575ba5
BUG=chromeos-partner:2912
TEST=make clean all && make runtests
Review URL: http://codereview.chromium.org/6733018
Diffstat (limited to 'firmware/lib/cryptolib')
-rw-r--r-- | firmware/lib/cryptolib/include/rsa.h | 4 | ||||
-rw-r--r-- | firmware/lib/cryptolib/rsa_utility.c | 14 |
2 files changed, 9 insertions, 9 deletions
diff --git a/firmware/lib/cryptolib/include/rsa.h b/firmware/lib/cryptolib/include/rsa.h index f5b83efa..eff608dc 100644 --- a/firmware/lib/cryptolib/include/rsa.h +++ b/firmware/lib/cryptolib/include/rsa.h @@ -75,7 +75,7 @@ int RSAVerifyBinaryWithDigest_f(const uint8_t* key_blob, * * Returns 1 on success, 0 on failure. */ -int RSAProcessedKeySize(unsigned int algorithm, int* out_size); +uint64_t RSAProcessedKeySize(uint64_t algorithm, uint64_t* out_size); /* Allocate a new RSAPublicKey structure and initialize its pointer fields to * NULL */ @@ -89,7 +89,7 @@ void RSAPublicKeyFree(RSAPublicKey* key); * * Caller owns the returned key and must free it. */ -RSAPublicKey* RSAPublicKeyFromBuf(const uint8_t* buf, int len); +RSAPublicKey* RSAPublicKeyFromBuf(const uint8_t* buf, uint64_t len); #endif /* VBOOT_REFERENCE_RSA_H_ */ diff --git a/firmware/lib/cryptolib/rsa_utility.c b/firmware/lib/cryptolib/rsa_utility.c index cd127107..cc653c68 100644 --- a/firmware/lib/cryptolib/rsa_utility.c +++ b/firmware/lib/cryptolib/rsa_utility.c @@ -9,9 +9,9 @@ #include "stateful_util.h" #include "utility.h" -int RSAProcessedKeySize(unsigned int algorithm, int* out_size) { - int key_len; /* Key length in bytes. */ - if (algorithm < (unsigned int)kNumAlgorithms) { +uint64_t RSAProcessedKeySize(uint64_t algorithm, uint64_t* out_size) { + uint64_t key_len; /* Key length in bytes. */ + if (algorithm < kNumAlgorithms) { key_len = siglen_map[algorithm]; /* Total size needed by a RSAPublicKey structure is = * 2 * key_len bytes for the n and rr arrays @@ -38,10 +38,10 @@ void RSAPublicKeyFree(RSAPublicKey* key) { } } -RSAPublicKey* RSAPublicKeyFromBuf(const uint8_t* buf, int len) { +RSAPublicKey* RSAPublicKeyFromBuf(const uint8_t* buf, uint64_t len) { RSAPublicKey* key = RSAPublicKeyNew(); MemcpyState st; - int key_len; + uint64_t key_len; st.remaining_buf = (uint8_t*) buf; st.remaining_len = len; @@ -81,7 +81,7 @@ int RSAVerifyBinary_f(const uint8_t* key_blob, unsigned int algorithm) { RSAPublicKey* verification_key = NULL; uint8_t* digest = NULL; - int key_size; + uint64_t key_size; int sig_size; int success; @@ -120,7 +120,7 @@ int RSAVerifyBinaryWithDigest_f(const uint8_t* key_blob, const uint8_t* sig, unsigned int algorithm) { RSAPublicKey* verification_key = NULL; - int key_size; + uint64_t key_size; int sig_size; int success; |