refactor: Replace std::optional<bilingual_str> with util::Result

This commit is contained in:
Ryan Ofsky
2022-09-01 15:35:23 -04:00
parent 5f49cb1bc8
commit 8aa8f73adc
15 changed files with 66 additions and 65 deletions

View File

@@ -13,21 +13,21 @@
namespace kernel {
std::optional<bilingual_str> SanityChecks(const Context&)
util::Result<void> SanityChecks(const Context&)
{
if (!ECC_InitSanityCheck()) {
return Untranslated("Elliptic curve cryptography sanity check failure. Aborting.");
return util::Error{Untranslated("Elliptic curve cryptography sanity check failure. Aborting.")};
}
if (!Random_SanityCheck()) {
return Untranslated("OS cryptographic RNG sanity check failure. Aborting.");
return util::Error{Untranslated("OS cryptographic RNG sanity check failure. Aborting.")};
}
if (!ChronoSanityCheck()) {
return Untranslated("Clock epoch mismatch. Aborting.");
return util::Error{Untranslated("Clock epoch mismatch. Aborting.")};
}
return std::nullopt;
return {};
}
}