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

Side by Side Diff: firmware/lib/cryptolib/rsa_utility.c

Issue 2851015: Fixes to compiler warnings in MSVC (Closed) Base URL: ssh://gitrw.chromium.org/vboot_reference.git
Patch Set: Also fix gpt numbering bug Created 10 years, 6 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 unified diff | Download patch
OLDNEW
1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be 2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. 3 * found in the LICENSE file.
4 * 4 *
5 * Implementation of RSA utility functions. 5 * Implementation of RSA utility functions.
6 */ 6 */
7 7
8 #include "cryptolib.h" 8 #include "cryptolib.h"
9 #include "stateful_util.h" 9 #include "stateful_util.h"
10 #include "utility.h" 10 #include "utility.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 sig_size = siglen_map[algorithm]; 87 sig_size = siglen_map[algorithm];
88 88
89 if (key_blob && !key) 89 if (key_blob && !key)
90 verification_key = RSAPublicKeyFromBuf(key_blob, key_size); 90 verification_key = RSAPublicKeyFromBuf(key_blob, key_size);
91 else if (!key_blob && key) 91 else if (!key_blob && key)
92 verification_key = (RSAPublicKey*) key; /* Supress const warning. */ 92 verification_key = (RSAPublicKey*) key; /* Supress const warning. */
93 else 93 else
94 return 0; /* Both can't be NULL or non-NULL. */ 94 return 0; /* Both can't be NULL or non-NULL. */
95 95
96 digest = DigestBuf(buf, len, algorithm); 96 digest = DigestBuf(buf, len, algorithm);
97 success = RSAVerify(verification_key, sig, sig_size, algorithm, digest); 97 success = RSAVerify(verification_key, sig, (uint32_t)sig_size,
98 (uint8_t)algorithm, digest);
98 99
99 Free(digest); 100 Free(digest);
100 if (!key) 101 if (!key)
101 RSAPublicKeyFree(verification_key); /* Only free if we allocated it. */ 102 RSAPublicKeyFree(verification_key); /* Only free if we allocated it. */
102 return success; 103 return success;
103 } 104 }
104 105
105 /* Version of RSAVerifyBinary_f() where instead of the raw binary blob 106 /* Version of RSAVerifyBinary_f() where instead of the raw binary blob
106 * of data, its digest is passed as the argument. */ 107 * of data, its digest is passed as the argument. */
107 int RSAVerifyBinaryWithDigest_f(const uint8_t* key_blob, 108 int RSAVerifyBinaryWithDigest_f(const uint8_t* key_blob,
(...skipping 11 matching lines...) Expand all
119 key_size = RSAProcessedKeySize(algorithm); 120 key_size = RSAProcessedKeySize(algorithm);
120 sig_size = siglen_map[algorithm]; 121 sig_size = siglen_map[algorithm];
121 122
122 if (key_blob && !key) 123 if (key_blob && !key)
123 verification_key = RSAPublicKeyFromBuf(key_blob, key_size); 124 verification_key = RSAPublicKeyFromBuf(key_blob, key_size);
124 else if (!key_blob && key) 125 else if (!key_blob && key)
125 verification_key = (RSAPublicKey*) key; /* Supress const warning. */ 126 verification_key = (RSAPublicKey*) key; /* Supress const warning. */
126 else 127 else
127 return 0; /* Both can't be NULL or non-NULL. */ 128 return 0; /* Both can't be NULL or non-NULL. */
128 129
129 success = RSAVerify(verification_key, sig, sig_size, algorithm, digest); 130 success = RSAVerify(verification_key, sig, (uint32_t)sig_size,
131 (uint8_t)algorithm, digest);
130 132
131 if (!key) 133 if (!key)
132 RSAPublicKeyFree(verification_key); /* Only free if we allocated it. */ 134 RSAPublicKeyFree(verification_key); /* Only free if we allocated it. */
133 return success; 135 return success;
134 } 136 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698