Skip to content

Commit 74d7813

Browse files
committed
Merge remote-tracking branch 'upstream/master' into to_upstream
2 parents b305fb6 + 903dc28 commit 74d7813

File tree

101 files changed

+14169
-6537
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+14169
-6537
lines changed

.gitignore

+29
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ ipch/
5353
*.opensdf
5454
*.sdf
5555
*.cachefile
56+
*.VC.db
5657

5758
# Visual Studio profiler
5859
*.psess
@@ -154,6 +155,30 @@ $RECYCLE.BIN/
154155

155156
# Mac desktop service store files
156157
.DS_Store
158+
159+
# Autotools
160+
Makefile.in
161+
/autom4te.cache
162+
/aclocal.m4
163+
/compile
164+
/configure
165+
/depcomp
166+
/install-sh
167+
/missing
168+
/stamp-h1
169+
config.h
170+
config.h.in
171+
config.status
172+
Makefile
173+
sedutil-*.tar.*
174+
linuxpba
175+
sedutil-cli
176+
177+
# GCC
178+
.deps/
179+
*.o
180+
.dirstamp
181+
157182
# project specific files
158183
*.VC.opendb
159184
*.lnk
@@ -167,3 +192,7 @@ Doxygen/
167192
!/images/buildroot/*
168193
/LinuxPBA/dist/
169194
/linux/CLI/dist/
195+
# inno installer output
196+
windows/installer/Output/
197+
# hacked exe files for different flavors
198+
windows/installer/exe

CONTRIBUTING

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Contributing to the Drive Trust Alliance sedutil project.
2+
We welcome contributions to the project but in order to maintain our ability to monitize this
3+
software we require that contributions are accompanied by a signed copy of the
4+
DTA_Contributor_Agreement_v2 included in this directory.
5+
6+
Thanks for understanding

Common/Copyright.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* C:B**************************************************************************
2-
This software is Copyright 2014-2016 Bright Plaza Inc. <[email protected]>
2+
This software is Copyright 2014-2017 Bright Plaza Inc. <[email protected]>
33

44
This file is part of sedutil.
55

Common/DtaAnnotatedDump.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* C:B**************************************************************************
2-
This software is Copyright 2014-2016 Bright Plaza Inc. <[email protected]>
2+
This software is Copyright 2014-2017 Bright Plaza Inc. <[email protected]>
33
44
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
55
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED

Common/DtaAnnotatedDump.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* C:B**************************************************************************
2-
This software is Copyright 2014-2016 Bright Plaza Inc. <[email protected]>
2+
This software is Copyright 2014-2017 Bright Plaza Inc. <[email protected]>
33
44
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
55
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED

Common/DtaCommand.cpp

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* C:B**************************************************************************
2-
This software is Copyright 2014-2016 Bright Plaza Inc. <[email protected]>
2+
This software is Copyright 2014-2017 Bright Plaza Inc. <[email protected]>
33
44
This file is part of sedutil.
55
@@ -50,8 +50,8 @@ void
5050
DtaCommand::reset()
5151
{
5252
LOG(D1) << "Entering DtaCommand::reset()";
53-
memset(cmdbuf, 0, IO_BUFFER_LENGTH);
54-
memset(respbuf, 0, IO_BUFFER_LENGTH);
53+
memset(cmdbuf, 0, MAX_BUFFER_LENGTH);
54+
memset(respbuf, 0, MIN_BUFFER_LENGTH);
5555
bufferpos = sizeof (OPALHeader);
5656
}
5757
void
@@ -204,8 +204,8 @@ DtaCommand::complete(uint8_t EOD)
204204
hdr->pkt.length = SWAP32((bufferpos - sizeof (OPALComPacket))
205205
- sizeof (OPALPacket));
206206
hdr->cp.length = SWAP32(bufferpos - sizeof (OPALComPacket));
207-
if (bufferpos > 2048) {
208-
LOG(E) << " Buffer Overrun " << bufferpos;
207+
if (bufferpos > MAX_BUFFER_LENGTH) {
208+
LOG(D1) << " Standard Buffer Overrun " << bufferpos;
209209
exit(EXIT_FAILURE);
210210
}
211211
}
@@ -244,7 +244,14 @@ DtaCommand::dumpResponse()
244244
OPALHeader *hdr = (OPALHeader *)respbuf;
245245
DtaHexDump(respbuf, SWAP32(hdr->cp.length) + sizeof(OPALComPacket));
246246
}
247-
247+
uint16_t
248+
DtaCommand::outputBufferSize() {
249+
// if (MIN_BUFFER_LENGTH + 1 > bufferpos) return(MIN_BUFFER_LENGTH);
250+
if(bufferpos % 512)
251+
return(((uint16_t)(bufferpos / 512) + 1) * 512);
252+
else
253+
return((uint16_t)(bufferpos / 512) * 512);
254+
}
248255
void
249256
DtaCommand::setcomID(uint16_t comID)
250257
{

Common/DtaCommand.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* C:B**************************************************************************
2-
This software is Copyright 2014-2016 Bright Plaza Inc. <[email protected]>
2+
This software is Copyright 2014-2017 Bright Plaza Inc. <[email protected]>
33
44
This file is part of sedutil.
55
@@ -118,13 +118,15 @@ class DtaCommand {
118118
void dumpResponse();
119119
/** Produce a hexdump of the command. Typically used in debugging and tracing */
120120
void dumpCommand();
121+
/** Return the space used in the command buffer (rounded to 512 bytes) */
122+
uint16_t outputBufferSize();
121123
private:
122124
/** return a pointer to the command buffer */
123125
void * getCmdBuffer();
124126
/** return a pointer to the response buffer. */
125127
void * getRespBuffer();
126-
uint8_t commandbuffer[IO_BUFFER_LENGTH + IO_BUFFER_ALIGNMENT]; /**< buffer allocation allow for 1k alignment */
127-
uint8_t responsebuffer[IO_BUFFER_LENGTH + IO_BUFFER_ALIGNMENT]; /**< buffer allocation allow for 1k alignment */
128+
uint8_t commandbuffer[MAX_BUFFER_LENGTH + IO_BUFFER_ALIGNMENT]; /**< buffer allocation allow for 1k alignment */
129+
uint8_t responsebuffer[MIN_BUFFER_LENGTH + IO_BUFFER_ALIGNMENT]; /**< buffer allocation allow for 1k alignment */
128130
uint8_t *cmdbuf; /**< Pointer to the command buffer */
129131
uint8_t *respbuf; /**< pointer to the response buffer */
130132
uint32_t bufferpos = 0; /**< position of the next byte in the command buffer */

