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

Unified Diff: firmware/lib/cryptolib/rsa_utility.c

Issue 6733018: Use uint64_t and avoid down casting as much as possible. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git@master
Patch Set: Created 9 years, 9 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 | « firmware/lib/cryptolib/include/rsa.h ('k') | firmware/lib/vboot_common.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: firmware/lib/cryptolib/rsa_utility.c
diff --git a/firmware/lib/cryptolib/rsa_utility.c b/firmware/lib/cryptolib/rsa_utility.c
index cd127107ee4b752066a2e70db419e9103e62fc9f..cc653c680528facac9735676b87539fceaf5ad7b 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;
« no previous file with comments | « firmware/lib/cryptolib/include/rsa.h ('k') | firmware/lib/vboot_common.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698