Loading set-verity-state/set-verity-state.cpp +10 −21 Original line number Diff line number Diff line Loading @@ -24,6 +24,8 @@ #include <fs_mgr_overlayfs.h> #include <log/log_properties.h> using namespace std::string_literals; #ifdef ALLOW_DISABLE_VERITY static const bool kAllowDisableVerity = true; #else Loading Loading @@ -95,31 +97,18 @@ int main(int argc, char* argv[]) { LOG(FATAL) << "set-verity-state called with empty argv"; } std::optional<bool> enable_opt; bool enable = false; std::string procname = android::base::Basename(argv[0]); if (procname == "enable-verity") { enable_opt = true; enable = true; } else if (procname == "disable-verity") { enable_opt = false; } if (!enable_opt.has_value()) { if (argc != 2) { printf("usage: %s [1|0]\n", argv[0]); return 1; } if (strcmp(argv[1], "1") == 0) { enable_opt = true; } else if (strcmp(argv[1], "0") == 0) { enable_opt = false; enable = false; } else if (argc == 2 && (argv[1] == "1"s || argv[1] == "0"s)) { enable = (argv[1] == "1"s); } else { printf("usage: %s [1|0]\n", argv[0]); return 1; } } bool enable = enable_opt.value(); // Figure out if we're using VB1.0 or VB2.0 (aka AVB) - by // contract, androidboot.vbmeta.digest is set by the bootloader Loading Loading
set-verity-state/set-verity-state.cpp +10 −21 Original line number Diff line number Diff line Loading @@ -24,6 +24,8 @@ #include <fs_mgr_overlayfs.h> #include <log/log_properties.h> using namespace std::string_literals; #ifdef ALLOW_DISABLE_VERITY static const bool kAllowDisableVerity = true; #else Loading Loading @@ -95,31 +97,18 @@ int main(int argc, char* argv[]) { LOG(FATAL) << "set-verity-state called with empty argv"; } std::optional<bool> enable_opt; bool enable = false; std::string procname = android::base::Basename(argv[0]); if (procname == "enable-verity") { enable_opt = true; enable = true; } else if (procname == "disable-verity") { enable_opt = false; } if (!enable_opt.has_value()) { if (argc != 2) { printf("usage: %s [1|0]\n", argv[0]); return 1; } if (strcmp(argv[1], "1") == 0) { enable_opt = true; } else if (strcmp(argv[1], "0") == 0) { enable_opt = false; enable = false; } else if (argc == 2 && (argv[1] == "1"s || argv[1] == "0"s)) { enable = (argv[1] == "1"s); } else { printf("usage: %s [1|0]\n", argv[0]); return 1; } } bool enable = enable_opt.value(); // Figure out if we're using VB1.0 or VB2.0 (aka AVB) - by // contract, androidboot.vbmeta.digest is set by the bootloader Loading