Common/DtaConstants.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* C:B**************************************************************************
2-
This software is Copyright 2014-2016 Bright Plaza Inc. <[email protected]>
2+
This software is Copyright 2014-2017 Bright Plaza Inc. <[email protected]>
33
44
This file is part of sedutil.
55
@@ -17,8 +17,10 @@ You should have received a copy of the GNU General Public License
1717
along with sedutil. If not, see <http://www.gnu.org/licenses/>.
1818
1919
* C:E********************************************************************** */
20-
/** Length of the IO buffers used */
21-
#define IO_BUFFER_LENGTH 2048
20+
/** MAX Length of input the IO buffers used */
21+
#define MAX_BUFFER_LENGTH 61440
22+
/** Length of input the IO buffers used */
23+
#define MIN_BUFFER_LENGTH 2048
2224
/** Alignment of the IO buffers.
2325
* generic align on 1k boundary probably not needed
2426
* but when things weren't working this was one of the

Common/DtaDev.cpp

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* C:B**************************************************************************
2-
This software is Copyright 2014-2016 Bright Plaza Inc. <[email protected]>
2+
This software is Copyright 2014-2017 Bright Plaza Inc. <[email protected]>
33
44
This file is part of sedutil.
55
@@ -102,6 +102,10 @@ char *DtaDev::getSerialNum()
102102
{
103103
return (char *)&disk_info.serialNum;
104104
}
105+
DTA_DEVICE_TYPE DtaDev::getDevType()
106+
{
107+
return disk_info.devType;
108+
}
105109
void DtaDev::discovery0()
106110
{
107111
LOG(D1) << "Entering DtaDev::discovery0()";
@@ -112,8 +116,8 @@ void DtaDev::discovery0()
112116
Discovery0Features * body;
113117
d0Response = discovery0buffer + IO_BUFFER_ALIGNMENT;
114118
d0Response = (void *)((uintptr_t)d0Response & (uintptr_t)~(IO_BUFFER_ALIGNMENT - 1));
115-
memset(d0Response, 0, IO_BUFFER_LENGTH);
116-
if ((lastRC = sendCmd(IF_RECV, 0x01, 0x0001, d0Response, IO_BUFFER_LENGTH)) != 0) {
119+
memset(d0Response, 0, MIN_BUFFER_LENGTH);
120+
if ((lastRC = sendCmd(IF_RECV, 0x01, 0x0001, d0Response, MIN_BUFFER_LENGTH)) != 0) {
117121
LOG(D) << "Send D0 request to device failed " << (uint16_t)lastRC;
118122
return;
119123
}
@@ -211,7 +215,11 @@ void DtaDev::puke()
211215
{
212216
LOG(D1) << "Entering DtaDev::puke()";
213217
/* IDENTIFY */
214-
cout << endl << dev << (disk_info.devType == DEVICE_TYPE_ATA ? " ATA " : disk_info.devType == DEVICE_TYPE_SAS ? " SAS " : disk_info.devType == DEVICE_TYPE_USB ? " USB " : " OTHER ");
218+
cout << endl << dev << (disk_info.devType == DEVICE_TYPE_ATA ? " ATA " :
219+
disk_info.devType == DEVICE_TYPE_SAS ? " SAS " :
220+
disk_info.devType == DEVICE_TYPE_USB ? " USB " :
221+
disk_info.devType == DEVICE_TYPE_NVME ? " NVMe " :
222+
" OTHER ");
215223
cout << disk_info.modelNum << " " << disk_info.firmwareRev << " " << disk_info.serialNum << endl;
216224
/* TPer */
217225
if (disk_info.TPer) {

Common/DtaDev.h

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* C:B**************************************************************************
2-
This software is Copyright 2014-2016 Bright Plaza Inc. <[email protected]>
2+
This software is Copyright 2014-2017 Bright Plaza Inc. <[email protected]>
33
44
This file is part of sedutil.
55
@@ -62,6 +62,8 @@ class DtaDev {
6262
char *getModelNum();
6363
/** Returns the Serial Number reported by the Identify command */
6464
char *getSerialNum();
65+
/* What type of disk attachment is used */
66+
DTA_DEVICE_TYPE getDevType();
6567
/** displays the information returned by the Discovery 0 reply */
6668
virtual void puke();
6769

@@ -93,7 +95,7 @@ class DtaDev {
9395
* @param bufferlen length of the input/output buffer
9496
*/
9597
virtual uint8_t sendCmd(ATACOMMAND cmd, uint8_t protocol, uint16_t comID,
96-
void * buffer, uint16_t bufferlen) = 0;
98+
void * buffer, uint32_t bufferlen) = 0;
9799
/** OS specific command to Wait for specified number of milliseconds
98100
* @param milliseconds number of milliseconds to wait
99101
*/
@@ -211,7 +213,7 @@ class DtaDev {
211213
* @param password password of locking sp administrative authority
212214
* @param userid the user to be enabled
213215
*/
214-
virtual uint8_t enableUser(char * password, char * userid) = 0;
216+
virtual uint8_t enableUser(char * password, char * userid, OPAL_TOKEN status = OPAL_TOKEN::OPAL_TRUE) = 0;
215217
/** Enable locking on the device
216218
* @param password password of the admin sp SID authority
217219
*/
@@ -290,5 +292,7 @@ class DtaDev {
290292
DtaResponse response; /**< shared response object */
291293
DtaResponse propertiesResponse; /**< response fron properties exchange */
292294
DtaSession *session; /**< shared session object pointer */
293-
uint8_t discovery0buffer[IO_BUFFER_LENGTH + IO_BUFFER_ALIGNMENT];
295+
uint8_t discovery0buffer[MIN_BUFFER_LENGTH + IO_BUFFER_ALIGNMENT];
296+
uint32_t tperMaxPacket = 2048;
297+
uint32_t tperMaxToken = 1950;
294298
};

Common/DtaDevEnterprise.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* C:B**************************************************************************
2-
This software is Copyright 2014-2016 Bright Plaza Inc. <[email protected]>
2+
This software is Copyright 2014-2017 Bright Plaza Inc. <[email protected]>
33
This software is Copyright 2017 Spectra Logic Corporation
44
55
This file is part of sedutil.
@@ -856,7 +856,7 @@ uint8_t DtaDevEnterprise::setLockingRange_SUM(uint8_t lockingrange, uint8_t lock
856856
LOG(D1) << "Exiting DtaDevEnterprise::setLockingRange_SUM()";
857857
return DTAERROR_INVALID_PARAMETER;
858858
}
859-
uint8_t DtaDevEnterprise::enableUser(char * password, char * userid)
859+
uint8_t DtaDevEnterprise::enableUser(char * password, char * userid, OPAL_TOKEN status)
860860
{
861861
LOG(D1) << "Entering DtaDevEnterprise::enableUser";
862862
LOG(E) << "enableUser not implemented";
@@ -1419,9 +1419,9 @@ uint8_t DtaDevEnterprise::exec(DtaCommand * cmd, DtaResponse & resp, uint8_t pro
14191419
uint8_t rc = 0;
14201420
OPALHeader * hdr = (OPALHeader *) cmd->getCmdBuffer();
14211421
LOG(D3) << endl << "Dumping command buffer";
1422-
IFLOG(D) DtaAnnotatedDump(IF_SEND, cmd->getCmdBuffer(), IO_BUFFER_LENGTH);
1422+
IFLOG(D) DtaAnnotatedDump(IF_SEND, cmd->getCmdBuffer(), cmd->outputBufferSize());
14231423
IFLOG(D3) DtaHexDump(cmd->getCmdBuffer(), SWAP32(hdr->cp.length) + sizeof (OPALComPacket));
1424-
rc = sendCmd(IF_SEND, protocol, comID(), cmd->getCmdBuffer(), IO_BUFFER_LENGTH);
1424+
rc = sendCmd(IF_SEND, protocol, comID(), cmd->getCmdBuffer(), cmd->outputBufferSize());
14251425
if (0 != rc) {
14261426
LOG(E) << "Command failed on send " << (uint16_t) rc;
14271427
return rc;
@@ -1430,8 +1430,8 @@ uint8_t DtaDevEnterprise::exec(DtaCommand * cmd, DtaResponse & resp, uint8_t pro
14301430
do {
14311431
//LOG(I) << "read loop";
14321432
osmsSleep(25);
1433-
memset(cmd->getRespBuffer(), 0, IO_BUFFER_LENGTH);
1434-
rc = sendCmd(IF_RECV, protocol, comID(), cmd->getRespBuffer(), IO_BUFFER_LENGTH);
1433+
memset(cmd->getRespBuffer(), 0, MIN_BUFFER_LENGTH);
1434+
rc = sendCmd(IF_RECV, protocol, comID(), cmd->getRespBuffer(), MIN_BUFFER_LENGTH);
14351435

14361436
}
14371437
while ((0 != hdr->cp.outstandingData) && (0 == hdr->cp.minTransfer));

Common/DtaDevEnterprise.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* C:B**************************************************************************
2-
This software is Copyright 2014-2016 Bright Plaza Inc. <[email protected]>
2+
This software is Copyright 2014-2017 Bright Plaza Inc. <[email protected]>
33
This software is Copyright 2017 Spectra Logic Corporation
44
55
This file is part of sedutil.
@@ -108,7 +108,7 @@ class DtaDevEnterprise : public DtaDevOS {
108108
/** get the UID or CPIN ID of a user from their character name*/
109109
uint8_t getAuth4User(char * userid, uint8_t column, std::vector<uint8_t> &userData);
110110
/** Enable a Bandmaster Not functional */
111-
uint8_t enableUser(char * password, char * userid);
111+
uint8_t enableUser(char * password, char * userid, OPAL_TOKEN status = OPAL_TOKEN::OPAL_TRUE);
112112
/** Primitive to set the MBRDone flag.
113113
* @param state 0 or 1
114114
* @param Admin1Password Locking SP authority with access to flag

Common/DtaDevGeneric.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* C:B**************************************************************************
2-
This software is Copyright 2014-2016 Bright Plaza Inc. <[email protected]>
2+
This software is Copyright 2014-2017 Bright Plaza Inc. <[email protected]>
33
44
This file is part of sedutil.
55
@@ -82,7 +82,7 @@ uint8NOCODE(setupLockingRange_SUM, uint8_t lockingrange, uint64_t start,
8282
uint64_t length, char * password)
8383
uint8NOCODE(rekeyLockingRange, uint8_t lockingrange, char * password)
8484
uint8NOCODE(setBandsEnabled, int16_t lockingrange, char * password)
85-
uint8NOCODE(enableUser,char * password, char * userid)
85+
uint8NOCODE(enableUser,char * password, char * userid, OPAL_TOKEN status)
8686
uint8NOCODE(revertTPer,char * password, uint8_t PSID, uint8_t AdminSP)
8787
uint8NOCODE(eraseLockingRange,uint8_t lockingrange, char * password)
8888
uint8NOCODE(printDefaultPassword);

Common/DtaDevGeneric.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* C:B**************************************************************************
2-
This software is Copyright 2014-2016 Bright Plaza Inc. <[email protected]>
2+
This software is Copyright 2014-2017 Bright Plaza Inc. <[email protected]>
33
44
This file is part of sedutil.
55
@@ -157,7 +157,7 @@ class DtaDevGeneric : public DtaDevOS {
157157
* @param password password of locking sp administrative authority
158158
* @param userid the user to be enabled
159159
*/
160-
uint8_t enableUser(char * password, char * userid) ;
160+
uint8_t enableUser(char * password, char * userid, OPAL_TOKEN status = OPAL_TOKEN::OPAL_TRUE) ;
161161
/** Enable locking on the device
162162
* @param password password of the admin sp SID authority
163163
*/

0 commit comments

Comments
 (0)