forked from Drive-Trust-Alliance/sedutil
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDtaOptions.cpp
520 lines (514 loc) · 20.1 KB
/
DtaOptions.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
/* C:B**************************************************************************
This software is Copyright 2014-2017 Bright Plaza Inc. <drivetrust@drivetrust.com>
This file is part of sedutil.
sedutil is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
sedutil is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with sedutil. If not, see <http://www.gnu.org/licenses/>.
* C:E********************************************************************** */
#include "os.h"
#include "DtaOptions.h"
#include "DtaLexicon.h"
#include "Version.h"
void usage()
{
printf("sedutil v%s Copyright 2014-2017 Bright Plaza Inc. <drivetrust@drivetrust.com>\n", GIT_VERSION);
printf("a utility to manage self encrypting drives that conform\n");
printf("to the Trusted Computing Group OPAL 2.0 SSC specification\n");
printf("General Usage: (see readme for extended commandset)\n");
printf("sedutil-cli <-v> <-n> <action> <options> <device>\n");
printf("-v (optional) increase verbosity, one to five v's\n");
printf("-n (optional) no password hashing. Passwords will be sent in clear text!\n");
printf("-l (optional) log style output to stderr only\n");
printf("actions \n");
printf("--scan \n");
printf(" Scans the devices on the system \n");
printf(" identifying Opal compliant devices \n");
printf("--query <device>\n");
printf(" Display the Discovery 0 response of a device\n");
printf("--isValidSED <device>\n");
printf(" Verify whether the given device is SED or not\n");
printf("--listLockingRanges <password> <device>\n");
printf(" List all Locking Ranges\n");
printf("--listLockingRange <0...n> <password> <device>\n");
printf(" List all Locking Ranges\n");
printf(" 0 = GLobal 1..n = LRn \n");
printf("--rekeyLockingRange <0...n> <password> <device>\n");
printf(" 0 = GLobal 1..n = LRn \n");
printf(" Rekey Locking Range\n");
printf("--setBandsEnabled <password> <device>\n");
printf(" Set Enabled for all Locking Ranges\n");
printf(" (passwort = \"\" for MSID) \n");
printf("--setBandEnabled <0...n> <password> <device>\n");
printf(" Set Enabled for Locking Range[n]\n");
printf(" (passwort = \"\" for MSID) \n");
printf("--eraseLockingRange <0...n> <password> <device>\n");
printf(" Erase a Locking Range\n");
printf(" 0 = GLobal 1..n = LRn \n");
printf("--setupLockingRange <0...n> <RangeStart> <RangeLength> <password> <device>\n");
printf(" Setup a new Locking Range\n");
printf(" 0 = GLobal 1..n = LRn \n");
printf("--initialSetup <SIDpassword> <device>\n");
printf(" Setup the device for use with sedutil\n");
printf(" <SIDpassword> is new SID and Admin1 password\n");
printf("--setSIDPassword <SIDpassword> <newSIDpassword> <device> \n");
printf(" Change the SID password\n");
printf("--setAdmin1Pwd <Admin1password> <newAdmin1password> <device> \n");
printf(" Change the Admin1 password\n");
printf("--setPassword <oldpassword, \"\" for MSID> <userid> <newpassword> <device> \n");
printf(" Change the Enterprise password for userid\n");
printf(" \"EraseMaster\" or \"BandMaster<n>\", 0 <= n <= 1023\n");
printf("--setLockingRange <0...n> <RW|RO|LK> <Admin1password> <device> \n");
printf(" Set the status of a Locking Range\n");
printf(" 0 = GLobal 1..n = LRn \n");
printf("--enableLockingRange <0...n> <Admin1password> <device> \n");
printf(" Enable a Locking Range\n");
printf(" 0 = GLobal 1..n = LRn \n");
printf("--disableLockingRange <0...n> <Admin1password> <device> \n");
printf(" Disable a Locking Range\n");
printf(" 0 = GLobal 1..n = LRn \n");
printf("--setMBREnable <on|off> <Admin1password> <device> \n");
printf(" Enable|Disable MBR shadowing \n");
printf("--setMBRDone <on|off> <Admin1password> <device> \n");
printf(" set|unset MBRDone\n");
printf("--loadPBAimage <Admin1password> <file> <device> \n");
printf(" Write <file> to MBR Shadow area\n");
printf("--revertTPer <SIDpassword> <device>\n");
printf(" set the device back to factory defaults \n");
printf(" This **ERASES ALL DATA** \n");
printf("--revertNoErase <Admin1password> <device>\n");
printf(" deactivate the Locking SP \n");
printf(" without erasing the data \n");
printf(" on GLOBAL RANGE *ONLY* \n");
printf("--yesIreallywanttoERASEALLmydatausingthePSID <PSID> <device>\n");
printf(" revert the device using the PSID *ERASING* *ALL* the data \n");
printf("--printDefaultPassword <device>\n");
printf(" print MSID \n");
printf("\n");
printf("Examples \n");
printf("sedutil-cli --scan \n");
printf("sedutil-cli --query %s \n", DEVICEEXAMPLE);
printf("sedutil-cli --yesIreallywanttoERASEALLmydatausingthePSID <PSIDALLCAPSNODASHED> %s \n", DEVICEEXAMPLE);
printf("sedutil-cli --initialSetup <newSIDpassword> %s \n", DEVICEEXAMPLE);
return;
}
uint8_t DtaOptions(int argc, char * argv[], DTA_OPTIONS * opts)
{
memset(opts, 0, sizeof (DTA_OPTIONS));
uint16_t loggingLevel = 2;
uint8_t baseOptions = 2; // program and option
CLog::Level() = CLog::FromInt(loggingLevel);
RCLog::Level() = RCLog::FromInt(loggingLevel);
if (2 > argc) {
usage();
return DTAERROR_INVALID_COMMAND;
}
for (uint8_t i = 1; i < argc; i++) {
if (!(strcmp("-h", argv[i])) || !(strcmp("--help", argv[i]))) {
usage();
return DTAERROR_INVALID_COMMAND;
}
else if ('v' == argv[i][1])
{
baseOptions += 1;
loggingLevel += (uint16_t)(strlen(argv[i]) - 1);
if (loggingLevel > 7) loggingLevel = 7;
CLog::Level() = CLog::FromInt(loggingLevel);
LOG(D) << "Log level set to " << CLog::ToString(CLog::FromInt(loggingLevel));
LOG(D) << "sedutil version : " << GIT_VERSION;
}
else if (!(strcmp("-n", argv[i]))) {
baseOptions += 1;
opts->no_hash_passwords = true;
LOG(D) << "Password hashing is disabled";
}
else if (!strcmp("-l", argv[i])) {
baseOptions += 1;
opts->output_format = sedutilNormal;
outputFormat = sedutilNormal;
}
else if (!(('-' == argv[i][0]) && ('-' == argv[i][1])) &&
(0 == opts->action))
{
LOG(E) << "Argument " << (uint16_t) i << " (" << argv[i] << ") should be a command";
return DTAERROR_INVALID_COMMAND;
}
BEGIN_OPTION(initialSetup, 2) OPTION_IS(password) OPTION_IS(device) END_OPTION
BEGIN_OPTION(setSIDPassword, 3) OPTION_IS(password) OPTION_IS(newpassword)
OPTION_IS(device) END_OPTION
BEGIN_OPTION(setup_SUM, 6)
TESTARG(0, lockingrange, 0)
TESTARG(1, lockingrange, 1)
TESTARG(2, lockingrange, 2)
TESTARG(3, lockingrange, 3)
TESTARG(4, lockingrange, 4)
TESTARG(5, lockingrange, 5)
TESTARG(6, lockingrange, 6)
TESTARG(7, lockingrange, 7)
TESTARG(8, lockingrange, 8)
TESTARG(9, lockingrange, 9)
TESTARG(10, lockingrange, 10)
TESTARG(11, lockingrange, 11)
TESTARG(12, lockingrange, 12)
TESTARG(13, lockingrange, 13)
TESTARG(14, lockingrange, 14)
TESTARG(15, lockingrange, 15)
TESTFAIL("Invalid Locking Range (0-15)")
OPTION_IS(lrstart)
OPTION_IS(lrlength)
OPTION_IS(password)
OPTION_IS(newpassword)
OPTION_IS(device)
END_OPTION
BEGIN_OPTION(setAdmin1Pwd, 3) OPTION_IS(password) OPTION_IS(newpassword)
OPTION_IS(device) END_OPTION
BEGIN_OPTION(loadPBAimage, 3) OPTION_IS(password) OPTION_IS(pbafile)
OPTION_IS(device) END_OPTION
BEGIN_OPTION(revertTPer, 2) OPTION_IS(password) OPTION_IS(device) END_OPTION
BEGIN_OPTION(revertNoErase, 2) OPTION_IS(password) OPTION_IS(device) END_OPTION
BEGIN_OPTION(PSIDrevert, 2) OPTION_IS(password) OPTION_IS(device) END_OPTION
BEGIN_OPTION(PSIDrevertAdminSP, 2) OPTION_IS(password) OPTION_IS(device) END_OPTION
BEGIN_OPTION(yesIreallywanttoERASEALLmydatausingthePSID, 2) OPTION_IS(password)
OPTION_IS(device) END_OPTION
BEGIN_OPTION(enableuser, 2) OPTION_IS(password) OPTION_IS(userid)
OPTION_IS(device) END_OPTION
BEGIN_OPTION(activateLockingSP, 2) OPTION_IS(password) OPTION_IS(device) END_OPTION
BEGIN_OPTION(activateLockingSP_SUM, 3)
TESTARG(0, lockingrange, 0)
TESTARG(1, lockingrange, 1)
TESTARG(2, lockingrange, 2)
TESTARG(3, lockingrange, 3)
TESTARG(4, lockingrange, 4)
TESTARG(5, lockingrange, 5)
TESTARG(6, lockingrange, 6)
TESTARG(7, lockingrange, 7)
TESTARG(8, lockingrange, 8)
TESTARG(9, lockingrange, 9)
TESTARG(10, lockingrange, 10)
TESTARG(11, lockingrange, 11)
TESTARG(12, lockingrange, 12)
TESTARG(13, lockingrange, 13)
TESTARG(14, lockingrange, 14)
TESTARG(15, lockingrange, 15)
TESTFAIL("Invalid Locking Range (0-15)")
OPTION_IS(password) OPTION_IS(device) END_OPTION
BEGIN_OPTION(eraseLockingRange_SUM, 3)
TESTARG(0, lockingrange, 0)
TESTARG(1, lockingrange, 1)
TESTARG(2, lockingrange, 2)
TESTARG(3, lockingrange, 3)
TESTARG(4, lockingrange, 4)
TESTARG(5, lockingrange, 5)
TESTARG(6, lockingrange, 6)
TESTARG(7, lockingrange, 7)
TESTARG(8, lockingrange, 8)
TESTARG(9, lockingrange, 9)
TESTARG(10, lockingrange, 10)
TESTARG(11, lockingrange, 11)
TESTARG(12, lockingrange, 12)
TESTARG(13, lockingrange, 13)
TESTARG(14, lockingrange, 14)
TESTARG(15, lockingrange, 15)
TESTFAIL("Invalid Locking Range (1-15)")
OPTION_IS(password) OPTION_IS(device) END_OPTION
BEGIN_OPTION(query, 1) OPTION_IS(device) END_OPTION
BEGIN_OPTION(scan, 0) END_OPTION
BEGIN_OPTION(isValidSED, 1) OPTION_IS(device) END_OPTION
BEGIN_OPTION(eraseLockingRange, 3)
TESTARG(0, lockingrange, 0)
TESTARG(1, lockingrange, 1)
TESTARG(2, lockingrange, 2)
TESTARG(3, lockingrange, 3)
TESTARG(4, lockingrange, 4)
TESTARG(5, lockingrange, 5)
TESTARG(6, lockingrange, 6)
TESTARG(7, lockingrange, 7)
TESTARG(8, lockingrange, 8)
TESTARG(9, lockingrange, 9)
TESTARG(10, lockingrange, 10)
TESTARG(11, lockingrange, 11)
TESTARG(12, lockingrange, 12)
TESTARG(13, lockingrange, 13)
TESTARG(14, lockingrange, 14)
TESTARG(15, lockingrange, 15)
TESTFAIL("Invalid Locking Range (0-15)")
OPTION_IS(password)
OPTION_IS(device)
END_OPTION
BEGIN_OPTION(takeOwnership, 2) OPTION_IS(password) OPTION_IS(device) END_OPTION
BEGIN_OPTION(revertLockingSP, 2) OPTION_IS(password) OPTION_IS(device) END_OPTION
BEGIN_OPTION(setPassword, 4) OPTION_IS(password) OPTION_IS(userid)
OPTION_IS(newpassword) OPTION_IS(device) END_OPTION
BEGIN_OPTION(setPassword_SUM, 4) OPTION_IS(password) OPTION_IS(userid)
OPTION_IS(newpassword) OPTION_IS(device) END_OPTION
BEGIN_OPTION(validatePBKDF2, 0) END_OPTION
BEGIN_OPTION(setMBREnable, 3)
TESTARG(ON, mbrstate, 1)
TESTARG(on, mbrstate, 1)
TESTARG(off, mbrstate, 0)
TESTARG(OFF, mbrstate, 0)
TESTFAIL("Invalid setMBREnable argument not <on|off>")
OPTION_IS(password)
OPTION_IS(device)
END_OPTION
BEGIN_OPTION(setMBRDone, 3)
TESTARG(ON, mbrstate, 1)
TESTARG(on, mbrstate, 1)
TESTARG(off, mbrstate, 0)
TESTARG(OFF, mbrstate, 0)
TESTFAIL("Invalid setMBRDone argument not <on|off>")
OPTION_IS(password)
OPTION_IS(device)
END_OPTION
BEGIN_OPTION(setLockingRange, 4)
TESTARG(0, lockingrange, 0)
TESTARG(1, lockingrange, 1)
TESTARG(2, lockingrange, 2)
TESTARG(3, lockingrange, 3)
TESTARG(4, lockingrange, 4)
TESTARG(5, lockingrange, 5)
TESTARG(6, lockingrange, 6)
TESTARG(7, lockingrange, 7)
TESTARG(8, lockingrange, 8)
TESTARG(9, lockingrange, 9)
TESTARG(10, lockingrange, 10)
TESTARG(11, lockingrange, 11)
TESTARG(12, lockingrange, 12)
TESTARG(13, lockingrange, 13)
TESTARG(14, lockingrange, 14)
TESTARG(15, lockingrange, 15)
TESTFAIL("Invalid Locking Range (0-15)")
TESTARG(RW, lockingstate, OPAL_LOCKINGSTATE::READWRITE)
TESTARG(rw, lockingstate, OPAL_LOCKINGSTATE::READWRITE)
TESTARG(RO, lockingstate, OPAL_LOCKINGSTATE::READONLY)
TESTARG(ro, lockingstate, OPAL_LOCKINGSTATE::READONLY)
TESTARG(LK, lockingstate, OPAL_LOCKINGSTATE::LOCKED)
TESTARG(lk, lockingstate, OPAL_LOCKINGSTATE::LOCKED)
TESTFAIL("Invalid locking state <ro|rw|lk>")
OPTION_IS(password)
OPTION_IS(device)
END_OPTION
BEGIN_OPTION(setLockingRange_SUM, 4)
TESTARG(0, lockingrange, 0)
TESTARG(1, lockingrange, 1)
TESTARG(2, lockingrange, 2)
TESTARG(3, lockingrange, 3)
TESTARG(4, lockingrange, 4)
TESTARG(5, lockingrange, 5)
TESTARG(6, lockingrange, 6)
TESTARG(7, lockingrange, 7)
TESTARG(8, lockingrange, 8)
TESTARG(9, lockingrange, 9)
TESTARG(10, lockingrange, 10)
TESTARG(11, lockingrange, 11)
TESTARG(12, lockingrange, 12)
TESTARG(13, lockingrange, 13)
TESTARG(14, lockingrange, 14)
TESTARG(15, lockingrange, 15)
TESTFAIL("Invalid Locking Range (0-15)")
TESTARG(RW, lockingstate, OPAL_LOCKINGSTATE::READWRITE)
TESTARG(rw, lockingstate, OPAL_LOCKINGSTATE::READWRITE)
TESTARG(RO, lockingstate, OPAL_LOCKINGSTATE::READONLY)
TESTARG(ro, lockingstate, OPAL_LOCKINGSTATE::READONLY)
TESTARG(LK, lockingstate, OPAL_LOCKINGSTATE::LOCKED)
TESTARG(lk, lockingstate, OPAL_LOCKINGSTATE::LOCKED)
TESTFAIL("Invalid locking state <ro|rw|lk>")
OPTION_IS(password)
OPTION_IS(device)
END_OPTION
BEGIN_OPTION(enableLockingRange, 3)
TESTARG(0, lockingrange, 0)
TESTARG(1, lockingrange, 1)
TESTARG(2, lockingrange, 2)
TESTARG(3, lockingrange, 3)
TESTARG(4, lockingrange, 4)
TESTARG(5, lockingrange, 5)
TESTARG(6, lockingrange, 6)
TESTARG(7, lockingrange, 7)
TESTARG(8, lockingrange, 8)
TESTARG(9, lockingrange, 9)
TESTARG(10, lockingrange, 10)
TESTARG(11, lockingrange, 11)
TESTARG(12, lockingrange, 12)
TESTARG(13, lockingrange, 13)
TESTARG(14, lockingrange, 14)
TESTARG(15, lockingrange, 15)
TESTFAIL("Invalid Locking Range (0-15)")
OPTION_IS(password)
OPTION_IS(device)
END_OPTION
BEGIN_OPTION(disableLockingRange, 3)
TESTARG(0, lockingrange, 0)
TESTARG(1, lockingrange, 1)
TESTARG(2, lockingrange, 2)
TESTARG(3, lockingrange, 3)
TESTARG(4, lockingrange, 4)
TESTARG(5, lockingrange, 5)
TESTARG(6, lockingrange, 6)
TESTARG(7, lockingrange, 7)
TESTARG(8, lockingrange, 8)
TESTARG(9, lockingrange, 9)
TESTARG(10, lockingrange, 10)
TESTARG(11, lockingrange, 11)
TESTARG(12, lockingrange, 12)
TESTARG(13, lockingrange, 13)
TESTARG(14, lockingrange, 14)
TESTARG(15, lockingrange, 15)
TESTFAIL("Invalid Locking Range (0-15)")
OPTION_IS(password)
OPTION_IS(device)
END_OPTION
BEGIN_OPTION(setupLockingRange, 5)
TESTARG(0, lockingrange, 0)
TESTARG(1, lockingrange, 1)
TESTARG(2, lockingrange, 2)
TESTARG(3, lockingrange, 3)
TESTARG(4, lockingrange, 4)
TESTARG(5, lockingrange, 5)
TESTARG(6, lockingrange, 6)
TESTARG(7, lockingrange, 7)
TESTARG(8, lockingrange, 8)
TESTARG(9, lockingrange, 9)
TESTARG(10, lockingrange, 10)
TESTARG(11, lockingrange, 11)
TESTARG(12, lockingrange, 12)
TESTARG(13, lockingrange, 13)
TESTARG(14, lockingrange, 14)
TESTARG(15, lockingrange, 15)
TESTFAIL("Invalid Locking Range (0-15)")
OPTION_IS(lrstart)
OPTION_IS(lrlength)
OPTION_IS(password)
OPTION_IS(device)
END_OPTION
BEGIN_OPTION(setupLockingRange_SUM, 5)
TESTARG(0, lockingrange, 0)
TESTARG(1, lockingrange, 1)
TESTARG(2, lockingrange, 2)
TESTARG(3, lockingrange, 3)
TESTARG(4, lockingrange, 4)
TESTARG(5, lockingrange, 5)
TESTARG(6, lockingrange, 6)
TESTARG(7, lockingrange, 7)
TESTARG(8, lockingrange, 8)
TESTARG(9, lockingrange, 9)
TESTARG(10, lockingrange, 10)
TESTARG(11, lockingrange, 11)
TESTARG(12, lockingrange, 12)
TESTARG(13, lockingrange, 13)
TESTARG(14, lockingrange, 14)
TESTARG(15, lockingrange, 15)
TESTFAIL("Invalid Locking Range (0-15)")
OPTION_IS(lrstart)
OPTION_IS(lrlength)
OPTION_IS(password)
OPTION_IS(device)
END_OPTION
BEGIN_OPTION(readonlyLockingRange, 3)
TESTARG(0, lockingrange, 0)
TESTARG(1, lockingrange, 1)
TESTARG(2, lockingrange, 2)
TESTARG(3, lockingrange, 3)
TESTARG(4, lockingrange, 4)
TESTARG(5, lockingrange, 5)
TESTARG(6, lockingrange, 6)
TESTARG(7, lockingrange, 7)
TESTARG(8, lockingrange, 8)
TESTARG(9, lockingrange, 9)
TESTARG(10, lockingrange, 10)
TESTARG(11, lockingrange, 11)
TESTARG(12, lockingrange, 12)
TESTARG(13, lockingrange, 13)
TESTARG(14, lockingrange, 14)
TESTARG(15, lockingrange, 15)
TESTFAIL("Invalid Locking Range (0-15)")
OPTION_IS(password)
OPTION_IS(device)
END_OPTION
BEGIN_OPTION(listLockingRanges, 2)
OPTION_IS(password)
OPTION_IS(device)
END_OPTION
BEGIN_OPTION(listLockingRange, 3)
TESTARG(0, lockingrange, 0)
TESTARG(1, lockingrange, 1)
TESTARG(2, lockingrange, 2)
TESTARG(3, lockingrange, 3)
TESTARG(4, lockingrange, 4)
TESTARG(5, lockingrange, 5)
TESTARG(6, lockingrange, 6)
TESTARG(7, lockingrange, 7)
TESTARG(8, lockingrange, 8)
TESTARG(9, lockingrange, 9)
TESTARG(10, lockingrange, 10)
TESTARG(11, lockingrange, 11)
TESTARG(12, lockingrange, 12)
TESTARG(13, lockingrange, 13)
TESTARG(14, lockingrange, 14)
TESTARG(15, lockingrange, 15)
TESTFAIL("Invalid Locking Range (0-15)")
OPTION_IS(password)
OPTION_IS(device)
END_OPTION
BEGIN_OPTION(rekeyLockingRange, 3)
TESTARG(0, lockingrange, 0)
TESTARG(1, lockingrange, 1)
TESTARG(2, lockingrange, 2)
TESTARG(3, lockingrange, 3)
TESTARG(4, lockingrange, 4)
TESTARG(5, lockingrange, 5)
TESTARG(6, lockingrange, 6)
TESTARG(7, lockingrange, 7)
TESTARG(8, lockingrange, 8)
TESTARG(9, lockingrange, 9)
TESTARG(10, lockingrange, 10)
TESTARG(11, lockingrange, 11)
TESTARG(12, lockingrange, 12)
TESTARG(13, lockingrange, 13)
TESTARG(14, lockingrange, 14)
TESTARG(15, lockingrange, 15)
TESTFAIL("Invalid Locking Range (0-15)")
OPTION_IS(password)
OPTION_IS(device)
END_OPTION
BEGIN_OPTION(setBandsEnabled, 2)
OPTION_IS(password)
OPTION_IS(device)
END_OPTION
BEGIN_OPTION(setBandEnabled, 3)
TESTARG(0, lockingrange, 0)
TESTARG(1, lockingrange, 1)
TESTARG(2, lockingrange, 2)
TESTARG(3, lockingrange, 3)
TESTARG(4, lockingrange, 4)
TESTARG(5, lockingrange, 5)
TESTARG(6, lockingrange, 6)
TESTARG(7, lockingrange, 7)
TESTARG(8, lockingrange, 8)
TESTARG(9, lockingrange, 9)
TESTARG(10, lockingrange, 10)
TESTARG(11, lockingrange, 11)
TESTARG(12, lockingrange, 12)
TESTARG(13, lockingrange, 13)
TESTARG(14, lockingrange, 14)
TESTARG(15, lockingrange, 15)
TESTFAIL("Invalid Locking Range (0-15)")
OPTION_IS(password)
OPTION_IS(device)
END_OPTION
BEGIN_OPTION(objDump, 5) i += 4; OPTION_IS(device) END_OPTION
BEGIN_OPTION(printDefaultPassword, 1) OPTION_IS(device) END_OPTION
BEGIN_OPTION(rawCmd, 7) i += 6; OPTION_IS(device) END_OPTION
else {
LOG(E) << "Invalid command line argument " << argv[i];
return DTAERROR_INVALID_COMMAND;
}
}
return 0;
}