summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'trusty/nvram/nvram_wipe.cpp')
-rw-r--r--trusty/nvram/nvram_wipe.cpp66
1 files changed, 0 insertions, 66 deletions
diff --git a/trusty/nvram/nvram_wipe.cpp b/trusty/nvram/nvram_wipe.cpp
deleted file mode 100644
index d0f4faded..000000000
--- a/trusty/nvram/nvram_wipe.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
1/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <stdio.h>
18#include <stdlib.h>
19#include <string.h>
20
21#include <nvram/messages/nvram_messages.h>
22
23#include "trusty_nvram_implementation.h"
24
25void usage(const char* program_name) {
26 fprintf(stderr, "Usage: %s [status|disable|wipe]\n", program_name);
27 exit(-1);
28}
29
30int main(int argc, char* argv[]) {
31 if (argc < 2) {
32 usage(argv[0]);
33 }
34
35 nvram::TrustyNvramImplementation nvram_proxy;
36 nvram::Request request;
37 nvram::Response response;
38
39 if (!strcmp(argv[1], "status")) {
40 request.payload.Activate<nvram::COMMAND_GET_INFO>();
41 nvram_proxy.Execute(request, &response);
42 const nvram::GetInfoResponse* get_info_response =
43 response.payload.get<nvram::COMMAND_GET_INFO>();
44 if (response.result == NV_RESULT_SUCCESS) {
45 int status = get_info_response && get_info_response->wipe_disabled;
46 printf("Wiping disabled: %d\n", status);
47 return status;
48 }
49 } else if (!strcmp(argv[1], "disable")) {
50 request.payload.Activate<nvram::COMMAND_DISABLE_WIPE>();
51 nvram_proxy.Execute(request, &response);
52 } else if (!strcmp(argv[1], "wipe")) {
53 request.payload.Activate<nvram::COMMAND_WIPE_STORAGE>();
54 nvram_proxy.Execute(request, &response);
55 } else {
56 usage(argv[0]);
57 }
58
59 if (response.result != NV_RESULT_SUCCESS) {
60 fprintf(stderr, "Command execution failure: %u\n", response.result);
61 return -1;
62 }
63
64 return 0;
65}
66