Update return FALSE to ASSERT() for code consistent.

Signed-off-by: tye
Reviewed-by: jyao1




git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12659 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
tye1 2011-11-04 02:55:30 +00:00
parent 8536cc4b37
commit d3945da644
4 changed files with 19 additions and 31 deletions

View File

@ -84,10 +84,7 @@ RsaGetPrivateKeyFromPem (
// //
ASSERT (PemData != NULL); ASSERT (PemData != NULL);
ASSERT (RsaContext != NULL); ASSERT (RsaContext != NULL);
ASSERT (PemSize <= INT_MAX);
if (PemSize > INT_MAX) {
return FALSE;
}
Status = FALSE; Status = FALSE;
PemBio = NULL; PemBio = NULL;

View File

@ -60,14 +60,11 @@ AuthenticodeVerify (
UINTN ContentSize; UINTN ContentSize;
// //
// ASSERT if Authenticode Signature Data or PE Image Hash is NULL // ASSERT if Authenticode Signature Data or PE Image Hash is NULL.
// //
ASSERT (AuthData != NULL); ASSERT (AuthData != NULL);
ASSERT (ImageHash != NULL); ASSERT (ImageHash != NULL);
ASSERT (DataSize <= INT_MAX);
if (DataSize > INT_MAX) {
return FALSE;
}
Status = FALSE; Status = FALSE;
Pkcs7 = NULL; Pkcs7 = NULL;

View File

@ -150,17 +150,13 @@ Pkcs7Sign (
// //
// Check input parameters. // Check input parameters.
// //
if ((PrivateKey == NULL) || (KeyPassword == NULL) || (InData == NULL)) { ASSERT (PrivateKey != NULL);
return FALSE; ASSERT (KeyPassword != NULL);
} ASSERT (InData != NULL);
ASSERT (SignCert != NULL);
if ((SignCert == NULL) || (SignedData == NULL) || (SignedDataSize == NULL)) { ASSERT (SignedData != NULL);
return FALSE; ASSERT (SignedDataSize != NULL);
} ASSERT (InDataSize <= INT_MAX);
if (InDataSize > INT_MAX) {
return FALSE;
}
RsaContext = NULL; RsaContext = NULL;
Key = NULL; Key = NULL;
@ -311,13 +307,14 @@ Pkcs7Verify (
BOOLEAN Wrapped; BOOLEAN Wrapped;
// //
// ASSERT if P7Data is NULL or P7Length is not larger than 19 bytes. // ASSERT if any input parameter is invalid.
// //
ASSERT ((P7Data != NULL) || (P7Length <= 19)); ASSERT (P7Data != NULL);
ASSERT (TrustedCert != NULL);
if ((CertLength > INT_MAX) || (DataLength > INT_MAX)) { ASSERT (InData != NULL);
return FALSE; ASSERT (P7Length <= INT_MAX);
} ASSERT (CertLength <= INT_MAX);
ASSERT (DataLength <= INT_MAX);
Status = FALSE; Status = FALSE;
Pkcs7 = NULL; Pkcs7 = NULL;

View File

@ -45,12 +45,9 @@ X509ConstructCertificate (
// //
// ASSERT if Cert is NULL or SingleX509Cert is NULL. // ASSERT if Cert is NULL or SingleX509Cert is NULL.
// //
ASSERT (Cert != NULL); ASSERT (Cert != NULL);
ASSERT (SingleX509Cert != NULL); ASSERT (SingleX509Cert != NULL);
ASSERT (CertSize <= INT_MAX);
if (CertSize > INT_MAX) {
return FALSE;
}
Status = FALSE; Status = FALSE;