Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! fixup! fixup! src: eliminate ManagedEVPPkey
Browse files Browse the repository at this point in the history
  • Loading branch information
jasnell committed Sep 4, 2024
1 parent 713bc26 commit ede3f72
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/crypto/crypto_keygen.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,9 @@ struct KeyPairGenConfig final : public MemoryRetainer {

KeyPairGenConfig() = default;
~KeyPairGenConfig() {
Mutex::ScopedLock priv_lock(key->mutex());
if (key) {
Mutex::ScopedLock priv_lock(key->mutex());
}
}

explicit KeyPairGenConfig(KeyPairGenConfig&& other) noexcept
Expand Down
17 changes: 9 additions & 8 deletions src/crypto/crypto_keys.cc
Original file line number Diff line number Diff line change
Expand Up @@ -763,18 +763,19 @@ std::shared_ptr<KeyObjectData> KeyObjectData::GetParsedKey(
ParseKeyResult ret,
const char* default_msg) {
switch (ret) {
case ParseKeyResult::kParseKeyOk:
CHECK(pkey);
break;
case ParseKeyResult::kParseKeyNeedPassphrase:
case ParseKeyResult::kParseKeyOk: {
return CreateAsymmetric(type, std::move(pkey));
}
case ParseKeyResult::kParseKeyNeedPassphrase: {
THROW_ERR_MISSING_PASSPHRASE(env,
"Passphrase required for encrypted key");
break;
default:
return {};
}
default: {
ThrowCryptoError(env, ERR_get_error(), default_msg);
return {};
}
}

return CreateAsymmetric(type, std::move(pkey));
}

KeyObjectData::KeyObjectData(Private, ByteSource symmetric_key)
Expand Down

0 comments on commit ede3f72

Please sign in to comment.