summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSangyoon Jang <jeremy.jang@samsung.com>2024-07-01 15:44:46 +0900
committerSangyoon Jang <jeremy.jang@samsung.com>2024-07-01 15:45:07 +0900
commitcd2cd4a518546c6838b998ef02a81ba49d2c2e10 (patch)
treef280692fbb8ffa1ecc3589371355a9af473ed72b
parentf500dd10d77c25aaf88316b03e57e43b307449b0 (diff)
downloadapp-installers-cd2cd4a518546c6838b998ef02a81ba49d2c2e10.tar.gz
app-installers-cd2cd4a518546c6838b998ef02a81ba49d2c2e10.tar.bz2
app-installers-cd2cd4a518546c6838b998ef02a81ba49d2c2e10.zip
Fix a static analysis issue
Change-Id: Ic14ed2985ff4a035fa89c453626e4db96cdf2b69 Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
-rw-r--r--src/common/certificate_validation.cc24
1 files changed, 8 insertions, 16 deletions
diff --git a/src/common/certificate_validation.cc b/src/common/certificate_validation.cc
index 0d7b9244..50710646 100644
--- a/src/common/certificate_validation.cc
+++ b/src/common/certificate_validation.cc
@@ -94,7 +94,7 @@ bool SetDistributor2Certificate(const ValidationCore::SignatureData& data,
false);
}
-bool SetSignature(std::ifstream* ifs,
+void SetSignature(std::ifstream* ifs,
ValidationCore::CertificatePtr* certificate,
std::string* cert_str) {
std::string cert;
@@ -106,11 +106,9 @@ bool SetSignature(std::ifstream* ifs,
*certificate = std::move(cert_ptr);
*cert_str = std::move(cert);
}
-
- return true;
}
-bool ReadSignature(std::ifstream* ifs,
+void ReadSignature(std::ifstream* ifs,
ValidationCore::CertificatePtr* cert,
ValidationCore::CertificatePtr* im_cert,
ValidationCore::CertificatePtr* root_cert,
@@ -119,7 +117,6 @@ bool ReadSignature(std::ifstream* ifs,
SetSignature(ifs, cert, root_cert_str);
SetSignature(ifs, im_cert, root_cert_str);
SetSignature(ifs, root_cert, root_cert_str);
- return true;
}
} // namespace
@@ -283,17 +280,12 @@ bool GetSignatureFromFile(const std::string& pkgid,
return false;
}
- if (!ReadSignature(&ifs,
- &cert_info->dist2_cert.get(),
- &cert_info->dist2_im_cert.get(),
- &cert_info->dist2_root_cert.get(),
- &root_cert) ||
- !ReadSignature(&ifs,
- &cert_info->dist_cert.get(),
- &cert_info->dist_im_cert.get(),
- &cert_info->dist_root_cert.get(),
- &root_cert))
- return false;
+ ReadSignature(&ifs, &cert_info->dist2_cert.get(),
+ &cert_info->dist2_im_cert.get(), &cert_info->dist2_root_cert.get(),
+ &root_cert);
+ ReadSignature(&ifs, &cert_info->dist_cert.get(),
+ &cert_info->dist_im_cert.get(), &cert_info->dist_root_cert.get(),
+ &root_cert);
if (root_cert.length() == 0) {
LOG(INFO) << "Dist root cert not exists";
return false;