Merge "Minor fixes." am: fc9ba206e4
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1729310 Change-Id: I8089022f7fa85d0974dddc4a510d4ac504236b23
This commit is contained in:
commit
2fe224e138
2 changed files with 7 additions and 6 deletions
|
@ -196,9 +196,9 @@ Result<std::vector<uint8_t>> extractPublicKey(EVP_PKEY* pkey) {
|
|||
Result<std::vector<uint8_t>>
|
||||
extractPublicKeyFromSubjectPublicKeyInfo(const std::vector<uint8_t>& keyData) {
|
||||
auto keyDataBytes = keyData.data();
|
||||
EVP_PKEY* public_key = d2i_PUBKEY(nullptr, &keyDataBytes, keyData.size());
|
||||
bssl::UniquePtr<EVP_PKEY> public_key(d2i_PUBKEY(nullptr, &keyDataBytes, keyData.size()));
|
||||
|
||||
return extractPublicKey(public_key);
|
||||
return extractPublicKey(public_key.get());
|
||||
}
|
||||
|
||||
Result<std::vector<uint8_t>> extractPublicKeyFromX509(const std::vector<uint8_t>& keyData) {
|
||||
|
@ -213,18 +213,19 @@ Result<std::vector<uint8_t>> extractPublicKeyFromX509(const std::vector<uint8_t>
|
|||
}
|
||||
|
||||
Result<std::vector<uint8_t>> extractPublicKeyFromX509(const std::string& path) {
|
||||
X509* cert;
|
||||
X509* rawCert;
|
||||
auto f = fopen(path.c_str(), "re");
|
||||
if (f == nullptr) {
|
||||
return Error() << "Failed to open " << path;
|
||||
}
|
||||
if (!d2i_X509_fp(f, &cert)) {
|
||||
if (!d2i_X509_fp(f, &rawCert)) {
|
||||
fclose(f);
|
||||
return Error() << "Unable to decode x509 cert at " << path;
|
||||
}
|
||||
bssl::UniquePtr<X509> cert(rawCert);
|
||||
|
||||
fclose(f);
|
||||
return extractPublicKey(X509_get_pubkey(cert));
|
||||
return extractPublicKey(X509_get_pubkey(cert.get()));
|
||||
}
|
||||
|
||||
Result<std::vector<uint8_t>> createPkcs7(const std::vector<uint8_t>& signed_digest) {
|
||||
|
|
|
@ -255,7 +255,7 @@ Result<void> addCertToFsVerityKeyring(const std::string& path) {
|
|||
char* argv_child[argc + 1];
|
||||
memcpy(argv_child, argv, argc * sizeof(char*));
|
||||
argv_child[argc] = nullptr;
|
||||
execvp(argv_child[0], const_cast<char**>(argv_child));
|
||||
execvp(argv_child[0], argv_child);
|
||||
PLOG(ERROR) << "exec in ForkExecvp";
|
||||
_exit(EXIT_FAILURE);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue