mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-27 03:33:50 +00:00
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
This commit is contained in:
@@ -114,12 +114,14 @@ int PublicKeyCopy(VbPublicKey* dest, const VbPublicKey* src) {
|
||||
|
||||
RSAPublicKey* PublicKeyToRSA(const VbPublicKey* key) {
|
||||
RSAPublicKey *rsa;
|
||||
int key_size;
|
||||
|
||||
if (kNumAlgorithms <= key->algorithm) {
|
||||
VBDEBUG(("Invalid algorithm.\n"));
|
||||
return NULL;
|
||||
}
|
||||
if (RSAProcessedKeySize((int)key->algorithm) != (int)key->key_size) {
|
||||
if (!RSAProcessedKeySize((int)key->algorithm, &key_size) ||
|
||||
key_size != (int)key->key_size) {
|
||||
VBDEBUG(("Wrong key size for algorithm\n"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user