diff --git a/.gitignore b/.gitignore index 1d30e98f..6155ac52 100644 --- a/.gitignore +++ b/.gitignore @@ -171,7 +171,7 @@ config.h.in config.status Makefile sedutil-*.tar.* -linuxpba +#linuxpba sedutil-cli # GCC diff --git a/Common/DtaDev.cpp b/Common/DtaDev.cpp index 0dbc3b13..f581ba46 100644 --- a/Common/DtaDev.cpp +++ b/Common/DtaDev.cpp @@ -44,6 +44,26 @@ DtaDev::DtaDev() DtaDev::~DtaDev() { } +uint8_t DtaDev::isRuby1() +{ + LOG(D1) << "Entering DtaDev::isRuby1 " << (uint16_t) disk_info.Ruby10; + return disk_info.Ruby10; +} +uint8_t DtaDev::isPyrite2() +{ + LOG(D1) << "Entering DtaDev::isPyrite2 " << (uint16_t) disk_info.Pyrite20; + return disk_info.Pyrite20; +} +uint8_t DtaDev::isPyrite1() +{ + LOG(D1) << "Entering DtaDev::isPyrite1 " << (uint16_t) disk_info.Pyrite10; + return disk_info.Pyrite10; +} +uint8_t DtaDev::isOpalite() +{ + LOG(D1) << "Entering DtaDev::isOpalite " << (uint16_t) disk_info.Opalite; + return disk_info.Opalite; +} uint8_t DtaDev::isOpal2() { LOG(D1) << "Entering DtaDev::isOpal2 " << (uint16_t) disk_info.OPAL20; @@ -80,6 +100,11 @@ uint8_t DtaDev::MBRDone() LOG(D1) << "Entering DtaDev::MBRDone" << (uint16_t)disk_info.Locking_MBRDone; return disk_info.Locking_MBRDone; } +uint8_t DtaDev::MBRAbsent() +{ + LOG(D1) << "Entering DtaDev::MBRAbsent" << (uint16_t)disk_info.Locking_MBRAbsent; + return disk_info.Locking_MBRAbsent; +} uint8_t DtaDev::Locked() { LOG(D1) << "Entering DtaDev::Locked" << (uint16_t)disk_info.Locking_locked; @@ -114,6 +139,8 @@ void DtaDev::discovery0() uint8_t * epos, *cpos; Discovery0Header * hdr; Discovery0Features * body; + uint32_t len; + d0Response = discovery0buffer + IO_BUFFER_ALIGNMENT; d0Response = (void *)((uintptr_t)d0Response & (uintptr_t)~(IO_BUFFER_ALIGNMENT - 1)); memset(d0Response, 0, MIN_BUFFER_LENGTH); @@ -124,9 +151,14 @@ void DtaDev::discovery0() epos = cpos = (uint8_t *) d0Response; hdr = (Discovery0Header *) d0Response; + len = SWAP32(hdr->length); + if (len > MIN_BUFFER_LENGTH) { + LOG(D) << "Too long Discovery0 response: " << SWAP32(hdr->length); + len = MIN_BUFFER_LENGTH; + } LOG(D3) << "Dumping D0Response"; - IFLOG(D3) DtaHexDump(hdr, SWAP32(hdr->length)); - epos = epos + SWAP32(hdr->length); + IFLOG(D3) DtaHexDump(hdr, len); + epos = epos + len; cpos = cpos + 48; // TODO: check header version do { @@ -148,6 +180,7 @@ void DtaDev::discovery0() disk_info.Locking_lockingSupported = body->locking.lockingSupported; disk_info.Locking_MBRDone = body->locking.MBRDone; disk_info.Locking_MBREnabled = body->locking.MBREnabled; + disk_info.Locking_MBRAbsent = body->locking.MBRAbsent; disk_info.Locking_mediaEncrypt = body->locking.mediaEncryption; break; case FC_GEOMETRY: /* Geometry Features */ @@ -157,6 +190,11 @@ void DtaDev::discovery0() disk_info.Geometry_logicalBlockSize = SWAP32(body->geometry.logicalBlockSize); disk_info.Geometry_lowestAlignedLBA = SWAP64(body->geometry.lowestAlighedLBA); break; + case FC_SECUREMSG: /* Secure Messaging */ + disk_info.SecureMsg = 1; + disk_info.SecureMsg_activated = body->secureMsg.activated; + disk_info.SecureMsg_numberOfSPs = SWAP16(body->secureMsg.numberOfSPs); + break; case FC_ENTERPRISE: /* Enterprise SSC */ disk_info.Enterprise = 1; disk_info.ANY_OPAL_SSC = 1; @@ -169,6 +207,7 @@ void DtaDev::discovery0() disk_info.ANY_OPAL_SSC = 1; disk_info.OPAL10_basecomID = SWAP16(body->opalv100.baseComID); disk_info.OPAL10_numcomIDs = SWAP16(body->opalv100.numberComIDs); + disk_info.OPAL10_rangeCrossing = body->opalv100.rangeCrossing; break; case FC_SINGLEUSER: /* Single User Mode */ disk_info.SingleUser = 1; @@ -194,6 +233,69 @@ void DtaDev::discovery0() disk_info.OPAL20_numUsers = SWAP16(body->opalv200.numlockingUserAuth); disk_info.OPAL20_rangeCrossing = body->opalv200.rangeCrossing; break; + case FC_BLOCKSID: /* Block SID Authentication */ + disk_info.BlockSID = 1; + disk_info.BlockSID_SIDBlockedState = body->blockSID.SIDBlockedState; + disk_info.BlockSID_SIDValueState = body->blockSID.SIDValueState; + disk_info.BlockSID_HardwareReset = body->blockSID.HardwareReset; + break; + case FC_NAMESPACE: /* Namespace */ + disk_info.Namespace = 1; + disk_info.Namespace_MaximumKeyCount = SWAP32(body->ns.MaximumKeyCount); + disk_info.Namespace_UnusedKeyCount = SWAP32(body->ns.UnusedKeyCount); + disk_info.Namespace_MaximumRangesPerNamespace = SWAP32(body->ns.MaximumRangesPerNamespace); + break; + case FC_OPALITE: /* Opalite */ + disk_info.Opalite = 1; + disk_info.ANY_OPAL_SSC = 1; + disk_info.Opalite_basecomID = SWAP16(body->opalite.baseCommID); + disk_info.Opalite_numcomIDs = SWAP16(body->opalite.numCommIDs); + disk_info.Opalite_initialPIN = body->opalite.initialPIN; + disk_info.Opalite_revertedPIN = body->opalite.revertedPIN; + break; + case FC_PYRITEV100: /* Pyrite V100 */ + disk_info.Pyrite10 = 1; + disk_info.ANY_OPAL_SSC = 1; + disk_info.Pyrite10_basecomID = SWAP16(body->pyrite10.baseCommID); + disk_info.Pyrite10_numcomIDs = SWAP16(body->pyrite10.numCommIDs); + disk_info.Pyrite10_initialPIN = body->pyrite10.initialPIN; + disk_info.Pyrite10_revertedPIN = body->pyrite10.revertedPIN; + break; + case FC_PYRITEV200: /* Pyrite V200 */ + disk_info.Pyrite20 = 1; + disk_info.ANY_OPAL_SSC = 1; + disk_info.Pyrite20_basecomID = SWAP16(body->pyrite20.baseCommID); + disk_info.Pyrite20_numcomIDs = SWAP16(body->pyrite20.numCommIDs); + disk_info.Pyrite20_initialPIN = body->pyrite20.initialPIN; + disk_info.Pyrite20_revertedPIN = body->pyrite20.revertedPIN; + break; + case FC_RUBYV100: /* Ruby V1.00 */ + disk_info.Ruby10 = 1; + disk_info.ANY_OPAL_SSC = 1; + disk_info.Ruby10_basecomID = SWAP16(body->ruby10.baseCommID); + disk_info.Ruby10_numcomIDs = SWAP16(body->ruby10.numCommIDs); + disk_info.Ruby10_rangeCrossing = body->ruby10.rangeCrossing; + disk_info.Ruby10_numAdmins = SWAP16(body->ruby10.numlockingAdminAuth); + disk_info.Ruby10_numUsers = SWAP16(body->ruby10.numlockingUserAuth); + disk_info.Ruby10_initialPIN = body->ruby10.initialPIN; + disk_info.Ruby10_revertedPIN = body->ruby10.revertedPIN; + disk_info.Ruby10_PINonTPerRevert = body->ruby10.PINonTPerRevert; + break; + case FC_DATAREM: /* Supported Data Removal Mechanism */ + disk_info.DataRem = 1; + disk_info.DataRem_processing = body->dataRem.processing; + disk_info.DataRem_supported = body->dataRem.supported; + disk_info.DataRem_format = body->dataRem.format; + for (int i = 0; i < 6; i++) + disk_info.DataRem_time[i] = SWAP16(body->dataRem.time[i]); + break; + case FC_NSGEOMETRY: /* Namespace Geometry Reporting */ + disk_info.NSGeometry = 1; + disk_info.NSGeometry_align = body->nsgeometry.align; + disk_info.NSGeometry_alignmentGranularity = SWAP64(body->nsgeometry.alignmentGranularity); + disk_info.NSGeometry_logicalBlockSize = SWAP32(body->nsgeometry.logicalBlockSize); + disk_info.NSGeometry_lowestAlignedLBA = SWAP64(body->nsgeometry.lowestAlighedLBA); + break; default: if (0xbfff < (SWAP16(body->TPer.featureCode))) { // silently ignore vendor specific segments as there is no public doc on them @@ -240,6 +342,7 @@ void DtaDev::puke() << "LockingSupported = " << (disk_info.Locking_lockingSupported ? "Y, " : "N, "); cout << "MBRDone = " << (disk_info.Locking_MBRDone ? "Y, " : "N, ") << "MBREnabled = " << (disk_info.Locking_MBREnabled ? "Y, " : "N, ") + << "MBRAbsent = " << (disk_info.Locking_MBRAbsent ? "Y, " : "N, ") << "MediaEncrypt = " << (disk_info.Locking_mediaEncrypt ? "Y" : "N") << std::endl; } @@ -256,6 +359,13 @@ void DtaDev::puke() << ", Lowest Aligned LBA = " << disk_info.Geometry_lowestAlignedLBA << std::endl; } + if (disk_info.SecureMsg) { + + cout << "Secure Messaging function (" << HEXON(4) << FC_SECUREMSG << HEXOFF << ")" << std::endl; + cout << " Activated = " << (disk_info.SecureMsg_activated ? "Y, " : "N, ") + << "Number of SPs = " << disk_info.SecureMsg_numberOfSPs + << std::endl; + } if (disk_info.Enterprise) { cout << "Enterprise function (" << HEXON(4) << FC_ENTERPRISE << HEXOFF << ")" << std::endl; cout << " Range crossing = " << (disk_info.Enterprise_rangeCrossing ? "Y, " : "N, ") @@ -265,8 +375,9 @@ void DtaDev::puke() } if (disk_info.OPAL10) { cout << "Opal V1.0 function (" << HEXON(4) << FC_OPALV100 << HEXOFF << ")" << std::endl; - cout << "Base comID = " << HEXON(4) << disk_info.OPAL10_basecomID << HEXOFF + cout << " Base comID = " << HEXON(4) << disk_info.OPAL10_basecomID << HEXOFF << ", comIDs = " << disk_info.OPAL10_numcomIDs + << ", Range Crossing = " << (disk_info.OPAL10_rangeCrossing ? "Y" : "N") << std::endl; } if (disk_info.SingleUser) { @@ -288,8 +399,8 @@ void DtaDev::puke() if (disk_info.OPAL20) { cout << "OPAL 2.0 function (" << HEXON(4) << FC_OPALV200 << ")" << HEXOFF << std::endl; cout << " Base comID = " << HEXON(4) << disk_info.OPAL20_basecomID << HEXOFF; - cout << ", Initial PIN = " << HEXON(2) << disk_info.OPAL20_initialPIN << HEXOFF; - cout << ", Reverted PIN = " << HEXON(2) << disk_info.OPAL20_revertedPIN << HEXOFF; + cout << ", Initial PIN = " << HEXON(2) << static_cast(disk_info.OPAL20_initialPIN) << HEXOFF; + cout << ", Reverted PIN = " << HEXON(2) << static_cast(disk_info.OPAL20_revertedPIN) << HEXOFF; cout << ", comIDs = " << disk_info.OPAL20_numcomIDs; cout << std::endl; cout << " Locking Admins = " << disk_info.OPAL20_numAdmins; @@ -297,6 +408,82 @@ void DtaDev::puke() cout << ", Range Crossing = " << (disk_info.OPAL20_rangeCrossing ? "Y" : "N"); cout << std::endl; } + if (disk_info.BlockSID) { + cout << "Block SID Authentication function (" << HEXON(4) << FC_BLOCKSID << ")" << HEXOFF << std::endl; + cout << " SID Blocked State = " << (disk_info.BlockSID_SIDBlockedState ? "Y" : "N"); + cout << ", SID Value State = " << (disk_info.BlockSID_SIDValueState ? "Y" : "N"); + cout << ", Hardware Reset = " << (disk_info.BlockSID_HardwareReset ? "Y" : "N"); + cout << std::endl; + } + if (disk_info.Namespace) { + cout << "Namespace function (" << HEXON(4) << FC_NAMESPACE << ")" << HEXOFF << std::endl; + cout << " Maximum Key Count = " << disk_info.Namespace_MaximumKeyCount; + cout << ", Unused Key Count = " << disk_info.Namespace_UnusedKeyCount; + cout << ", Maximum Ranges Per Namespace = " << disk_info.Namespace_MaximumRangesPerNamespace; + cout << std::endl; + } + if (disk_info.Opalite) { + cout << "Opalite function (" << HEXON(4) << FC_OPALITE << ")" << HEXOFF << std::endl; + cout << " Base comID = " << HEXON(4) << disk_info.Opalite_basecomID << HEXOFF; + cout << ", comIDs = " << disk_info.Opalite_numcomIDs; + cout << ", Initial PIN = " << HEXON(2) << disk_info.Opalite_initialPIN << HEXOFF; + cout << ", Reverted PIN = " << HEXON(2) << disk_info.Opalite_revertedPIN << HEXOFF; + cout << std::endl; + } + if (disk_info.Pyrite10) { + cout << "Pyrite 1.0 function (" << HEXON(4) << FC_PYRITEV100 << ")" << HEXOFF << std::endl; + cout << " Base comID = " << HEXON(4) << disk_info.Pyrite10_basecomID << HEXOFF; + cout << ", comIDs = " << disk_info.Pyrite10_numcomIDs; + cout << ", Initial PIN = " << HEXON(2) << disk_info.Pyrite10_initialPIN << HEXOFF; + cout << ", Reverted PIN = " << HEXON(2) << disk_info.Pyrite10_revertedPIN << HEXOFF; + cout << std::endl; + } + if (disk_info.Pyrite20) { + cout << "Pyrite 2.0 function (" << HEXON(4) << FC_PYRITEV200 << ")" << HEXOFF << std::endl; + cout << " Base comID = " << HEXON(4) << disk_info.Pyrite20_basecomID << HEXOFF; + cout << ", comIDs = " << disk_info.Pyrite20_numcomIDs; + cout << ", Initial PIN = " << HEXON(2) << disk_info.Pyrite20_initialPIN << HEXOFF; + cout << ", Reverted PIN = " << HEXON(2) << disk_info.Pyrite20_revertedPIN << HEXOFF; + cout << std::endl; + } + if (disk_info.Ruby10) { + cout << "Ruby 1.0 function (" << HEXON(4) << FC_RUBYV100 << ")" << HEXOFF << std::endl; + cout << " Base comID = " << HEXON(4) << disk_info.Ruby10_basecomID << HEXOFF; + cout << ", comIDs = " << disk_info.Ruby10_numcomIDs; + cout << ", Initial PIN = " << HEXON(2) << disk_info.Ruby10_initialPIN << HEXOFF; + cout << ", Reverted PIN = " << HEXON(2) << disk_info.Ruby10_revertedPIN << HEXOFF; + cout << ", PINonTPerRevert = " << HEXON(2) << disk_info.Ruby10_PINonTPerRevert << HEXOFF; + cout << std::endl; + cout << " Locking Admins = " << disk_info.Ruby10_numAdmins; + cout << ", Locking Users = " << disk_info.Ruby10_numUsers; + cout << ", Range Crossing = " << (disk_info.Ruby10_rangeCrossing ? "Y" : "N"); + cout << std::endl; + } + if (disk_info.DataRem) { + cout << "Supported Data Removal Mechanism function (" << HEXON(4) << FC_DATAREM << ")" << HEXOFF << std::endl; + cout << " Processing = " << (disk_info.DataRem_processing ? "Y" : "N"); + string types[6] = { "Overwrite", "Block", "Crypto", "Unmap", "Reset Write Pointers", "Vendor Specific" }; + for (int i = 0; i < 6; i++) { + if ((disk_info.DataRem_supported & (1 << i)) == 0) + continue; + cout << ", " << types[i]; + cout << " = " << (disk_info.DataRem_time[i] * 2) << + (((disk_info.DataRem_format & (1 << i)) == 0) ? "s " : "m "); + } + cout << std::endl; + } + if (disk_info.NSGeometry) { + cout << "Namespace Geometry function (" << HEXON(4) << FC_NSGEOMETRY << HEXOFF << ")" << std::endl; + cout << " Align = " << (disk_info.NSGeometry_align ? "Y, " : "N, ") + << "Alignment Granularity = " << disk_info.NSGeometry_alignmentGranularity + << " (" << // display bytes + (disk_info.NSGeometry_alignmentGranularity * + disk_info.NSGeometry_logicalBlockSize) + << ")" + << ", Logical Block size = " << disk_info.NSGeometry_logicalBlockSize + << ", Lowest Aligned LBA = " << disk_info.NSGeometry_lowestAlignedLBA + << std::endl; + } if (disk_info.Unknown) cout << "**** " << (uint16_t)disk_info.Unknown << " **** Unknown function codes IGNORED " << std::endl; } diff --git a/Common/DtaDev.h b/Common/DtaDev.h index 473f7bd0..04096a2a 100644 --- a/Common/DtaDev.h +++ b/Common/DtaDev.h @@ -38,6 +38,14 @@ class DtaDev { DtaDev(); /** Default destructor, does nothing*/ virtual ~DtaDev(); + /** Does the device conform to the Ruby 1.0 SSC */ + uint8_t isRuby1(); + /** Does the device conform to the Pyrite 2.0 SSC */ + uint8_t isPyrite2(); + /** Does the device conform to the Pyrite 1.0 SSC */ + uint8_t isPyrite1(); + /** Does the device conform to the Opalite SSC */ + uint8_t isOpalite(); /** Does the device conform to the OPAL 2.0 SSC */ uint8_t isOpal2(); /** Does the device conform to the OPAL 1.0 SSC */ @@ -50,6 +58,8 @@ class DtaDev { uint8_t MBREnabled(); /** Is the MBRDone flag set */ uint8_t MBRDone(); + /** Is the MBRAbsent flag set */ + uint8_t MBRAbsent(); /** Is the Locked flag set */ uint8_t Locked(); /** Is the Locking SP enabled */ @@ -251,16 +261,16 @@ class DtaDev { virtual uint8_t eraseLockingRange(uint8_t lockingrange, char * password) = 0; /** Dumps an object for diagnostic purposes * @param sp index into the OPALUID table for the SP the object is in - * @param auth the authority ti use for the dump - * @param pass the password for the suthority + * @param auth the authority to use for the dump + * @param pass the password for the authority * @param objID the UID of the object to dump * */ virtual uint8_t objDump(char *sp, char * auth, char *pass, char * objID) = 0; /** Issue any command to the drive for diagnostic purposes * @param sp index into the OPALUID table for the SP the object is in - * @param auth the authority ti use for the dump - * @param pass the password for the suthority + * @param auth the authority to use for the dump + * @param pass the password for the authority * @param invoker caller of the method * @param method the method to call * @param plist the parameter list for the command diff --git a/Common/DtaDevEnterprise.cpp b/Common/DtaDevEnterprise.cpp index ae649ec5..bdc169a7 100644 --- a/Common/DtaDevEnterprise.cpp +++ b/Common/DtaDevEnterprise.cpp @@ -365,13 +365,13 @@ uint8_t DtaDevEnterprise::revertLockingSP(char * password, uint8_t keep) cmd->addToken(OPAL_TOKEN::ENDNAME); cmd->addToken(OPAL_TOKEN::ENDLIST); cmd->complete(); - session->expectAbort(); if ((lastRC = session->sendCommand(cmd, response)) != 0) { delete cmd; delete session; return lastRC; } LOG(I) << "revertLockingSP completed successfully"; + session->expectAbort(); delete cmd; delete session; LOG(D1) << "Exiting DtaDevEnterprise::revertLockingSP()"; @@ -435,28 +435,20 @@ uint8_t DtaDevEnterprise::setPassword(char * password, char * userid, char * new return lastRC; } + std::vector hash; if ((newpassword == NULL) || (*newpassword == '\0')) { - std::vector tmppwd; - - tmppwd.push_back(0xd0); - tmppwd.push_back((uint8_t)strnlen(newpwd, 255)); + hash.push_back(0xd0); + hash.push_back((uint8_t)strnlen(newpwd, 255)); for (unsigned int i = 0; i < strnlen(newpwd, 255); i++) { - tmppwd.push_back(newpwd[i]); - } - - if ((lastRC = setTable(usercpin, "PIN", tmppwd)) != 0) { - LOG(E) << "Unable to set user " << userid << " new password "; - delete session; - return lastRC; + hash.push_back(newpwd[i]); } } else { - std::vector hash; DtaHashPwd(hash, newpwd, this); - if ((lastRC = setTable(usercpin, "PIN", hash)) != 0) { - LOG(E) << "Unable to set user " << userid << " new password "; - delete session; - return lastRC; - } + } + if ((lastRC = setTable(usercpin, "PIN", hash)) != 0) { + LOG(E) << "Unable to set user " << userid << " new password "; + delete session; + return lastRC; } LOG(I) << userid << " password changed"; delete session; @@ -897,13 +889,13 @@ uint8_t DtaDevEnterprise::revertTPer(char * password, uint8_t PSID, uint8_t Admi cmd->addToken(OPAL_TOKEN::STARTLIST); cmd->addToken(OPAL_TOKEN::ENDLIST); cmd->complete(); - session->expectAbort(); if ((lastRC = session->sendCommand(cmd, response)) != 0) { delete cmd; delete session; return lastRC; } LOG(I) << "revertTper completed successfully"; + session->expectAbort(); delete cmd; delete session; LOG(D1) << "Exiting DtaDevEnterprise::revertTPer()"; @@ -1182,7 +1174,7 @@ uint8_t DtaDevEnterprise::initLSPUsers(char * defaultPassword, char * newPasswor delete session; return lastRC; } - LOG(I) << "EraseMaster password set"; + LOG(I) << "EraseMaster password set"; delete session; // look up MaxRanges uint16_t MaxRanges = 0; @@ -1274,57 +1266,53 @@ uint8_t DtaDevEnterprise::setSIDPassword(char * oldpassword, char * newpassword, { LOG(D1) << "Entering DtaDevEnterprise::setSIDPassword()"; uint8_t lastRC; + string defaultPassword; + char *pwd = oldpassword, *newpwd = newpassword; - vector user; - set8(user, OPALUID[OPAL_SID_UID]); + std::vector user; + set8(user, OPALUID[OPAL_SID_UID]); - vector usercpin; - set8(usercpin, OPALUID[OPAL_C_PIN_SID]); + std::vector usercpin; + set8(usercpin, OPALUID[OPAL_C_PIN_SID]); - if (*oldpassword == '\0') - { + if ((oldpassword == NULL) || (*oldpassword == '\0') || + (newpassword == NULL) || (*newpassword == '\0')) { if ((lastRC = getDefaultPassword()) != 0) { - LOG(E) << "setPassword failed to retrieve MSID"; + LOG(E) << "setSIDPassword failed to retrieve MSID"; return lastRC; } - string defaultPassword = response.getString(5); - session = new DtaSession(this); - if (session == NULL) { - LOG(E) << "Unable to create session object "; - return DTAERROR_OBJECT_CREATE_FAILED; + defaultPassword = response.getString(5); + if ((oldpassword == NULL) || (*oldpassword == '\0')) { + pwd = (char *)defaultPassword.c_str(); + hasholdpwd = 0; } - session->dontHashPwd(); - if ((lastRC = session->start(OPAL_UID::OPAL_ADMINSP_UID, (char *)defaultPassword.c_str(), user)) != 0) { - delete session; - return lastRC; + + if ((newpassword == NULL) || (*newpassword == '\0')) { + newpwd = (char *)defaultPassword.c_str(); + hashnewpwd = 0; } } - else - { - session = new DtaSession(this); - if (session == NULL) { - LOG(E) << "Unable to create session object "; - return DTAERROR_OBJECT_CREATE_FAILED; - } - session->dontHashPwd(); - if (!hasholdpwd) session->dontHashPwd(); - if ((lastRC = session->start(OPAL_UID::OPAL_ADMINSP_UID, oldpassword, user)) != 0) { - delete session; - return lastRC; - } + + session = new DtaSession(this); + if (session == NULL) { + LOG(E) << "Unable to create session object "; + return DTAERROR_OBJECT_CREATE_FAILED; } - vector hash; - if (hashnewpwd) - { - DtaHashPwd(hash, newpassword, this); + if (!hasholdpwd) + session->dontHashPwd(); + if ((lastRC = session->start(OPAL_UID::OPAL_ADMINSP_UID, pwd, user)) != 0) { + delete session; + return lastRC; } - else - { + + std::vector hash; + if (hashnewpwd) { + DtaHashPwd(hash, newpwd, this); + } else { hash.push_back(0xd0); - hash.push_back((uint8_t)strnlen(newpassword, 255)); - for (uint16_t i = 0; i < strnlen(newpassword, 255); i++) - { - hash.push_back(newpassword[i]); + hash.push_back((uint8_t)strnlen(newpwd, 255)); + for (uint16_t i = 0; i < strnlen(newpwd, 255); i++) { + hash.push_back(newpwd[i]); } } if ((lastRC = setTable(usercpin, "PIN", hash)) != 0) { @@ -1332,6 +1320,7 @@ uint8_t DtaDevEnterprise::setSIDPassword(char * oldpassword, char * newpassword, delete session; return lastRC; } + LOG(I) << "SID password changed"; delete session; LOG(D1) << "Exiting DtaDevEnterprise::setSIDPassword()"; return 0; diff --git a/Common/DtaDevEnterprise.h b/Common/DtaDevEnterprise.h index 5350da5c..3d60b581 100644 --- a/Common/DtaDevEnterprise.h +++ b/Common/DtaDevEnterprise.h @@ -188,15 +188,15 @@ class DtaDevEnterprise : public DtaDevOS { void puke(); /** Dumps an object for diagnostic purposes * @param sp index into the OPALUID table for the SP the object is in - * @param auth the authority ti use for the dump - * @param pass the password for the suthority + * @param auth the authority to use for the dump + * @param pass the password for the authority * @param objID the UID of the object to dump * */ uint8_t objDump(char *sp, char * auth, char *pass, char * objID); /** Issue any command to the drive for diagnostic purposes * @param sp index into the OPALUID table for the SP the object is in - * @param hexauth the authority ti use for the dump - * @param pass the password for the suthority + * @param hexauth the authority to use for the dump + * @param pass the password for the authority * @param hexinvokingUID caller of the method * @param hexmethod the method to call * @param hexparms the parameter list for the command diff --git a/Common/DtaDevGeneric.h b/Common/DtaDevGeneric.h index 9f5f9752..e4eedd16 100644 --- a/Common/DtaDevGeneric.h +++ b/Common/DtaDevGeneric.h @@ -195,16 +195,16 @@ class DtaDevGeneric : public DtaDevOS { virtual uint8_t eraseLockingRange(uint8_t lockingrange, char * password); /** Dumps an object for diagnostic purposes * @param sp index into the OPALUID table for the SP the object is in - * @param auth the authority ti use for the dump - * @param pass the password for the suthority + * @param auth the authority to use for the dump + * @param pass the password for the authority * @param objID the UID of the object to dump */ uint8_t objDump(char *sp, char * auth, char *pass, char * objID) ; /** Issue any command to the drive for diagnostic purposes * @param sp index into the OPALUID table for the SP the object is in - * @param auth the authority ti use for the dump - * @param pass the password for the suthority + * @param auth the authority to use for the dump + * @param pass the password for the authority * @param invoker caller of the method * @param method the method to call * @param plist the parameter list for the command diff --git a/Common/DtaDevOpal.cpp b/Common/DtaDevOpal.cpp index e7fc0570..f478a77a 100644 --- a/Common/DtaDevOpal.cpp +++ b/Common/DtaDevOpal.cpp @@ -24,7 +24,7 @@ along with sedutil. If not, see . #include #include #include -#include +#include #include "DtaDevOpal.h" #include "DtaHashPwd.h" #include "DtaEndianFixup.h" @@ -33,6 +33,7 @@ along with sedutil. If not, see . #include "DtaResponse.h" #include "DtaSession.h" #include "DtaHexDump.h" +#include "DtaAnnotatedDump.h" using namespace std; @@ -70,13 +71,8 @@ uint8_t DtaDevOpal::initialSetup(char * password) LOG(E) << "Initial setup failed - unable to set global locking range RW"; return lastRC; } - if ((lastRC = setMBRDone(1, password)) != 0){ - LOG(E) << "Initial setup failed - unable to Enable MBR shadow"; - return lastRC; - } - if ((lastRC = setMBREnable(1, password)) != 0){ - LOG(E) << "Initial setup failed - unable to Enable MBR shadow"; - return lastRC; + if (!MBRAbsent()) { + setMBREnable(1, password); } LOG(I) << "Initial setup of TPer complete on " << dev; @@ -587,7 +583,7 @@ uint8_t DtaDevOpal::rekeyLockingRange_SUM(vector LR, vector U } uint8_t DtaDevOpal::setBandsEnabled(int16_t lockingrange, char * password) { - if (password == NULL) { LOG(D4) << "Password is NULL"; } // unreferenced formal parameter + if (password == NULL) { LOG(D4) << "Password is NULL"; } // unreferenced formal paramater LOG(D1) << "Entering DtaDevOpal::setBandsEnabled()" << lockingrange << " " << dev; LOG(I) << "setBandsEnabled is not implemented. It is not part of the Opal SSC "; LOG(D1) << "Exiting DtaDevOpal::setBandsEnabled()"; @@ -638,6 +634,7 @@ uint8_t DtaDevOpal::revertLockingSP(char * password, uint8_t keep) // empty list returned so rely on method status LOG(I) << "Revert LockingSP complete"; session->expectAbort(); + delete cmd; delete session; LOG(D1) << "Exiting DtaDevOpal::revertLockingSP()"; return 0; @@ -1110,13 +1107,13 @@ uint8_t DtaDevOpal::revertTPer(char * password, uint8_t PSID, uint8_t AdminSP) cmd->addToken(OPAL_TOKEN::STARTLIST); cmd->addToken(OPAL_TOKEN::ENDLIST); cmd->complete(); - session->expectAbort(); if ((lastRC = session->sendCommand(cmd, response)) != 0) { delete cmd; delete session; return lastRC; } LOG(I) << "revertTper completed successfully"; + session->expectAbort(); delete cmd; delete session; LOG(D1) << "Exiting DtaDevOpal::revertTPer()"; @@ -1484,6 +1481,7 @@ uint8_t DtaDevOpal::setSIDPassword(char * oldpassword, char * newpassword, delete session; return lastRC; } + LOG(I) << "SID password changed"; delete session; LOG(D1) << "Exiting DtaDevOpal::setSIDPassword()"; return 0; @@ -1567,6 +1565,7 @@ uint8_t DtaDevOpal::exec(DtaCommand * cmd, DtaResponse & resp, uint8_t protocol) uint8_t lastRC; OPALHeader * hdr = (OPALHeader *) cmd->getCmdBuffer(); LOG(D3) << endl << "Dumping command buffer"; + IFLOG(D) DtaAnnotatedDump(IF_SEND, cmd->getCmdBuffer(), cmd->outputBufferSize()); IFLOG(D3) DtaHexDump(cmd->getCmdBuffer(), SWAP32(hdr->cp.length) + sizeof (OPALComPacket)); if((lastRC = sendCmd(IF_SEND, protocol, comID(), cmd->getCmdBuffer(), cmd->outputBufferSize())) != 0) { LOG(E) << "Command failed on send " << (uint16_t) lastRC; @@ -1581,6 +1580,7 @@ uint8_t DtaDevOpal::exec(DtaCommand * cmd, DtaResponse & resp, uint8_t protocol) } while ((0 != hdr->cp.outstandingData) && (0 == hdr->cp.minTransfer)); LOG(D3) << std::endl << "Dumping reply buffer"; + IFLOG(D) DtaAnnotatedDump(IF_RECV, cmd->getRespBuffer(), SWAP32(hdr->cp.length) + sizeof (OPALComPacket)); IFLOG(D3) DtaHexDump(cmd->getRespBuffer(), SWAP32(hdr->cp.length) + sizeof (OPALComPacket)); if (0 != lastRC) { LOG(E) << "Command failed on recv" << (uint16_t) lastRC; diff --git a/Common/DtaDevOpal.h b/Common/DtaDevOpal.h index 60004db4..33bc357f 100644 --- a/Common/DtaDevOpal.h +++ b/Common/DtaDevOpal.h @@ -243,16 +243,16 @@ class DtaDevOpal : public DtaDevOS { void puke(); /** Dumps an object for diagnostic purposes * @param sp index into the OPALUID table for the SP the object is in - * @param auth the authority ti use for the dump - * @param pass the password for the suthority + * @param auth the authority to use for the dump + * @param pass the password for the authority * @param objID the UID of the object to dump * */ uint8_t objDump(char *sp, char * auth, char *pass, char * objID); /** Issue any command to the drive for diagnostic purposes * @param sp index into the OPALUID table for the SP the object is in - * @param auth the authority ti use for the dump - * @param pass the password for the suthority + * @param auth the authority to use for the dump + * @param pass the password for the authority * @param invoker caller of the method * @param method the method to call * @param plist the parameter list for the command diff --git a/Common/DtaDevOpalite.cpp b/Common/DtaDevOpalite.cpp new file mode 100644 index 00000000..1443f8c5 --- /dev/null +++ b/Common/DtaDevOpalite.cpp @@ -0,0 +1,35 @@ +/* C:B************************************************************************** +This software is Copyright 2014-2017 Bright Plaza Inc. + +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 . + + * C:E********************************************************************** */ + +#include "DtaDevOpalite.h" + +using namespace std; + + +DtaDevOpalite::DtaDevOpalite (const char * devref) +{ + DtaDevOpal::init(devref); + assert(isOpalite()); +} + +DtaDevOpalite::~DtaDevOpalite() +{ +} +uint16_t DtaDevOpalite::comID() { return disk_info.Opalite_basecomID; } diff --git a/Common/DtaDevOpalite.h b/Common/DtaDevOpalite.h new file mode 100644 index 00000000..7eec2ecf --- /dev/null +++ b/Common/DtaDevOpalite.h @@ -0,0 +1,34 @@ +/* C:B************************************************************************** +This software is Copyright 2014-2017 Bright Plaza Inc. + +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 . + + * C:E********************************************************************** */ +#pragma once +#include "os.h" +#include "DtaDevOpal.h" + +using namespace std; +/** Class representing a disk device, this class is represents a disk that conforms +* to the Opalite SSC +*/ +class DtaDevOpalite : public DtaDevOpal { +public: + DtaDevOpalite(const char * devref); + ~DtaDevOpalite(); + /** return the communication ID to be used with this device */ + uint16_t comID(); +}; \ No newline at end of file diff --git a/Common/DtaDevPyrite1.cpp b/Common/DtaDevPyrite1.cpp new file mode 100644 index 00000000..fde0d2d4 --- /dev/null +++ b/Common/DtaDevPyrite1.cpp @@ -0,0 +1,35 @@ +/* C:B************************************************************************** +This software is Copyright 2014-2017 Bright Plaza Inc. + +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 . + + * C:E********************************************************************** */ + +#include "DtaDevPyrite1.h" + +using namespace std; + + +DtaDevPyrite1::DtaDevPyrite1 (const char * devref) +{ + DtaDevOpal::init(devref); + assert(isPyrite1()); +} + +DtaDevPyrite1::~DtaDevPyrite1() +{ +} +uint16_t DtaDevPyrite1::comID() { return disk_info.Pyrite10_basecomID; } diff --git a/Common/DtaDevPyrite1.h b/Common/DtaDevPyrite1.h new file mode 100644 index 00000000..52473e9d --- /dev/null +++ b/Common/DtaDevPyrite1.h @@ -0,0 +1,35 @@ +/* C:B************************************************************************** +This software is Copyright 2014-2017 Bright Plaza Inc. + +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 . + + * C:E********************************************************************** */ +#pragma once +#include "os.h" +#include "DtaDevOpal.h" + +using namespace std; +/** Class representing a disk device, this class is represents a disk that conforms +* to the Pyrite 1.0 SSC +*/ +class DtaDevPyrite1 : public DtaDevOpal { +public: + DtaDevPyrite1(const char * devref); + ~DtaDevPyrite1(); + /** return the communication ID to be used with this device */ + uint16_t comID(); + +}; \ No newline at end of file diff --git a/Common/DtaDevPyrite2.cpp b/Common/DtaDevPyrite2.cpp new file mode 100644 index 00000000..f25cb471 --- /dev/null +++ b/Common/DtaDevPyrite2.cpp @@ -0,0 +1,35 @@ +/* C:B************************************************************************** +This software is Copyright 2014-2017 Bright Plaza Inc. + +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 . + + * C:E********************************************************************** */ + +#include "DtaDevPyrite2.h" + +using namespace std; + + +DtaDevPyrite2::DtaDevPyrite2 (const char * devref) +{ + DtaDevOpal::init(devref); + assert(isPyrite2()); +} + +DtaDevPyrite2::~DtaDevPyrite2() +{ +} +uint16_t DtaDevPyrite2::comID() { return disk_info.Pyrite20_basecomID; } diff --git a/Common/DtaDevPyrite2.h b/Common/DtaDevPyrite2.h new file mode 100644 index 00000000..16c34c2b --- /dev/null +++ b/Common/DtaDevPyrite2.h @@ -0,0 +1,35 @@ +/* C:B************************************************************************** +This software is Copyright 2014-2017 Bright Plaza Inc. + +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 . + + * C:E********************************************************************** */ +#pragma once +#include "os.h" +#include "DtaDevOpal.h" + +using namespace std; +/** Class representing a disk device, this class is represents a disk that conforms +* to the Pyrite 2.0 SSC +*/ +class DtaDevPyrite2 : public DtaDevOpal { +public: + DtaDevPyrite2(const char * devref); + ~DtaDevPyrite2(); + /** return the communication ID to be used with this device */ + uint16_t comID(); + +}; \ No newline at end of file diff --git a/Common/DtaDevRuby1.cpp b/Common/DtaDevRuby1.cpp new file mode 100644 index 00000000..9a8b4e52 --- /dev/null +++ b/Common/DtaDevRuby1.cpp @@ -0,0 +1,35 @@ +/* C:B************************************************************************** +This software is Copyright 2014-2017 Bright Plaza Inc. + +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 . + + * C:E********************************************************************** */ + +#include "DtaDevRuby1.h" + +using namespace std; + + +DtaDevRuby1::DtaDevRuby1 (const char * devref) +{ + DtaDevOpal::init(devref); + assert(isRuby1()); +} + +DtaDevRuby1::~DtaDevRuby1() +{ +} +uint16_t DtaDevRuby1::comID() { return disk_info.Ruby10_basecomID; } diff --git a/Common/DtaDevRuby1.h b/Common/DtaDevRuby1.h new file mode 100644 index 00000000..c1c8be40 --- /dev/null +++ b/Common/DtaDevRuby1.h @@ -0,0 +1,38 @@ +/* C:B************************************************************************** +This software is Copyright 2014-2017 Bright Plaza Inc. + +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 . + + * C:E********************************************************************** */ +#pragma once +#include "os.h" +#include "DtaDevOpal.h" + +using namespace std; +/** Class representing a disk device, this class is represents a disk that conforms +* to the OPAL 2.0 SSC +* +* testing so far indicates that the functions implemented in this program +* function the same in OPAL 1.0 and Opal 2.0 +*/ +class DtaDevRuby1 : public DtaDevOpal { +public: + DtaDevRuby1(const char * devref); + ~DtaDevRuby1(); + /** return the communication ID to be used with this device */ + uint16_t comID(); + +}; \ No newline at end of file diff --git a/Common/DtaOptions.cpp b/Common/DtaOptions.cpp index 9be2af17..c4151299 100644 --- a/Common/DtaOptions.cpp +++ b/Common/DtaOptions.cpp @@ -25,7 +25,7 @@ void usage() { printf("sedutil v%s Copyright 2014-2017 Bright Plaza Inc. \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("to the TCG Enterprise, Opal, Opalite and Pyrite SSC specs\n"); printf("General Usage: (see readme for extended commandset)\n"); printf("sedutil-cli <-v> <-n> \n"); printf("-v (optional) increase verbosity, one to five v's\n"); @@ -49,10 +49,10 @@ void usage() printf(" Rekey Locking Range\n"); printf("--setBandsEnabled \n"); printf(" Set Enabled for all Locking Ranges\n"); - printf(" (passwort = \"\" for MSID) \n"); + printf(" (password = \"\" for MSID) \n"); printf("--setBandEnabled <0...n> \n"); printf(" Set Enabled for Locking Range[n]\n"); - printf(" (passwort = \"\" for MSID) \n"); + printf(" (password = \"\" for MSID) \n"); printf("--eraseLockingRange <0...n> \n"); printf(" Erase a Locking Range\n"); printf(" 0 = GLobal 1..n = LRn \n"); @@ -64,13 +64,10 @@ void usage() printf(" is new SID and Admin1 password\n"); printf("--setSIDPassword \n"); printf(" Change the SID password\n"); - printf("--setAdmin1Pwd \n"); - printf(" Change the Admin1 password\n"); printf("--setPassword \n"); - printf(" Change the Enterprise password for userid\n"); - printf(" \"EraseMaster\" or \"BandMaster\", 0 <= n <= 1023\n"); - printf("--enableUser \n"); - printf(" Enable a user (User1..UserX) on an Opal device\n"); + printf(" Change password for userid:\n"); + printf(" Enteprise: \"EraseMaster\" or \"BandMaster\"\n"); + printf(" Opal: \"Admin\" or \"User\"\n"); printf("--setLockingRange <0...n> \n"); printf(" Set the status of a Locking Range\n"); printf(" 0 = GLobal 1..n = LRn \n"); @@ -93,15 +90,20 @@ void usage() printf(" deactivate the Locking SP \n"); printf(" without erasing the data \n"); printf(" on GLOBAL RANGE *ONLY* \n"); - printf("--yesIreallywanttoERASEALLmydatausingthePSID \n"); - printf(" revert the device using the PSID *ERASING* *ALL* the data \n"); + printf("--PSIDrevert \n"); + printf("--yesIreallywanttoERASEALLmydatausingthePSID \n"); + printf(" revert the device using the PSID *ERASING*\n"); + printf(" *ALL* the data\n"); + printf("--PSIDrevertAdminSP \n"); + printf(" Alike to PSIDrevert, but on Enterprise calls\n"); + printf(" AdminSP->Revert instead of ThisSP->RevertSP\n"); printf("--printDefaultPassword \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 %s \n", DEVICEEXAMPLE); + printf("sedutil-cli --yesIreallywanttoERASEALLmydatausingthePSID %s \n", DEVICEEXAMPLE); printf("sedutil-cli --initialSetup %s \n", DEVICEEXAMPLE); return; } @@ -128,6 +130,7 @@ uint8_t DtaOptions(int argc, char * argv[], DTA_OPTIONS * opts) loggingLevel += (uint16_t)(strlen(argv[i]) - 1); if (loggingLevel > 7) loggingLevel = 7; CLog::Level() = CLog::FromInt(loggingLevel); + RCLog::Level() = RCLog::FromInt(loggingLevel); LOG(D) << "Log level set to " << CLog::ToString(CLog::FromInt(loggingLevel)); LOG(D) << "sedutil version : " << GIT_VERSION; } @@ -184,7 +187,7 @@ uint8_t DtaOptions(int argc, char * argv[], DTA_OPTIONS * opts) 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, 3) OPTION_IS(password) OPTION_IS(userid) + 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) diff --git a/Common/DtaSession.cpp b/Common/DtaSession.cpp index e7b51a14..d5dc9bd4 100644 --- a/Common/DtaSession.cpp +++ b/Common/DtaSession.cpp @@ -98,8 +98,10 @@ DtaSession::start(OPAL_UID SP, char * HostChallenge, vector SignAuthori { LOG(D1) << "Entering DtaSession::startSession "; vector hash; + int settimeout = d->isEprise(); lastRC = 0; +again: DtaCommand *cmd = new DtaCommand(); if (NULL == cmd) { LOG(E) << "Unable to create session object "; @@ -131,7 +133,7 @@ DtaSession::start(OPAL_UID SP, char * HostChallenge, vector SignAuthori // w/o the timeout the session may wedge and require a power-cycle, // e.g., when interrupted by ^C. 60 seconds is inconveniently long, // but revert may require that long to complete. - if (d->isEprise()) { + if (settimeout) { cmd->addToken(OPAL_TOKEN::STARTNAME); cmd->addToken("SessionTimeout"); cmd->addToken(60000); @@ -141,8 +143,13 @@ DtaSession::start(OPAL_UID SP, char * HostChallenge, vector SignAuthori cmd->addToken(OPAL_TOKEN::ENDLIST); // ] (Close Bracket) cmd->complete(); if ((lastRC = sendCommand(cmd, response)) != 0) { - LOG(E) << "Session start failed rc = " << (int)lastRC; delete cmd; + if (settimeout) { + LOG(D2) << "Session start with timeout failed rc = " << (int)lastRC; + settimeout = 0; + goto again; + } + LOG(E) << "Session start failed rc = " << (int)lastRC; return lastRC; } // call user method SL HSN TSN EL EOD SL 00 00 00 EL @@ -221,6 +228,12 @@ DtaSession::sendCommand(DtaCommand * cmd, DtaResponse & response) * have a sane reply to work with */ // zero lengths -- these are big endian but it doesn't matter for uint = 0 + if ((0 == response.h.cp.outstandingData) && + (0 == response.h.cp.minTransfer) && + (0 == response.h.cp.length)) { + LOG(D1) << "All Response(s) returned – no further data, request parsing error"; + return DTAERROR_COMMAND_ERROR; + } if ((0 == response.h.cp.length) || (0 == response.h.pkt.length) || (0 == response.h.subpkt.length)) { @@ -255,14 +268,14 @@ DtaSession::setProtocol(uint8_t value) void DtaSession::dontHashPwd() { - LOG(D1) << "Entering DtaSession::setProtocol"; + LOG(D1) << "Entering DtaSession::dontHashPwd"; hashPwd = 0; } void DtaSession::expectAbort() { - LOG(D1) << "Entering DtaSession::methodStatus()"; + LOG(D1) << "Entering DtaSession::expectAbort()"; willAbort = 1; } diff --git a/Common/DtaStructures.h b/Common/DtaStructures.h index f6a61bc3..b5665bd0 100644 --- a/Common/DtaStructures.h +++ b/Common/DtaStructures.h @@ -21,14 +21,24 @@ along with sedutil. If not, see . #pragma pack(push) #pragma pack(1) -#define FC_TPER 0x0001 -#define FC_LOCKING 0x0002 -#define FC_GEOMETRY 0x0003 -#define FC_ENTERPRISE 0x0100 -#define FC_DATASTORE 0x0202 -#define FC_SINGLEUSER 0x0201 -#define FC_OPALV100 0x0200 -#define FC_OPALV200 0x0203 +#define FC_TPER 0x0001 /* TPer */ +#define FC_LOCKING 0x0002 /* Locking */ +#define FC_GEOMETRY 0x0003 /* Geometry Reporting */ +#define FC_SECUREMSG 0x0004 /* Secure Messaging */ +#define FC_ENTERPRISE 0x0100 /* Enterprise SSC */ +#define FC_OPALV100 0x0200 /* Opal SSC V1.00 */ +#define FC_SINGLEUSER 0x0201 /* Single User Mode */ +#define FC_DATASTORE 0x0202 /* DataStore Table */ +#define FC_OPALV200 0x0203 /* Opal SSC V2.00 */ +#define FC_OPALITE 0x0301 /* Opalite SSC */ +#define FC_PYRITEV100 0x0302 /* Pyrite SSC V1.00 */ +#define FC_PYRITEV200 0x0303 /* Pyrite SSC V2.00 */ +#define FC_RUBYV100 0x0304 /* Ruby SSC V1.00 */ +#define FC_LOCKINGLBA 0x0401 /* Locking LBA Ranges Control */ +#define FC_BLOCKSID 0x0402 /* Block SID Authentication */ +#define FC_NAMESPACE 0x0403 /* Configurable Namespace Locking*/ +#define FC_DATAREM 0x0404 /* Supported Data Removal Mechanism */ +#define FC_NSGEOMETRY 0x0405 /* Namespace Geometry Reporting */ /** The Discovery 0 Header. As defined in * Opal SSC Documentation */ @@ -83,8 +93,8 @@ typedef struct _Discovery0LockingFeatures { uint8_t version : 4; uint8_t length; /* Big endian - uint8_t reserved01 : 1; uint8_t reserved02 : 1; + uint8_t MBRAbsent : 1; uint8_t MBRDone : 1; uint8_t MBREnabled : 1; uint8_t mediaEncryption : 1; @@ -98,7 +108,7 @@ typedef struct _Discovery0LockingFeatures { uint8_t mediaEncryption : 1; uint8_t MBREnabled : 1; uint8_t MBRDone : 1; - uint8_t reserved01 : 1; + uint8_t MBRAbsent : 1; uint8_t reserved02 : 1; uint32_t reserved03; @@ -127,6 +137,23 @@ typedef struct _Discovery0GeometryFeatures { uint64_t lowestAlighedLBA; } Discovery0GeometryFeatures; +/** Secure Messaging Feature Descriptor + */ +typedef struct _Discovery0SecureMsgFeatures { + uint16_t featureCode; /* 0x0004 */ + uint8_t reserved_v : 4; + uint8_t version : 4; + uint8_t length; + /* big Endian + uint8_t activated : 1; + uint8_t reserved01 : 7; + */ + uint8_t reserved01 : 7; + uint8_t activated : 1; + uint8_t reserved02[3]; + uint16_t numberOfSPs; +} Discovery0SecureMsgFeatures; + /** Enterprise SSC Feature */ typedef struct _Discovery0EnterpriseSSC { @@ -158,6 +185,12 @@ typedef struct _Discovery0OpalV100 { uint8_t length; uint16_t baseComID; uint16_t numberComIDs; + /* big endian + uint8_t reserved01 : 7; + uint8_t rangeCrossing : 1; + */ + uint8_t rangeCrossing : 1; + uint8_t reserved01 : 7; } Discovery0OpalV100; /** Single User Mode feature */ @@ -219,16 +252,159 @@ typedef struct _Discovery0OPALV200 { uint8_t reserved02; uint32_t reserved03; } Discovery0OPALV200; + +/** Block SID Authentication feature + */ +typedef struct _Discovery0BlockSID { + uint16_t featureCode; /* 0x0402 */ + uint8_t reserved_v : 4; + uint8_t version : 4; + uint8_t length; + /* big endian + uint8_t reserved01 : 6; + uint8_t SIDBlockedState : 1; + uint8_t SIDValueState : 1; + */ + uint8_t SIDValueState : 1; + uint8_t SIDBlockedState : 1; + uint8_t reserved01 : 6; + + /* big endian + uint8_t reserved01 : 7; + uint8_t HardwareReset : 1; + */ + uint8_t HardwareReset : 1; + uint8_t reserved02 : 7; +} Discovery0BlockSID; + +/** Namespace feature + */ +typedef struct _Discovery0Namespace { + uint16_t featureCode; /* 0x0403 */ + uint8_t reserved_v : 4; + uint8_t version : 4; + uint8_t length; + /* big endian + uint8_t rangeCapable : 1; + uint8_t rangePresent : 1; + uint8_t reserved01 : 6; + */ + uint8_t reserved01 : 6; + uint8_t rangePresent : 1; + uint8_t rangeCapable : 1; + + uint8_t reserved02[3]; + uint32_t MaximumKeyCount; + uint32_t UnusedKeyCount; + uint32_t MaximumRangesPerNamespace; +} Discovery0Namespace; + +/** Opalite feature + */ +typedef struct _Discovery0Opalite { + uint16_t featureCode; /* 0x0301 */ + uint8_t reserved_v : 4; + uint8_t version : 4; + uint8_t length; + uint16_t baseCommID; + uint16_t numCommIDs; + uint8_t reserved01[5]; + uint8_t initialPIN; + uint8_t revertedPIN; + uint8_t reserved02; + uint32_t reserved03; +} Discovery0Opalite; + +/** Pyrite 1.0 feature + */ +typedef struct _Discovery0Pyrite10 { + uint16_t featureCode; /* 0x0302 */ + uint8_t reserved_v : 4; + uint8_t version : 4; + uint8_t length; + uint16_t baseCommID; + uint16_t numCommIDs; + uint8_t reserved01[5]; + uint8_t initialPIN; + uint8_t revertedPIN; + uint8_t reserved02; + uint32_t reserved03; +} Discovery0Pyrite10; + +/** Pyrite 2.0 feature + */ +typedef struct _Discovery0Pyrite20 { + uint16_t featureCode; /* 0x0303 */ + uint8_t reserved_v : 4; + uint8_t version : 4; + uint8_t length; + uint16_t baseCommID; + uint16_t numCommIDs; + uint8_t reserved01[5]; + uint8_t initialPIN; + uint8_t revertedPIN; + uint8_t reserved02; + uint32_t reserved03; +} Discovery0Pyrite20; + +/** Ruby 1.0 feature + */ +typedef struct _Discovery0Ruby10 { + uint16_t featureCode; /* 0x0304 */ + uint8_t reserved_v : 4; + uint8_t version : 4; + uint8_t length; + uint16_t baseCommID; + uint16_t numCommIDs; + /* big endian + uint8_t reserved01 : 7; + uint8_t rangeCrossing : 1; + */ + uint8_t rangeCrossing : 1; + uint8_t reserved01 : 7; + + uint16_t numlockingAdminAuth; + uint16_t numlockingUserAuth; + uint8_t initialPIN; + uint8_t revertedPIN; + uint8_t PINonTPerRevert; + uint8_t reserved02[5]; +} Discovery0Ruby10; + +/** Supported Data Removal Mechanism feature + */ +typedef struct _Discovery0DataRem { + uint16_t featureCode; /* 0x0404 */ + uint8_t reserved_v : 4; + uint8_t version : 4; + uint8_t length; + uint8_t reserved01; + uint8_t processing; + uint8_t supported; + uint8_t format; + uint16_t time[6]; + uint8_t reserved02[16]; +} Discovery0DataRem; + /** Union of features used to parse the discovery 0 response */ union Discovery0Features { Discovery0TPerFeatures TPer; Discovery0LockingFeatures locking; Discovery0GeometryFeatures geometry; + Discovery0SecureMsgFeatures secureMsg; Discovery0EnterpriseSSC enterpriseSSC; Discovery0SingleUserMode singleUserMode; Discovery0OPALV200 opalv200; Discovery0OpalV100 opalv100; Discovery0DatastoreTable datastore; + Discovery0BlockSID blockSID; + Discovery0Namespace ns; + Discovery0Opalite opalite; + Discovery0Pyrite10 pyrite10; + Discovery0Pyrite20 pyrite20; + Discovery0Ruby10 ruby10; + Discovery0DataRem dataRem; + Discovery0GeometryFeatures nsgeometry; }; /** ComPacket (header) for transmissions. */ @@ -287,6 +463,7 @@ typedef struct _OPAL_DiskInfo { uint8_t TPer : 1; uint8_t Locking : 1; uint8_t Geometry : 1; + uint8_t SecureMsg : 1; uint8_t Enterprise : 1; uint8_t SingleUser : 1; uint8_t DataStore : 1; @@ -294,6 +471,14 @@ typedef struct _OPAL_DiskInfo { uint8_t OPAL10 : 1; uint8_t Properties : 1; uint8_t ANY_OPAL_SSC : 1; + uint8_t BlockSID : 1; + uint8_t Namespace : 1; + uint8_t Opalite : 1; + uint8_t Pyrite10 : 1; + uint8_t Pyrite20 : 1; + uint8_t Ruby10 : 1; + uint8_t DataRem : 1; + uint8_t NSGeometry : 1; // values ONLY VALID IF FUNCTION ABOVE IS TRUE!!!!! uint8_t TPer_ACKNACK : 1; uint8_t TPer_async : 1; @@ -306,11 +491,14 @@ typedef struct _OPAL_DiskInfo { uint8_t Locking_lockingSupported : 1; uint8_t Locking_MBRDone : 1; uint8_t Locking_MBREnabled : 1; + uint8_t Locking_MBRAbsent : 1; uint8_t Locking_mediaEncrypt : 1; uint8_t Geometry_align : 1; uint64_t Geometry_alignmentGranularity; uint32_t Geometry_logicalBlockSize; uint64_t Geometry_lowestAlignedLBA; + uint8_t SecureMsg_activated : 1; + uint16_t SecureMsg_numberOfSPs; uint8_t Enterprise_rangeCrossing : 1; uint16_t Enterprise_basecomID; uint16_t Enterprise_numcomID; @@ -323,6 +511,7 @@ typedef struct _OPAL_DiskInfo { uint32_t DataStore_alignment; uint16_t OPAL10_basecomID; uint16_t OPAL10_numcomIDs; + uint8_t OPAL10_rangeCrossing; uint16_t OPAL20_basecomID; uint16_t OPAL20_numcomIDs; uint8_t OPAL20_initialPIN; @@ -330,6 +519,40 @@ typedef struct _OPAL_DiskInfo { uint16_t OPAL20_numAdmins; uint16_t OPAL20_numUsers; uint8_t OPAL20_rangeCrossing; + uint8_t BlockSID_SIDBlockedState; + uint8_t BlockSID_SIDValueState; + uint8_t BlockSID_HardwareReset; + uint32_t Namespace_MaximumKeyCount; + uint32_t Namespace_UnusedKeyCount; + uint32_t Namespace_MaximumRangesPerNamespace; + uint16_t Opalite_basecomID; + uint16_t Opalite_numcomIDs; + uint8_t Opalite_initialPIN; + uint8_t Opalite_revertedPIN; + uint16_t Pyrite10_basecomID; + uint16_t Pyrite10_numcomIDs; + uint8_t Pyrite10_initialPIN; + uint8_t Pyrite10_revertedPIN; + uint16_t Pyrite20_basecomID; + uint16_t Pyrite20_numcomIDs; + uint8_t Pyrite20_initialPIN; + uint8_t Pyrite20_revertedPIN; + uint16_t Ruby10_basecomID; + uint16_t Ruby10_numcomIDs; + uint16_t Ruby10_numAdmins; + uint16_t Ruby10_numUsers; + uint8_t Ruby10_initialPIN; + uint8_t Ruby10_revertedPIN; + uint8_t Ruby10_PINonTPerRevert; + uint8_t Ruby10_rangeCrossing; + uint8_t DataRem_processing; + uint8_t DataRem_supported; + uint8_t DataRem_format; + uint16_t DataRem_time[6]; + uint8_t NSGeometry_align : 1; + uint64_t NSGeometry_alignmentGranularity; + uint32_t NSGeometry_logicalBlockSize; + uint64_t NSGeometry_lowestAlignedLBA; // IDENTIFY information DTA_DEVICE_TYPE devType; uint8_t serialNum[20]; diff --git a/Common/log.h b/Common/log.h index 2b718ade..8c08c40f 100644 --- a/Common/log.h +++ b/Common/log.h @@ -341,7 +341,6 @@ inline std::string NowTime() { #else -#include #include inline std::string NowTime() { diff --git a/Common/sedutil.cpp b/Common/sedutil.cpp index fe6df19a..270709e9 100644 --- a/Common/sedutil.cpp +++ b/Common/sedutil.cpp @@ -25,6 +25,10 @@ along with sedutil. If not, see . #include "DtaDevGeneric.h" #include "DtaDevOpal1.h" #include "DtaDevOpal2.h" +#include "DtaDevOpalite.h" +#include "DtaDevPyrite1.h" +#include "DtaDevPyrite2.h" +#include "DtaDevRuby1.h" #include "DtaDevEnterprise.h" using namespace std; @@ -39,10 +43,12 @@ int isValidSEDDisk(char *devname) if (d->isPresent()) { printf("%s", devname); if (d->isAnySSC()) - printf(" SED %s%s%s ", (d->isOpal1() ? "1" : "-"), - (d->isOpal2() ? "2" : "-"), (d->isEprise() ? "E" : "-")); + printf(" SED %s%s%s%s%s%s%s ", (d->isOpal1() ? "1" : "-"), + (d->isOpal2() ? "2" : "-"), (d->isEprise() ? "E" : "-"), + (d->isOpalite() ? "L" : "-"), (d->isPyrite1() ? "p" : "-"), + (d->isPyrite2() ? "P" : "-"), (d->isRuby1() ? "r" : "-")); else - printf("%s", " NO --- "); + printf("%s", " NO ------- "); cout << d->getModelNum() << " " << d->getFirmwareRev(); cout << std::endl; } @@ -72,8 +78,16 @@ int main(int argc, char * argv[]) delete tempDev; return DTAERROR_COMMAND_ERROR; } - if (tempDev->isOpal2()) + if (tempDev->isRuby1()) + d = new DtaDevRuby1(argv[opts.device]); + else if (tempDev->isOpal2()) d = new DtaDevOpal2(argv[opts.device]); + else if (tempDev->isOpalite()) + d = new DtaDevOpalite(argv[opts.device]); + else if (tempDev->isPyrite1()) + d = new DtaDevPyrite1(argv[opts.device]); + else if (tempDev->isPyrite2()) + d = new DtaDevPyrite2(argv[opts.device]); else if (tempDev->isOpal1()) d = new DtaDevOpal1(argv[opts.device]); @@ -110,7 +124,7 @@ int main(int argc, char * argv[]) return d->setSIDPassword(argv[opts.password], argv[opts.newpassword]); break; case sedutiloption::setAdmin1Pwd: - LOG(D) << "Performing setPAdmin1Pwd "; + LOG(D) << "Performing setAdmin1Pwd "; return d->setPassword(argv[opts.password], (char *) "Admin1", argv[opts.newpassword]); break; @@ -137,7 +151,7 @@ int main(int argc, char * argv[]) argv[opts.password])); break; case sedutiloption::readonlyLockingRange: - LOG(D) << "Enabling Locking Range " << (uint16_t)opts.lockingrange; + LOG(D) << "Enabling Locking Range " << (uint16_t)opts.lockingrange << " read-only"; return (d->configureLockingRange(opts.lockingrange, DTA_WRITELOCKINGENABLED, argv[opts.password])); break; diff --git a/LinuxPBA/UnlockSEDs.cpp b/LinuxPBA/UnlockSEDs.cpp index 5daa2b9e..4f42e577 100644 --- a/LinuxPBA/UnlockSEDs.cpp +++ b/LinuxPBA/UnlockSEDs.cpp @@ -22,6 +22,10 @@ along with sedutil. If not, see . #include "DtaDevGeneric.h" #include "DtaDevOpal1.h" #include "DtaDevOpal2.h" +#include "DtaDevOpalite.h" +#include "DtaDevPyrite1.h" +#include "DtaDevPyrite2.h" +#include "DtaDevRuby1.h" #include #include @@ -62,14 +66,24 @@ uint8_t UnlockSEDs(char * password) { if (!tempDev->isPresent()) { break; } - if ((!tempDev->isOpal1()) && (!tempDev->isOpal2())) { + if ((!tempDev->isOpal1()) && (!tempDev->isOpal2()) && + (!tempDev->isOpalite()) && (!tempDev->isPyrite1()) && + (!tempDev->isPyrite2()) && (!tempDev->isRuby1())) { printf("Drive %-10s %-40s not OPAL \n", devref, tempDev->getModelNum()); delete tempDev; continue; } - if (tempDev->isOpal2()) + if (tempDev->isRuby1()) + d = new DtaDevRuby1(devref); + else if (tempDev->isOpal2()) d = new DtaDevOpal2(devref); + else if (tempDev->isOpalite()) + d = new DtaDevOpalite(devref); + else if (tempDev->isPyrite2()) + d = new DtaDevPyrite2(devref); + else if (tempDev->isPyrite1()) + d = new DtaDevPyrite1(devref); else d = new DtaDevOpal1(devref); delete tempDev; diff --git a/LinuxPBA/nbproject/Makefile-Debug.mk b/LinuxPBA/nbproject/Makefile-Debug.mk index 1f037414..cbb48ab5 100644 --- a/LinuxPBA/nbproject/Makefile-Debug.mk +++ b/LinuxPBA/nbproject/Makefile-Debug.mk @@ -41,6 +41,10 @@ OBJECTFILES= \ ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpal.o \ ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpal1.o \ ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpal2.o \ + ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpalite.o \ + ${OBJECTDIR}/_ext/7daaf93a/DtaDevPyrite1.o \ + ${OBJECTDIR}/_ext/7daaf93a/DtaDevPyrite2.o \ + ${OBJECTDIR}/_ext/7daaf93a/DtaDevRuby1.o \ ${OBJECTDIR}/_ext/7daaf93a/DtaHashPwd.o \ ${OBJECTDIR}/_ext/7daaf93a/DtaHexDump.o \ ${OBJECTDIR}/_ext/7daaf93a/DtaResponse.o \ @@ -112,6 +116,26 @@ ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpal2.o: ../Common/DtaDevOpal2.cpp ${RM} "$@.d" $(COMPILE.cc) -g -Werror -I../linux -I../Common -I../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpal2.o ../Common/DtaDevOpal2.cpp +${OBJECTDIR}/_ext/7daaf93a/DtaDevOpalite.o: ../Common/DtaDevOpalite.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7daaf93a + ${RM} "$@.d" + $(COMPILE.cc) -g -Werror -I../linux -I../Common -I../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpalite.o ../Common/DtaDevOpalite.cpp + +${OBJECTDIR}/_ext/7daaf93a/DtaDevPyrite1.o: ../Common/DtaDevPyrite1.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7daaf93a + ${RM} "$@.d" + $(COMPILE.cc) -g -Werror -I../linux -I../Common -I../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7daaf93a/DtaDevPyrite1.o ../Common/DtaDevPyrite1.cpp + +${OBJECTDIR}/_ext/7daaf93a/DtaDevPyrite2.o: ../Common/DtaDevPyrite2.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7daaf93a + ${RM} "$@.d" + $(COMPILE.cc) -g -Werror -I../linux -I../Common -I../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7daaf93a/DtaDevPyrite2.o ../Common/DtaDevPyrite2.cpp + +${OBJECTDIR}/_ext/7daaf93a/DtaDevRuby1.o: ../Common/DtaDevRuby1.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7daaf93a + ${RM} "$@.d" + $(COMPILE.cc) -g -Werror -I../linux -I../Common -I../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7daaf93a/DtaDevRuby1.o ../Common/DtaDevRuby1.cpp + ${OBJECTDIR}/_ext/7daaf93a/DtaHashPwd.o: ../Common/DtaHashPwd.cpp ${MKDIR} -p ${OBJECTDIR}/_ext/7daaf93a ${RM} "$@.d" diff --git a/LinuxPBA/nbproject/Makefile-Debug_x86_64.mk b/LinuxPBA/nbproject/Makefile-Debug_x86_64.mk index e03f2708..f17c77e4 100644 --- a/LinuxPBA/nbproject/Makefile-Debug_x86_64.mk +++ b/LinuxPBA/nbproject/Makefile-Debug_x86_64.mk @@ -41,6 +41,10 @@ OBJECTFILES= \ ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpal.o \ ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpal1.o \ ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpal2.o \ + ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpalite.o \ + ${OBJECTDIR}/_ext/7daaf93a/DtaDevPyrite1.o \ + ${OBJECTDIR}/_ext/7daaf93a/DtaDevPyrite2.o \ + ${OBJECTDIR}/_ext/7daaf93a/DtaDevRuby1.o \ ${OBJECTDIR}/_ext/7daaf93a/DtaHashPwd.o \ ${OBJECTDIR}/_ext/7daaf93a/DtaHexDump.o \ ${OBJECTDIR}/_ext/7daaf93a/DtaResponse.o \ @@ -112,6 +116,26 @@ ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpal2.o: ../Common/DtaDevOpal2.cpp ${RM} "$@.d" $(COMPILE.cc) -g -Werror -I../linux -I../Common -I../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpal2.o ../Common/DtaDevOpal2.cpp +${OBJECTDIR}/_ext/7daaf93a/DtaDevOpalite.o: ../Common/DtaDevOpalite.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7daaf93a + ${RM} "$@.d" + $(COMPILE.cc) -g -Werror -I../linux -I../Common -I../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpalite.o ../Common/DtaDevOpalite.cpp + +${OBJECTDIR}/_ext/7daaf93a/DtaDevPyrite1.o: ../Common/DtaDevPyrite1.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7daaf93a + ${RM} "$@.d" + $(COMPILE.cc) -g -Werror -I../linux -I../Common -I../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7daaf93a/DtaDevPyrite1.o ../Common/DtaDevPyrite1.cpp + +${OBJECTDIR}/_ext/7daaf93a/DtaDevPyrite2.o: ../Common/DtaDevPyrite2.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7daaf93a + ${RM} "$@.d" + $(COMPILE.cc) -g -Werror -I../linux -I../Common -I../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7daaf93a/DtaDevPyrite2.o ../Common/DtaDevPyrite2.cpp + +${OBJECTDIR}/_ext/7daaf93a/DtaDevRuby1.o: ../Common/DtaDevRuby1.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7daaf93a + ${RM} "$@.d" + $(COMPILE.cc) -g -Werror -I../linux -I../Common -I../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7daaf93a/DtaDevRuby1.o ../Common/DtaDevRuby1.cpp + ${OBJECTDIR}/_ext/7daaf93a/DtaHashPwd.o: ../Common/DtaHashPwd.cpp ${MKDIR} -p ${OBJECTDIR}/_ext/7daaf93a ${RM} "$@.d" diff --git a/LinuxPBA/nbproject/Makefile-Release.mk b/LinuxPBA/nbproject/Makefile-Release.mk index 0835c376..a8ffd152 100644 --- a/LinuxPBA/nbproject/Makefile-Release.mk +++ b/LinuxPBA/nbproject/Makefile-Release.mk @@ -41,6 +41,10 @@ OBJECTFILES= \ ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpal.o \ ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpal1.o \ ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpal2.o \ + ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpalite.o \ + ${OBJECTDIR}/_ext/7daaf93a/DtaDevPyrite1.o \ + ${OBJECTDIR}/_ext/7daaf93a/DtaDevPyrite2.o \ + ${OBJECTDIR}/_ext/7daaf93a/DtaDevRuby1.o \ ${OBJECTDIR}/_ext/7daaf93a/DtaHashPwd.o \ ${OBJECTDIR}/_ext/7daaf93a/DtaHexDump.o \ ${OBJECTDIR}/_ext/7daaf93a/DtaResponse.o \ @@ -112,6 +116,26 @@ ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpal2.o: ../Common/DtaDevOpal2.cpp ${RM} "$@.d" $(COMPILE.cc) -O2 -Werror -I../linux -I../Common -I../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpal2.o ../Common/DtaDevOpal2.cpp +${OBJECTDIR}/_ext/7daaf93a/DtaDevOpalite.o: ../Common/DtaDevOpalite.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7daaf93a + ${RM} "$@.d" + $(COMPILE.cc) -O2 -Werror -I../linux -I../Common -I../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpalite.o ../Common/DtaDevOpalite.cpp + +${OBJECTDIR}/_ext/7daaf93a/DtaDevPyrite1.o: ../Common/DtaDevPyrite1.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7daaf93a + ${RM} "$@.d" + $(COMPILE.cc) -O2 -Werror -I../linux -I../Common -I../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7daaf93a/DtaDevPyrite1.o ../Common/DtaDevPyrite1.cpp + +${OBJECTDIR}/_ext/7daaf93a/DtaDevPyrite2.o: ../Common/DtaDevPyrite2.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7daaf93a + ${RM} "$@.d" + $(COMPILE.cc) -O2 -Werror -I../linux -I../Common -I../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7daaf93a/DtaDevPyrite2.o ../Common/DtaDevPyrite2.cpp + +${OBJECTDIR}/_ext/7daaf93a/DtaDevRuby1.o: ../Common/DtaDevRuby1.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7daaf93a + ${RM} "$@.d" + $(COMPILE.cc) -O2 -Werror -I../linux -I../Common -I../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7daaf93a/DtaDevRuby1.o ../Common/DtaDevRuby1.cpp + ${OBJECTDIR}/_ext/7daaf93a/DtaHashPwd.o: ../Common/DtaHashPwd.cpp ${MKDIR} -p ${OBJECTDIR}/_ext/7daaf93a ${RM} "$@.d" diff --git a/LinuxPBA/nbproject/Makefile-Release_x86_64.mk b/LinuxPBA/nbproject/Makefile-Release_x86_64.mk index 8f253de7..846ecbf8 100644 --- a/LinuxPBA/nbproject/Makefile-Release_x86_64.mk +++ b/LinuxPBA/nbproject/Makefile-Release_x86_64.mk @@ -41,6 +41,10 @@ OBJECTFILES= \ ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpal.o \ ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpal1.o \ ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpal2.o \ + ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpalite.o \ + ${OBJECTDIR}/_ext/7daaf93a/DtaDevPyrite1.o \ + ${OBJECTDIR}/_ext/7daaf93a/DtaDevPyrite2.o \ + ${OBJECTDIR}/_ext/7daaf93a/DtaDevRuby1.o \ ${OBJECTDIR}/_ext/7daaf93a/DtaHashPwd.o \ ${OBJECTDIR}/_ext/7daaf93a/DtaHexDump.o \ ${OBJECTDIR}/_ext/7daaf93a/DtaResponse.o \ @@ -112,6 +116,26 @@ ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpal2.o: ../Common/DtaDevOpal2.cpp ${RM} "$@.d" $(COMPILE.cc) -O2 -Werror -I../linux -I../Common -I../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpal2.o ../Common/DtaDevOpal2.cpp +${OBJECTDIR}/_ext/7daaf93a/DtaDevOpalite.o: ../Common/DtaDevOpalite.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7daaf93a + ${RM} "$@.d" + $(COMPILE.cc) -O2 -Werror -I../linux -I../Common -I../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7daaf93a/DtaDevOpalite.o ../Common/DtaDevOpalite.cpp + +${OBJECTDIR}/_ext/7daaf93a/DtaDevPyrite1.o: ../Common/DtaDevPyrite1.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7daaf93a + ${RM} "$@.d" + $(COMPILE.cc) -O2 -Werror -I../linux -I../Common -I../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7daaf93a/DtaDevPyrite1.o ../Common/DtaDevPyrite1.cpp + +${OBJECTDIR}/_ext/7daaf93a/DtaDevPyrite2.o: ../Common/DtaDevPyrite2.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7daaf93a + ${RM} "$@.d" + $(COMPILE.cc) -O2 -Werror -I../linux -I../Common -I../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7daaf93a/DtaDevPyrite2.o ../Common/DtaDevPyrite2.cpp + +${OBJECTDIR}/_ext/7daaf93a/DtaDevRuby1.o: ../Common/DtaDevRuby1.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7daaf93a + ${RM} "$@.d" + $(COMPILE.cc) -O2 -Werror -I../linux -I../Common -I../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7daaf93a/DtaDevRuby1.o ../Common/DtaDevRuby1.cpp + ${OBJECTDIR}/_ext/7daaf93a/DtaHashPwd.o: ../Common/DtaHashPwd.cpp ${MKDIR} -p ${OBJECTDIR}/_ext/7daaf93a ${RM} "$@.d" diff --git a/LinuxPBA/nbproject/configurations.xml b/LinuxPBA/nbproject/configurations.xml index 3bd6e58d..4f6ac5b8 100644 --- a/LinuxPBA/nbproject/configurations.xml +++ b/LinuxPBA/nbproject/configurations.xml @@ -30,6 +30,10 @@ ../Common/DtaDevOpal.cpp ../Common/DtaDevOpal1.cpp ../Common/DtaDevOpal2.cpp + ../Common/DtaDevOpalite.cpp + ../Common/DtaDevPyrite1.cpp + ../Common/DtaDevPyrite2.cpp + ../Common/DtaDevRuby1.cpp ../Common/DtaHashPwd.cpp ../Common/DtaHexDump.cpp ../Common/DtaResponse.cpp @@ -97,6 +101,14 @@ + + + + + + + + @@ -182,6 +194,14 @@ + + + + + + + + @@ -270,6 +290,14 @@ + + + + + + + + @@ -347,6 +375,14 @@ + + + + + + + + diff --git a/Makefile.am b/Makefile.am index 5d105b0d..a8e59d2d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,6 +9,10 @@ SEDUTIL_COMMON_CODE = \ Common/DtaDevGeneric.cpp Common/DtaDevGeneric.h \ Common/DtaDevOpal1.cpp Common/DtaDevOpal1.h \ Common/DtaDevOpal2.cpp Common/DtaDevOpal2.h \ + Common/DtaDevOpalite.cpp Common/DtaDevOpalite.h \ + Common/DtaDevPyrite1.cpp Common/DtaDevPyrite1.h \ + Common/DtaDevPyrite2.cpp Common/DtaDevPyrite2.h \ + Common/DtaDevRuby1.cpp Common/DtaDevRuby1.h \ Common/DtaDevOpal.cpp Common/DtaDevOpal.h \ Common/DtaDiskType.cpp Common/DtaDiskType.h \ Common/DtaHashPwd.cpp Common/DtaHashPwd.h \ diff --git a/README.md b/README.md index 3bb7d645..9c3113eb 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ sedutil - The Drive Trust Alliance Self Encrypting Drive Utility This program and it's accompanying Pre-Boot Authorization image allow you to enable the locking in SED's that comply with the TCG OPAL 2.00 -standard on bios machines. +standard, Opalite, Pyrite, and Ruby. You must be administrator/root to run the host managment program @@ -43,7 +43,7 @@ Linux and Windows executables and Linux PBA bootloader images for this version o DTA sedutil: For AMD Ryzen Systems -The sedutil project provides a CLI tool (`sedutil-cli`) capable of setting up and managing self encrypting drives (SEDs) that comply with the TCG OPAL 2.00 standard. This project also provides a pre-boot authentication image (`linuxpba`) which can be loaded onto an encrypted disk's shadow MBR. This pre-boot authentication image allows the user enter their password and unlock SED drives during the boot process. **Using this tool can make data on the drive inaccessible!** +The sedutil project provides a CLI tool (`sedutil-cli`) capable of setting up and managing self encrypting drives (SEDs) that comply with the TCG OPAL 2.00 standard, Opalite, Pyrite, and Ruby. This project also provides a pre-boot authentication image (`linuxpba`) which can be loaded onto an encrypted disk's shadow MBR. This pre-boot authentication image allows the user enter their password and unlock SED drives during the boot process. **Using this tool can make data on the drive inaccessible!** ## Setup @@ -72,7 +72,7 @@ Building is supported on Ubuntu 18.04.3 (LTS) x64. Other versions will probably To compile your own version of `sedutil` you will need the standard development tools, an internet connection, and ~10 GB of disk space. -Prerequisites: +### Prerequisites: ``` sudo apt-get update && sudo apt-get upgrade -y @@ -81,13 +81,13 @@ sudo apt-get install build-essential autoconf pkg-config libc6-dev make g++-mult ``` -Automatically Build Everything: +### Automatically Build Everything: ``` git clone https://github.com/ChubbyAnt/sedutil && cd sedutil && autoreconf --install && ./configure && make all && cd images && ./getresources && ./buildpbaroot && ./buildbios && ./buildUEFI64 && ./buildrescue Rescue32 && ./buildrescue Rescue64 && cd .. ``` -Build Everything Manually Step by Step: +### Build Everything Manually Step by Step: ``` git clone https://github.com/ChubbyAnt/sedutil @@ -120,9 +120,9 @@ https://github.com/Drive-Trust-Alliance/sedutil/wiki/Encrypting-your-drive Both the PBA and rescue systems use the us_english keyboard. This can cause issues when setting the password on your normal operating system if you use another keyboard mapping. To make sure the PBA recognizes your password you are encouraged to set up you drive from the rescue system as described on this page. -# Prepare a bootable rescue system +## Prepare a bootable rescue system -These are the instructions for modern UEFI NVME equipped systems using SEDutil OPAL locking and unlocking utility as a windows pre-boot bootloader: +These are the instructions for modern UEFI NVME equipped systems using SEDutil OPAL, Opalite, Pyrite, and Ruby locking and unlocking utility as a windows pre-boot bootloader: Download the rescue system for 64bit UEFI @@ -135,7 +135,7 @@ Note: Earlier versions of SEDutil also required BIOS enable of "legacy boot" or Boot the USB thumb drive with the rescue system on it. You will see the Login prompt, enter "root" there is no password so you will get a root shell prompt. -enter the command ```sedutil-cli --scan``` +Enter the command ```sedutil-cli --scan``` Expected Output: ``` @@ -151,7 +151,7 @@ No more disks present ending scan Verify that your drive has a 2 in the second column indicating OPAL 2 support. If it doesn't do not proceed, there is something that is preventing sedutil from supporting your drive. If you continue you may erase all of your data. -# Test the PBA +### Test the PBA Enter the command ```linuxpba``` and use a pass-phrase of ```debug```. If you don't use debug as the pass-phrase your system will reboot! Expected Output: @@ -177,7 +177,7 @@ Issuing the commands in the steps that follow will enable OPAL locking. If you h The following steps use /dev/nvme0 as the device and UEFI64-1.15.img.gz for the PBA image, substitute the proper /dev/nvme? for your drive and the proper PBA name for your system -#Enable Locking and the PBA +###Enable Locking and the PBA Enter the commands below: (Use the password of debug for this test, it will be changed later) ``` @@ -214,7 +214,7 @@ Expected Output: # ``` -# Test the PBA (yes again) +### Test the PBA (yes again) Enter the command ```linuxpba``` and use a pass-phrase of debug @@ -265,16 +265,16 @@ Expected Output: - 14:22:21.590 INFO: MBRDone set on ``` -#Your drive in now using OPAL locking. +**Your drive is now using OPAL locking.** You now need to COMPLETELY POWER DOWN YOUR SYSTEM This will lock the drive so that when you restart your system it will boot the PBA. -#Recovery information: +##Recovery information: If there is an issue after enabling locking you can either disable locking or remove OPAL to continue using your drive without locking. -If you want to disable Locking and the PBA: +**If you want to disable Locking and the PBA:** ``` sedutil-cli -–disableLockingRange 0 @@ -307,7 +307,7 @@ Expected Output: Some OPAL drives have a firmware bug that will erase all of your data if you issue the commands below. See [Remove OPAL](https://github.com/Drive-Trust-Alliance/sedutil/wiki/Remove-OPAL) for a list of drive/firmware pairs that is know to have been tested. -#To remove OPAL issue these commands: +##To remove OPAL issue these commands: ``` sedutil-cli --revertnoerase diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 00000000..56097bfa --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +sedutil (1.12-0) unstable; urgency=medium + + * Initial release + + -- Waqar Ahmed Tue, 19 Nov 2020 16:16:44 +0500 diff --git a/debian/control b/debian/control new file mode 100644 index 00000000..72b91f53 --- /dev/null +++ b/debian/control @@ -0,0 +1,18 @@ +Source: sedutil +Section: admin +Priority: optional +Maintainer: Waqar Ahmed +Build-Depends: build-essential, + make, + debhelper-compat (= 12), + gcc-multilib, + g++-multilib +Standards-Version: 4.4.0 +Homepage: https://github.com/Drive-Trust-Alliance/sedutil + +Package: sedutil +Architecture: any +Depends: ${misc:Depends}, ${shlibs:Depends} +Description: The Drive Trust Alliance Self Encrypting Drive Utility + This program allows you to enable the locking in SED's that comply + with the TCG OPAL 2.00 standard on bios machines. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 00000000..20cf9344 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,69 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ + +Files: * +Copyright: 2014-2017, Bright Plaza Inc +License: UnknownCopyrighted + +Files: Common/* +Copyright: 2014-2017, Bright Plaza Inc + 2007, Free Software Foundation, Inc. + 2017, Spectra Logic Corporation +License: GPL-3+ + +Files: LinuxPBA/GetPassPhrase.cpp + LinuxPBA/GetPassPhrase.h + LinuxPBA/LinuxPBA.cpp + LinuxPBA/UnlockSEDs.cpp + LinuxPBA/UnlockSEDs.h + README.md + freebsd/DtaDevFreeBSDCAM.cpp + freebsd/DtaDevFreeBSDCAM.h + freebsd/DtaDevFreeBSDDrive.h + freebsd/DtaDevFreeBSDNvme.cpp + freebsd/DtaDevFreeBSDNvme.h + freebsd/DtaDevOS.cpp + freebsd/DtaDevOS.h + freebsd/os.h + linux/DtaDevLinuxDrive.h + linux/DtaDevLinuxNvme.cpp + linux/DtaDevLinuxNvme.h + linux/DtaDevLinuxSata.cpp + linux/DtaDevLinuxSata.h + linux/DtaDevOS.cpp + linux/DtaDevOS.h + linux/os.h + windows/DtaDevOS.cpp + windows/DtaDevOS.h + windows/DtaDiskATA.cpp + windows/DtaDiskATA.h + windows/DtaDiskNVMe.cpp + windows/DtaDiskNVMe.h + windows/DtaDiskUSB.cpp + windows/DtaDiskUSB.h + windows/ReadMe_Windows.txt +Copyright: 2016-2018, Alexander Motin + 2014-2017, Bright Plaza Inc +License: GPL-3+ + +Files: Common/pbkdf2/* +License: CC0 + +Files: Common/pbkdf2/COPYING + Common/pbkdf2/handy.h +License: GPL-3+ +Comment: No explicit license found, using license(s) from: + Common/LICENSE.txt + +Files: Common/log.h +Copyright: 2007, Petru Marginean + laws, the author or authors +License: Unlicense + +Files: debian/* +License: GPL-3+ + +License: CC0 + +License: GPL-3+ + +License: Unlicense diff --git a/debian/rules b/debian/rules new file mode 100644 index 00000000..ce1f60df --- /dev/null +++ b/debian/rules @@ -0,0 +1,25 @@ +#!/usr/bin/make -f +export DH_VERBOSE = 1 + +%: + dh $@ + +override_dh_auto_build: + sh -c "\ + cd linux/CLI || exit 1; \ + gmake || exit 1; \ + " + +override_dh_auto_install: + sh -c "\ + mkdir -p debian/sedutil/usr/local/bin; \ + cp -a linux/CLI/dist/Debug_i686/GNU-Linux/sedutil-cli debian/sedutil/usr/local/bin/; \ + " + +override_dh_shlibdeps: + +override_dh_usrlocal: + +override_dh_auto_clean: + +override_dh_auto_test: diff --git a/debian/sedutil.manpages b/debian/sedutil.manpages new file mode 100644 index 00000000..f3be157d --- /dev/null +++ b/debian/sedutil.manpages @@ -0,0 +1 @@ +docs/sedutil-cli.8 diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 00000000..163aaf8d --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides new file mode 100644 index 00000000..463abe97 --- /dev/null +++ b/debian/source/lintian-overrides @@ -0,0 +1 @@ +source-is-missing diff --git a/docs/sedutil-cli.8 b/docs/sedutil-cli.8 index 06554b38..f977abea 100644 --- a/docs/sedutil-cli.8 +++ b/docs/sedutil-cli.8 @@ -1,14 +1,15 @@ .\" Manpage for sedutil-cli. .TH SEDUTIL\-CLI 8 "18 Feb 2016" "0.12" "sedutil-cli man page" .SH NAME -sedutil-cli \- util to manage TCG Opal 2.0 self encrypting drives +sedutil-cli \- util to manage TCG Storage self encrypting drives .SH SYNOPSIS sedutil\-cli <\-v> <\-n> .SH DESCRIPTION sedutil-cli is a utility to manage self encrypting drives that conform -to the Trusted Computing Group (TCG) OPAL 2.0 SSC specification. +to the Trusted Computing Group (TCG) Enterprise, Opal, Opalite and +Pyrite SSC specifications. In Linux libata.allow_tpm must be set to 1. Either via adding libata.allow_tpm=1 to the kernel flags at boot time or changing the @@ -63,9 +64,14 @@ set the device back to factory defaults. .B This **ERASES ALL DATA** .IP "\-\-revertNoErase " deactivate the Locking SP without erasing the data on GLOBAL RANGE *ONLY* -.IP "\-\---yesIreallywanttoERASEALLmydatausingthePSID " +.IP "\-\-PSIDrevert " +.IP "\-\-yesIreallywanttoERASEALLmydatausingthePSID " revert the device using the PSID. .B *ERASING* *ALL* the data +.IP "\-\-PSIDrevertAdminSP " +Alike to PSIDrevert, but on Enterprise calls AdminSP->Revert instead of +ThisSP->RevertSP. There are no PSID or Revert standards for Enterprise +and different devices support different methods. .IP "\-\-printDefaultPassword " print MSID @@ -77,7 +83,7 @@ sedutil-cli --scan sedutil-cli --query /dev/sdc .EE .EX -sedutil-cli --yesIreallywanttoERASEALLmydatausingthePSID /dev/sdc +sedutil-cli --yesIreallywanttoERASEALLmydatausingthePSID /dev/sdc .EE .EX sedutil-cli --initialSetup /dev/sdc diff --git a/freebsd/CLI/.dep.inc b/freebsd/CLI/.dep.inc new file mode 100644 index 00000000..38ba445c --- /dev/null +++ b/freebsd/CLI/.dep.inc @@ -0,0 +1,5 @@ +# This code depends on make tool being used +DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES} ${TESTOBJECTFILES})) +ifneq (${DEPFILES},) +include ${DEPFILES} +endif diff --git a/freebsd/CLI/Makefile b/freebsd/CLI/Makefile new file mode 100644 index 00000000..8008a2a8 --- /dev/null +++ b/freebsd/CLI/Makefile @@ -0,0 +1,128 @@ +# +# There exist several targets which are by default empty and which can be +# used for execution of your targets. These targets are usually executed +# before and after some main targets. They are: +# +# .build-pre: called before 'build' target +# .build-post: called after 'build' target +# .clean-pre: called before 'clean' target +# .clean-post: called after 'clean' target +# .clobber-pre: called before 'clobber' target +# .clobber-post: called after 'clobber' target +# .all-pre: called before 'all' target +# .all-post: called after 'all' target +# .help-pre: called before 'help' target +# .help-post: called after 'help' target +# +# Targets beginning with '.' are not intended to be called on their own. +# +# Main targets can be executed directly, and they are: +# +# build build a specific configuration +# clean remove built files from a configuration +# clobber remove all built files +# all build all configurations +# help print help mesage +# +# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and +# .help-impl are implemented in nbproject/makefile-impl.mk. +# +# Available make variables: +# +# CND_BASEDIR base directory for relative paths +# CND_DISTDIR default top distribution directory (build artifacts) +# CND_BUILDDIR default top build directory (object files, ...) +# CONF name of current configuration +# CND_PLATFORM_${CONF} platform name (current configuration) +# CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration) +# CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration) +# CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration) +# CND_PACKAGE_DIR_${CONF} directory of package (current configuration) +# CND_PACKAGE_NAME_${CONF} name of package (current configuration) +# CND_PACKAGE_PATH_${CONF} path to package (current configuration) +# +# NOCDDL + + +# Environment +MKDIR=mkdir +CP=cp +CCADMIN=CCadmin + + +# build +build: .build-post + +.build-pre: +# Add your pre 'build' code here... + ../GitVersion.sh > ../Version.h +.build-post: .build-impl +# Add your post 'build' code here... + ${RM} ../Version.h + +# clean +clean: .clean-post + +.clean-pre: +# Add your pre 'clean' code here... + +.clean-post: .clean-impl +# Add your post 'clean' code here... + + +# clobber +clobber: .clobber-post + +.clobber-pre: +# Add your pre 'clobber' code here... + +.clobber-post: .clobber-impl +# Add your post 'clobber' code here... + + +# all +all: .all-post + +.all-pre: +# Add your pre 'all' code here... + +.all-post: .all-impl +# Add your post 'all' code here... + + +# build tests +build-tests: .build-tests-post + +.build-tests-pre: +# Add your pre 'build-tests' code here... + +.build-tests-post: .build-tests-impl +# Add your post 'build-tests' code here... + + +# run tests +test: .test-post + +.test-pre: build-tests +# Add your pre 'test' code here... + +.test-post: .test-impl +# Add your post 'test' code here... + + +# help +help: .help-post + +.help-pre: +# Add your pre 'help' code here... + +.help-post: .help-impl +# Add your post 'help' code here... + + + +# include project implementation makefile +include nbproject/Makefile-impl.mk + +# include project make variables +include nbproject/Makefile-variables.mk diff --git a/freebsd/CLI/nbproject/Makefile-Release.mk b/freebsd/CLI/nbproject/Makefile-Release.mk new file mode 100644 index 00000000..a3eb4e80 --- /dev/null +++ b/freebsd/CLI/nbproject/Makefile-Release.mk @@ -0,0 +1,234 @@ +# +# Generated Makefile - do not edit! +# +# Edit the Makefile in the project folder instead (../Makefile). Each target +# has a -pre and a -post target defined where you can add customized code. +# +# This makefile implements configuration specific macros and targets. + + +# Environment +MKDIR=mkdir +CP=cp +GREP=grep +NM=nm +CCADMIN=CCadmin +RANLIB=ranlib +CC=clang +CCC=clang++ +CXX=clang++ +FC=gfortran +AS=as + +# Macros +CND_PLATFORM=CLang-Generic +CND_DLIB_EXT=so +CND_CONF=Release +CND_DISTDIR=dist +CND_BUILDDIR=build + +# Include project Makefile +include Makefile + +# Object Directory +OBJECTDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM} + +# Object Files +OBJECTFILES= \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaAnnotatedDump.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaCommand.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaDev.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaDevEnterprise.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaDevGeneric.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal1.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal2.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpalite.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite1.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite2.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaDevRuby1.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaHashPwd.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaHexDump.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaOptions.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaResponse.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaSession.o \ + ${OBJECTDIR}/_ext/cdbdd37b/blockwise.o \ + ${OBJECTDIR}/_ext/cdbdd37b/chash.o \ + ${OBJECTDIR}/_ext/cdbdd37b/hmac.o \ + ${OBJECTDIR}/_ext/cdbdd37b/pbkdf2.o \ + ${OBJECTDIR}/_ext/cdbdd37b/sha1.o \ + ${OBJECTDIR}/_ext/7a2a93ab/sedutil.o \ + ${OBJECTDIR}/_ext/5c0/DtaDevFreeBSDCAM.o \ + ${OBJECTDIR}/_ext/5c0/DtaDevFreeBSDNvme.o \ + ${OBJECTDIR}/_ext/5c0/DtaDevOS.o + + +# C Compiler Flags +CFLAGS=-Wall + +# CC Compiler Flags +CCFLAGS=-Wall +CXXFLAGS=-Wall + +# Fortran Compiler Flags +FFLAGS=-Wall + +# Assembler Flags +ASFLAGS= + +# Link Libraries and Options +LDLIBSOPTIONS=-lcam + +# Build Targets +.build-conf: ${BUILD_SUBPROJECTS} + "${MAKE}" -f nbproject/Makefile-${CND_CONF}.mk ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/sedutil-cli + +${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/sedutil-cli: ${OBJECTFILES} + ${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM} + clang++ -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/sedutil-cli ${OBJECTFILES} ${LDLIBSOPTIONS} + +${OBJECTDIR}/_ext/7a2a93ab/DtaAnnotatedDump.o: ../../Common/DtaAnnotatedDump.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaAnnotatedDump.o ../../Common/DtaAnnotatedDump.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaCommand.o: ../../Common/DtaCommand.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaCommand.o ../../Common/DtaCommand.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaDev.o: ../../Common/DtaDev.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDev.o ../../Common/DtaDev.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaDevEnterprise.o: ../../Common/DtaDevEnterprise.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevEnterprise.o ../../Common/DtaDevEnterprise.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaDevGeneric.o: ../../Common/DtaDevGeneric.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevGeneric.o ../../Common/DtaDevGeneric.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal.o: ../../Common/DtaDevOpal.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal.o ../../Common/DtaDevOpal.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal1.o: ../../Common/DtaDevOpal1.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal1.o ../../Common/DtaDevOpal1.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal2.o: ../../Common/DtaDevOpal2.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal2.o ../../Common/DtaDevOpal2.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpalite.o: ../../Common/DtaDevOpalite.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpalite.o ../../Common/DtaDevOpalite.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite1.o: ../../Common/DtaDevPyrite1.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite1.o ../../Common/DtaDevPyrite1.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite2.o: ../../Common/DtaDevPyrite2.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite2.o ../../Common/DtaDevPyrite2.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaDevRuby1.o: ../../Common/DtaDevRuby1.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevRuby1.o ../../Common/DtaDevRuby1.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaHashPwd.o: ../../Common/DtaHashPwd.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaHashPwd.o ../../Common/DtaHashPwd.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaHexDump.o: ../../Common/DtaHexDump.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaHexDump.o ../../Common/DtaHexDump.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaOptions.o: ../../Common/DtaOptions.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaOptions.o ../../Common/DtaOptions.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaResponse.o: ../../Common/DtaResponse.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaResponse.o ../../Common/DtaResponse.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaSession.o: ../../Common/DtaSession.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaSession.o ../../Common/DtaSession.cpp + +${OBJECTDIR}/_ext/cdbdd37b/blockwise.o: ../../Common/pbkdf2/blockwise.c + ${MKDIR} -p ${OBJECTDIR}/_ext/cdbdd37b + ${RM} "$@.d" + $(COMPILE.c) -O2 -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/cdbdd37b/blockwise.o ../../Common/pbkdf2/blockwise.c + +${OBJECTDIR}/_ext/cdbdd37b/chash.o: ../../Common/pbkdf2/chash.c + ${MKDIR} -p ${OBJECTDIR}/_ext/cdbdd37b + ${RM} "$@.d" + $(COMPILE.c) -O2 -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/cdbdd37b/chash.o ../../Common/pbkdf2/chash.c + +${OBJECTDIR}/_ext/cdbdd37b/hmac.o: ../../Common/pbkdf2/hmac.c + ${MKDIR} -p ${OBJECTDIR}/_ext/cdbdd37b + ${RM} "$@.d" + $(COMPILE.c) -O2 -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/cdbdd37b/hmac.o ../../Common/pbkdf2/hmac.c + +${OBJECTDIR}/_ext/cdbdd37b/pbkdf2.o: ../../Common/pbkdf2/pbkdf2.c + ${MKDIR} -p ${OBJECTDIR}/_ext/cdbdd37b + ${RM} "$@.d" + $(COMPILE.c) -O2 -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/cdbdd37b/pbkdf2.o ../../Common/pbkdf2/pbkdf2.c + +${OBJECTDIR}/_ext/cdbdd37b/sha1.o: ../../Common/pbkdf2/sha1.c + ${MKDIR} -p ${OBJECTDIR}/_ext/cdbdd37b + ${RM} "$@.d" + $(COMPILE.c) -O2 -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/cdbdd37b/sha1.o ../../Common/pbkdf2/sha1.c + +${OBJECTDIR}/_ext/7a2a93ab/sedutil.o: ../../Common/sedutil.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/sedutil.o ../../Common/sedutil.cpp + +${OBJECTDIR}/_ext/5c0/DtaDevFreeBSDCAM.o: ../DtaDevFreeBSDCAM.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/5c0 + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/5c0/DtaDevFreeBSDCAM.o ../DtaDevFreeBSDCAM.cpp + +${OBJECTDIR}/_ext/5c0/DtaDevFreeBSDNvme.o: ../DtaDevFreeBSDNvme.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/5c0 + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/5c0/DtaDevFreeBSDNvme.o ../DtaDevFreeBSDNvme.cpp + +${OBJECTDIR}/_ext/5c0/DtaDevOS.o: ../DtaDevOS.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/5c0 + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/5c0/DtaDevOS.o ../DtaDevOS.cpp + +# Subprojects +.build-subprojects: + +# Clean Targets +.clean-conf: ${CLEAN_SUBPROJECTS} + ${RM} -r ${CND_BUILDDIR}/${CND_CONF} + ${RM} ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/sedutil-cli + +# Subprojects +.clean-subprojects: + +# Enable dependency checking +.dep.inc: .depcheck-impl + +include .dep.inc diff --git a/freebsd/CLI/nbproject/Makefile-impl.mk b/freebsd/CLI/nbproject/Makefile-impl.mk new file mode 100644 index 00000000..310b82b4 --- /dev/null +++ b/freebsd/CLI/nbproject/Makefile-impl.mk @@ -0,0 +1,133 @@ +# +# Generated Makefile - do not edit! +# +# Edit the Makefile in the project folder instead (../Makefile). Each target +# has a pre- and a post- target defined where you can add customization code. +# +# This makefile implements macros and targets common to all configurations. +# +# NOCDDL + + +# Building and Cleaning subprojects are done by default, but can be controlled with the SUB +# macro. If SUB=no, subprojects will not be built or cleaned. The following macro +# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf +# and .clean-reqprojects-conf unless SUB has the value 'no' +SUB_no=NO +SUBPROJECTS=${SUB_${SUB}} +BUILD_SUBPROJECTS_=.build-subprojects +BUILD_SUBPROJECTS_NO= +BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}} +CLEAN_SUBPROJECTS_=.clean-subprojects +CLEAN_SUBPROJECTS_NO= +CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}} + + +# Project Name +PROJECTNAME=CLI + +# Active Configuration +DEFAULTCONF=Release +CONF=${DEFAULTCONF} + +# All Configurations +ALLCONFS=Release + + +# build +.build-impl: .build-pre .validate-impl .depcheck-impl + @#echo "=> Running $@... Configuration=$(CONF)" + "${MAKE}" -f nbproject/Makefile-${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .build-conf + + +# clean +.clean-impl: .clean-pre .validate-impl .depcheck-impl + @#echo "=> Running $@... Configuration=$(CONF)" + "${MAKE}" -f nbproject/Makefile-${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .clean-conf + + +# clobber +.clobber-impl: .clobber-pre .depcheck-impl + @#echo "=> Running $@..." + for CONF in ${ALLCONFS}; \ + do \ + "${MAKE}" -f nbproject/Makefile-$${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .clean-conf; \ + done + +# all +.all-impl: .all-pre .depcheck-impl + @#echo "=> Running $@..." + for CONF in ${ALLCONFS}; \ + do \ + "${MAKE}" -f nbproject/Makefile-$${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .build-conf; \ + done + +# build tests +.build-tests-impl: .build-impl .build-tests-pre + @#echo "=> Running $@... Configuration=$(CONF)" + "${MAKE}" -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-tests-conf + +# run tests +.test-impl: .build-tests-impl .test-pre + @#echo "=> Running $@... Configuration=$(CONF)" + "${MAKE}" -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .test-conf + +# dependency checking support +.depcheck-impl: + @echo "# This code depends on make tool being used" >.dep.inc + @if [ -n "${MAKE_VERSION}" ]; then \ + echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES} \$${TESTOBJECTFILES}))" >>.dep.inc; \ + echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \ + echo "include \$${DEPFILES}" >>.dep.inc; \ + echo "endif" >>.dep.inc; \ + else \ + echo ".KEEP_STATE:" >>.dep.inc; \ + echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \ + fi + +# configuration validation +.validate-impl: + @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \ + then \ + echo ""; \ + echo "Error: can not find the makefile for configuration '${CONF}' in project ${PROJECTNAME}"; \ + echo "See 'make help' for details."; \ + echo "Current directory: " `pwd`; \ + echo ""; \ + fi + @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \ + then \ + exit 1; \ + fi + + +# help +.help-impl: .help-pre + @echo "This makefile supports the following configurations:" + @echo " ${ALLCONFS}" + @echo "" + @echo "and the following targets:" + @echo " build (default target)" + @echo " clean" + @echo " clobber" + @echo " all" + @echo " help" + @echo "" + @echo "Makefile Usage:" + @echo " make [CONF=] [SUB=no] build" + @echo " make [CONF=] [SUB=no] clean" + @echo " make [SUB=no] clobber" + @echo " make [SUB=no] all" + @echo " make help" + @echo "" + @echo "Target 'build' will build a specific configuration and, unless 'SUB=no'," + @echo " also build subprojects." + @echo "Target 'clean' will clean a specific configuration and, unless 'SUB=no'," + @echo " also clean subprojects." + @echo "Target 'clobber' will remove all built files from all configurations and," + @echo " unless 'SUB=no', also from subprojects." + @echo "Target 'all' will will build all configurations and, unless 'SUB=no'," + @echo " also build subprojects." + @echo "Target 'help' prints this message." + @echo "" + diff --git a/freebsd/CLI/nbproject/Makefile-variables.mk b/freebsd/CLI/nbproject/Makefile-variables.mk new file mode 100644 index 00000000..0f53cc2b --- /dev/null +++ b/freebsd/CLI/nbproject/Makefile-variables.mk @@ -0,0 +1,27 @@ +# +# Generated - do not edit! +# +# NOCDDL +# +CND_BASEDIR=`pwd` +CND_BUILDDIR=build +CND_DISTDIR=dist +# Release configuration +CND_PLATFORM_Release=CLang-Generic +CND_ARTIFACT_DIR_Release=dist/Release/CLang-Generic +CND_ARTIFACT_NAME_Release=sedutil-cli +CND_ARTIFACT_PATH_Release=dist/Release/CLang-Generic/sedutil-cli +CND_PACKAGE_DIR_Release=dist/Release/CLang-Generic/package +CND_PACKAGE_NAME_Release=cli.tar +CND_PACKAGE_PATH_Release=dist/Release/CLang-Generic/package/cli.tar +# +# include compiler specific variables +# +# dmake command +ROOT:sh = test -f nbproject/private/Makefile-variables.mk || \ + (mkdir -p nbproject/private && touch nbproject/private/Makefile-variables.mk) +# +# gmake command +.PHONY: $(shell test -f nbproject/private/Makefile-variables.mk || (mkdir -p nbproject/private && touch nbproject/private/Makefile-variables.mk)) +# +include nbproject/private/Makefile-variables.mk diff --git a/freebsd/CLI/nbproject/Package-Release.bash b/freebsd/CLI/nbproject/Package-Release.bash new file mode 100644 index 00000000..07e265f9 --- /dev/null +++ b/freebsd/CLI/nbproject/Package-Release.bash @@ -0,0 +1,76 @@ +#!/bin/bash -x + +# +# Generated - do not edit! +# + +# Macros +TOP=`pwd` +CND_PLATFORM=CLang-Generic +CND_CONF=Release +CND_DISTDIR=dist +CND_BUILDDIR=build +CND_DLIB_EXT=so +NBTMPDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tmp-packaging +TMPDIRNAME=tmp-packaging +OUTPUT_PATH=${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/sedutil-cli +OUTPUT_BASENAME=sedutil-cli +PACKAGE_TOP_DIR=cli/ + +# Functions +function checkReturnCode +{ + rc=$? + if [ $rc != 0 ] + then + exit $rc + fi +} +function makeDirectory +# $1 directory path +# $2 permission (optional) +{ + mkdir -p "$1" + checkReturnCode + if [ "$2" != "" ] + then + chmod $2 "$1" + checkReturnCode + fi +} +function copyFileToTmpDir +# $1 from-file path +# $2 to-file path +# $3 permission +{ + cp "$1" "$2" + checkReturnCode + if [ "$3" != "" ] + then + chmod $3 "$2" + checkReturnCode + fi +} + +# Setup +cd "${TOP}" +mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package +rm -rf ${NBTMPDIR} +mkdir -p ${NBTMPDIR} + +# Copy files and create directories and links +cd "${TOP}" +makeDirectory "${NBTMPDIR}/cli/bin" +copyFileToTmpDir "${OUTPUT_PATH}" "${NBTMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755 + + +# Generate tar file +cd "${TOP}" +rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/cli.tar +cd ${NBTMPDIR} +tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/cli.tar * +checkReturnCode + +# Cleanup +cd "${TOP}" +rm -rf ${NBTMPDIR} diff --git a/freebsd/CLI/nbproject/configurations.xml b/freebsd/CLI/nbproject/configurations.xml new file mode 100644 index 00000000..b33d88f2 --- /dev/null +++ b/freebsd/CLI/nbproject/configurations.xml @@ -0,0 +1,280 @@ + + + + + + ../../Common/pbkdf2/bitops.h + ../../Common/pbkdf2/blockwise.h + ../../Common/pbkdf2/chash.h + ../../Common/pbkdf2/handy.h + ../../Common/pbkdf2/hmac.h + ../../Common/pbkdf2/pbkdf2.h + ../../Common/pbkdf2/sha1.h + ../../Common/pbkdf2/tassert.h + + ../../Common/DtaAnnotatedDump.h + ../../Common/DtaCommand.h + ../../Common/DtaConstants.h + ../../Common/DtaDev.h + ../../Common/DtaDevEnterprise.h + ../DtaDevFreeBSDDrive.h + ../DtaDevFreeBSDCAM.h + ../DtaDevFreeBSDNvme.h + ../../Common/DtaDevGeneric.h + ../DtaDevOS.h + ../../Common/DtaDevOpal.h + ../../Common/DtaDevOpal1.h + ../../Common/DtaDevOpal2.h + ../../Common/DtaDevOpalite.h + ../../Common/DtaDevPyrite1.h + ../../Common/DtaDevPyrite2.h + ../../Common/DtaDevRuby1.h + ../../Common/DtaEndianFixup.h + ../../Common/DtaHashPwd.h + ../../Common/DtaHexDump.h + ../../Common/DtaLexicon.h + ../../Common/DtaOptions.h + ../../Common/DtaResponse.h + ../../Common/DtaSession.h + ../../Common/DtaStructures.h + ../../Common/log.h + ../os.h + + + + + + ../../Common/pbkdf2/blockwise.c + ../../Common/pbkdf2/chash.c + ../../Common/pbkdf2/hmac.c + ../../Common/pbkdf2/pbkdf2.c + ../../Common/pbkdf2/sha1.c + + ../../Common/DtaAnnotatedDump.cpp + ../../Common/DtaCommand.cpp + ../../Common/DtaDev.cpp + ../../Common/DtaDevEnterprise.cpp + ../DtaDevFreeBSDCAM.cpp + ../DtaDevFreeBSDNvme.cpp + ../../Common/DtaDevGeneric.cpp + ../DtaDevOS.cpp + ../../Common/DtaDevOpal.cpp + ../../Common/DtaDevOpal1.cpp + ../../Common/DtaDevOpal2.cpp + ../../Common/DtaDevOpalite.cpp + ../../Common/DtaDevPyrite1.cpp + ../../Common/DtaDevPyrite2.cpp + ../../Common/DtaDevRuby1.cpp + ../../Common/DtaHashPwd.cpp + ../../Common/DtaHexDump.cpp + ../../Common/DtaOptions.cpp + ../../Common/DtaResponse.cpp + ../../Common/DtaSession.cpp + ../../Common/sedutil.cpp + + + + + Makefile + + + + + Makefile + + + + ../../Common/pbdkf2 + ../../Common/pbdkf2 + ../../Common/pbkdf2 + + Makefile + + + + CLang|CLang + true + false + + + + 5 + 10 + clang + + .. + ../../Common + ../../Common/pbkdf2 + + -Wall + 3 + + + 0 + 8 + + .. + ../../Common + ../../Common/pbkdf2 + + -Wall + 3 + + + 5 + -Wall + + + 5 + + + ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/sedutil-cli + clang++ + + -lcam + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/freebsd/CLI/nbproject/private/Makefile-variables.mk b/freebsd/CLI/nbproject/private/Makefile-variables.mk new file mode 100644 index 00000000..589c41f5 --- /dev/null +++ b/freebsd/CLI/nbproject/private/Makefile-variables.mk @@ -0,0 +1,6 @@ +# +# Generated - do not edit! +# +# NOCDDL +# +# Release configuration diff --git a/freebsd/CLI/nbproject/private/configurations.xml b/freebsd/CLI/nbproject/private/configurations.xml new file mode 100644 index 00000000..aa08e0c4 --- /dev/null +++ b/freebsd/CLI/nbproject/private/configurations.xml @@ -0,0 +1,39 @@ + + + Makefile + + + + localhost + 5 + + + + + + + + + + + + + + + gdb + + + + "${OUTPUT_PATH}" + + "${OUTPUT_PATH}" + + true + 0 + 0 + + + + + + diff --git a/freebsd/CLI/nbproject/private/launcher.properties b/freebsd/CLI/nbproject/private/launcher.properties new file mode 100644 index 00000000..6cc2127d --- /dev/null +++ b/freebsd/CLI/nbproject/private/launcher.properties @@ -0,0 +1,40 @@ +# Launchers File syntax: +# +# [Must-have property line] +# launcher1.runCommand= +# [Optional extra properties] +# launcher1.displayName= +# launcher1.buildCommand= +# launcher1.runDir= +# launcher1.symbolFiles= +# launcher1.env.= +# (If this value is quoted with ` it is handled as a native command which execution result will become the value) +# [Common launcher properties] +# common.runDir= +# (This value is overwritten by a launcher specific runDir value if the latter exists) +# common.env.= +# (Environment variables from common launcher are merged with launcher specific variables) +# common.symbolFiles= +# (This value is overwritten by a launcher specific symbolFiles value if the latter exists) +# +# In runDir, symbolFiles and env fields you can use these macroses: +# ${PROJECT_DIR} - project directory absolute path +# ${OUTPUT_PATH} - linker output path (relative to project directory path) +# ${OUTPUT_BASENAME}- linker output filename +# ${TESTDIR} - test files directory (relative to project directory path) +# ${OBJECTDIR} - object files directory (relative to project directory path) +# ${CND_DISTDIR} - distribution directory (relative to project directory path) +# ${CND_BUILDDIR} - build directory (relative to project directory path) +# ${CND_PLATFORM} - platform name +# ${CND_CONF} - configuration name +# ${CND_DLIB_EXT} - dynamic library extension +# +# All the project launchers must be listed in the file! +# +# launcher1.runCommand=... +# launcher2.runCommand=... +# ... +# common.runDir=... +# common.env.KEY=VALUE + +# launcher1.runCommand= \ No newline at end of file diff --git a/freebsd/CLI/nbproject/project.xml b/freebsd/CLI/nbproject/project.xml new file mode 100644 index 00000000..8b8fb4c8 --- /dev/null +++ b/freebsd/CLI/nbproject/project.xml @@ -0,0 +1,28 @@ + + + org.netbeans.modules.cnd.makeproject + + + CLI + c + cpp + h + UTF-8 + + + ../../Common/pbdkf2 + ../../Common/pbdkf2 + ../../Common/pbkdf2 + + + + Release + 1 + + + + false + + + + diff --git a/freebsd/DtaDevFreeBSDCAM.cpp b/freebsd/DtaDevFreeBSDCAM.cpp new file mode 100644 index 00000000..26496cab --- /dev/null +++ b/freebsd/DtaDevFreeBSDCAM.cpp @@ -0,0 +1,253 @@ +/* C:B************************************************************************** +This software is Copyright 2016-2018 Alexander Motin + +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 . + + * C:E********************************************************************** */ +#include "os.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "DtaDevFreeBSDCAM.h" +#include "DtaHexDump.h" + +using namespace std; + +/** The Device class represents a single disk device. + * FreeBSD specific implementation using the CAM pass interface + */ + +DtaDevFreeBSDCAM::DtaDevFreeBSDCAM() +{ + isSCSI = 0; + isNVMe = 0; +} + +bool DtaDevFreeBSDCAM::init(const char * devref) +{ + LOG(D1) << "Creating DtaDevFreeBSDCAM::DtaDev() " << devref; + + if ((camdev = cam_open_device(devref, O_RDWR)) == NULL) { + // This is a D1 because diskscan looks for open fail to end scan + LOG(D1) << "Error opening device " << devref; + return (FALSE); + } + return (TRUE); +} + +/** Send an ioctl to the device using pass through. */ +uint8_t DtaDevFreeBSDCAM::sendCmd(ATACOMMAND cmd, uint8_t protocol, uint16_t comID, + void * buffer, uint32_t bufferlen) +{ + union ccb ccb; + + LOG(D1) << "Entering DtaDevFreeBSDCAM::sendCmd"; + bzero(&ccb, sizeof(ccb)); + if(isSCSI) { + cam_fill_csio(&ccb.csio, 1, NULL, + (cmd == IF_RECV) ? CAM_DIR_IN : CAM_DIR_OUT, + MSG_SIMPLE_Q_TAG, (u_int8_t*)buffer, bufferlen, + SSD_FULL_SIZE, 12, 60 * 1000); + + ccb.csio.cdb_io.cdb_bytes[0] = (cmd == IF_RECV) ? 0xa2 : 0xb5; + ccb.csio.cdb_io.cdb_bytes[1] = protocol; + ccb.csio.cdb_io.cdb_bytes[2] = comID >> 8; + ccb.csio.cdb_io.cdb_bytes[3] = comID; + ccb.csio.cdb_io.cdb_bytes[4] = 0x80; + ccb.csio.cdb_io.cdb_bytes[6] = (bufferlen/512) >> 24; + ccb.csio.cdb_io.cdb_bytes[7] = (bufferlen/512) >> 16; + ccb.csio.cdb_io.cdb_bytes[8] = (bufferlen/512) >> 8; + ccb.csio.cdb_io.cdb_bytes[9] = (bufferlen/512); + } else if(isNVMe) { + cam_fill_nvmeadmin(&ccb.nvmeio, 0, NULL, + (cmd == IF_RECV) ? CAM_DIR_IN : CAM_DIR_OUT, + (u_int8_t*)buffer, bufferlen, 60 * 1000); + if (IF_RECV == cmd) { + LOG(D3) << "Security Receive Command"; + ccb.nvmeio.cmd.opc = NVME_OPC_SECURITY_RECEIVE; + } else { + LOG(D3) << "Security Send Command"; + ccb.nvmeio.cmd.opc = NVME_OPC_SECURITY_SEND; + } + ccb.nvmeio.cmd.cdw10 = htole32(protocol << 24 | comID << 8); + ccb.nvmeio.cmd.cdw11 = htole32(bufferlen); + } else { + cam_fill_ataio(&ccb.ataio, 0, NULL, + (cmd == IF_RECV) ? CAM_DIR_IN : CAM_DIR_OUT, + MSG_SIMPLE_Q_TAG, (u_int8_t*)buffer, bufferlen, 60 * 1000); + + ccb.ataio.cmd.flags = 0; + ccb.ataio.cmd.command = cmd; + ccb.ataio.cmd.features = protocol; + ccb.ataio.cmd.lba_low = (bufferlen / 512) >> 8; + ccb.ataio.cmd.lba_mid = (comID & 0x00ff); + ccb.ataio.cmd.lba_high = (comID & 0xff00) >> 8; + ccb.ataio.cmd.device = 0x40; + ccb.ataio.cmd.sector_count = bufferlen / 512; + } + + ccb.ccb_h.flags |= CAM_PASS_ERR_RECOVER; + + if (cam_send_ccb(camdev, &ccb) < 0) { + LOG(D4) << "cam_send_ccb failed"; + return (0xff); + } + + if ((ccb.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + IFLOG(D4) + cam_error_print(camdev, &ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr); + return (0xff); + } + return (0); +} + +static void safecopy(uint8_t * dst, size_t dstsize, uint8_t * src, size_t srcsize) +{ + const size_t size = min(dstsize, srcsize); + if (size > 0) memcpy(dst, src, size); + if (size < dstsize) memset(dst+size, '\0', dstsize-size); +} + +static int +nvme_get_cdata(struct cam_device *dev, struct nvme_controller_data *cdata) +{ + union ccb *ccb; + struct ccb_dev_advinfo *advi; + + ccb = cam_getccb(dev); + if (ccb == NULL) { + LOG(D4) << "couldn't allocate CCB"; + return (1); + } + + advi = &ccb->cdai; + advi->ccb_h.flags = CAM_DIR_IN; + advi->ccb_h.func_code = XPT_DEV_ADVINFO; + advi->flags = CDAI_FLAG_NONE; + advi->buftype = CDAI_TYPE_NVME_CNTRL; + advi->bufsiz = sizeof(struct nvme_controller_data); + advi->buf = (uint8_t *)cdata; + + if (cam_send_ccb(dev, ccb) < 0) { + LOG(D4) << "error sending CAMIOCOMMAND ioctl"; + cam_freeccb(ccb); + return (1); + } + if (advi->ccb_h.status != CAM_REQ_CMP) { + LOG(D4) << "got CAM error " << advi->ccb_h.status; + cam_freeccb(ccb); + return (1); + } + cam_freeccb(ccb); + return (0); +} + +void DtaDevFreeBSDCAM::identify(OPAL_DiskInfo& disk_info) +{ + union ccb ccb; + struct nvme_controller_data cdata; + + LOG(D4) << "Entering DtaDevFreeBSDCAM::identify()"; + + bzero(&ccb, sizeof(union ccb)); + ccb.ccb_h.func_code = XPT_GDEV_TYPE; + if (cam_send_ccb(camdev, &ccb) < 0) { + LOG(D4) << "cam_send_ccb failed"; + disk_info.devType = DEVICE_TYPE_OTHER; + return; + } + + if ((ccb.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + LOG(D4) << "cam_send_ccb error" << ccb.ccb_h.status; + disk_info.devType = DEVICE_TYPE_OTHER; + return; + } + + if (ccb.cgd.protocol == PROTO_SCSI) { + isSCSI = 1; + disk_info.devType = DEVICE_TYPE_SAS; + safecopy(disk_info.serialNum, sizeof(disk_info.serialNum), + (uint8_t *)ccb.cgd.serial_num, ccb.cgd.serial_num_len); + safecopy(disk_info.firmwareRev, sizeof(disk_info.firmwareRev), + (uint8_t *)ccb.cgd.inq_data.revision, sizeof(ccb.cgd.inq_data.revision)); + safecopy(disk_info.modelNum, sizeof(disk_info.modelNum), + (uint8_t *)ccb.cgd.inq_data.vendor, sizeof(ccb.cgd.inq_data.vendor) + sizeof(ccb.cgd.inq_data.product)); + } else if (ccb.cgd.protocol == PROTO_NVME) { + isNVMe = 1; + if (nvme_get_cdata(camdev, &cdata)) { + LOG(D4) << "nvme_get_cdata failed"; + disk_info.devType = DEVICE_TYPE_OTHER; + return; + } + safecopy(disk_info.serialNum, sizeof(disk_info.serialNum), + (uint8_t *)cdata.sn, sizeof(cdata.sn)); + safecopy(disk_info.firmwareRev, sizeof(disk_info.firmwareRev), + (uint8_t *)cdata.fr, sizeof(cdata.fr)); + safecopy(disk_info.modelNum, sizeof(disk_info.modelNum), + (uint8_t *)cdata.mn, sizeof(cdata.mn)); +#if __FreeBSD_version >= 1200058 + if ((cdata.oacs >> NVME_CTRLR_DATA_OACS_SECURITY_SHIFT) & + NVME_CTRLR_DATA_OACS_SECURITY_MASK) { +#else + if (cdata.oacs.security) { +#endif + LOG(D4) << "Security Send/Receive are supported"; + disk_info.devType = DEVICE_TYPE_NVME; + } else { + LOG(D4) << "Security Send/Receive are not supported"; + disk_info.devType = DEVICE_TYPE_OTHER; + } + } else if (ccb.cgd.protocol == PROTO_ATA) { + safecopy(disk_info.serialNum, sizeof(disk_info.serialNum), + (uint8_t *)ccb.cgd.serial_num, ccb.cgd.serial_num_len); + memcpy(disk_info.firmwareRev, ccb.cgd.ident_data.revision, + sizeof(disk_info.firmwareRev)); + memcpy(disk_info.modelNum, ccb.cgd.ident_data.model, + sizeof(disk_info.modelNum)); +#ifndef ATA_SUPPORT_TCG +#define ATA_SUPPORT_TCG 0x0001 +#define tcg usedmovsd +#endif + if ((ccb.cgd.ident_data.tcg & 0xc000) == 0x4000 && + (ccb.cgd.ident_data.tcg & ATA_SUPPORT_TCG) != 0) { + LOG(D4) << "Trusted Computing feature set is supported " + << std::hex << ccb.cgd.ident_data.tcg; + disk_info.devType = DEVICE_TYPE_ATA; + } else { + LOG(D4) << "Trusted Computing feature set is not supported " + << std::hex << ccb.cgd.ident_data.tcg; + disk_info.devType = DEVICE_TYPE_OTHER; + } + } else { + disk_info.devType = DEVICE_TYPE_OTHER; + } +} + +/** Close the device reference so this object can be delete. */ +DtaDevFreeBSDCAM::~DtaDevFreeBSDCAM() +{ + LOG(D1) << "Destroying DtaDevFreeBSDCAM"; + cam_close_device(camdev); +} diff --git a/freebsd/DtaDevFreeBSDCAM.h b/freebsd/DtaDevFreeBSDCAM.h new file mode 100644 index 00000000..cb4c16af --- /dev/null +++ b/freebsd/DtaDevFreeBSDCAM.h @@ -0,0 +1,57 @@ +/* C:B************************************************************************** +This software is Copyright 2016-2018 Alexander Motin +This software is Copyright 2014-2016 Bright Plaza Inc. + +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 . + + * C:E********************************************************************** */ +#pragma once +#include "DtaStructures.h" +#include "DtaDevFreeBSDDrive.h" + +/** FreeBSD specific implementation of DtaDevOS. + * Uses the SCSI generic ioctls to send commands to the + * device + */ +class DtaDevFreeBSDCAM: public DtaDevFreeBSDDrive { +public: + /** Default constructor */ + DtaDevFreeBSDCAM(); + /** Destructor */ + ~DtaDevFreeBSDCAM(); + /** Sata FreeBSD specific initialization. + * This function should perform the necessary authority and environment checking + * to allow proper functioning of the program, open the device, perform an ATA + * identify, add the fields from the identify response to the disk info structure + * and if the device is an ATA device perform a call to Discovery0() to complete + * the disk_info structure + * @param devref character representation of the device is standard OS lexicon + */ + bool init(const char * devref); + /** Sata FreeBSD specific method to send an ATA command to the device + * @param cmd ATA command to be sent to the device + * @param protocol security protocol to be used in the command + * @param comID communications ID to be used + * @param buffer input/output buffer + * @param bufferlen length of the input/output buffer + */ + uint8_t sendCmd(ATACOMMAND cmd, uint8_t protocol, uint16_t comID, + void * buffer, uint32_t bufferlen); + void identify(OPAL_DiskInfo& disk_info); + struct cam_device *camdev; + int isSCSI; /* The device is SCSI */ + int isNVMe; /* The device is NVMe */ +}; diff --git a/freebsd/DtaDevFreeBSDDrive.h b/freebsd/DtaDevFreeBSDDrive.h new file mode 100644 index 00000000..89ff4624 --- /dev/null +++ b/freebsd/DtaDevFreeBSDDrive.h @@ -0,0 +1,49 @@ +/* C:B************************************************************************** +This software is Copyright 2016-2018 Alexander Motin +This software is Copyright 2014-2016 Bright Plaza Inc. + +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 . + + * C:E********************************************************************** */ +#pragma once +#include "DtaStructures.h" + +/** virtual implementation for a disk interface-generic disk drive + */ +class DtaDevFreeBSDDrive { +public: + virtual ~DtaDevFreeBSDDrive( void ) {}; + /**Initialization. + * This function should perform the necessary authority and environment checking + * to allow proper functioning of the program, open the device, perform an ATA + * identify, add the fields from the identify response to the disk info structure + * and if the device is an ATA device perform a call to Discovery0() to complete + * the disk_info structure + * @param devref character representation of the device is standard OS lexicon + */ + virtual bool init(const char * devref) = 0; + /** Method to send a command to the device + * @param cmd command to be sent to the device + * @param protocol security protocol to be used in the command + * @param comID communications ID to be used + * @param buffer input/output buffer + * @param bufferlen length of the input/output buffer + */ + virtual uint8_t sendCmd(ATACOMMAND cmd, uint8_t protocol, uint16_t comID, + void * buffer, uint32_t bufferlen) = 0; + /** Routine to send an identify to the device */ + virtual void identify(OPAL_DiskInfo& disk_info) = 0; +}; diff --git a/freebsd/DtaDevFreeBSDNvme.cpp b/freebsd/DtaDevFreeBSDNvme.cpp new file mode 100644 index 00000000..b6d117bc --- /dev/null +++ b/freebsd/DtaDevFreeBSDNvme.cpp @@ -0,0 +1,150 @@ +/* C:B************************************************************************** +This software is Copyright 2016-2018 Alexander Motin + +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 . + + * C:E********************************************************************** */ +#include "os.h" +#include +#include +#include +#include +#include +#include +#include +#include "DtaDevFreeBSDNvme.h" +#include "DtaHexDump.h" + +using namespace std; + +/** The Device class represents a single disk device. + * FreeBSD specific implementation using the NVMe interface + */ +DtaDevFreeBSDNvme::DtaDevFreeBSDNvme() {} + +bool DtaDevFreeBSDNvme::init(const char * devref) +{ + LOG(D1) << "Creating DtaDevFreeBSDNvme::DtaDev() " << devref; + + if ((fd = open(devref, O_RDWR)) < 0) { + // This is a D1 because diskscan looks for open fail to end scan + LOG(D1) << "Error opening device " << devref << " " << errno; + return (FALSE); + } + return (TRUE); +} + +/** Send an ioctl to the device using nvme admin commands. */ +uint8_t DtaDevFreeBSDNvme::sendCmd(ATACOMMAND cmd, uint8_t protocol, uint16_t comID, + void * buffer, uint32_t bufferlen) +{ + struct nvme_pt_command pt; + int err; + + LOG(D1) << "Entering DtaDevFreeBSDNvme::sendCmd"; + + memset(&pt, 0, sizeof(pt)); + if (IF_RECV == cmd) { + LOG(D3) << "Security Receive Command"; +#if __FreeBSD_version >= 1200058 && __FreeBSD_version < 1200081 + pt.cmd.opc_fuse = NVME_CMD_SET_OPC(NVME_OPC_SECURITY_RECEIVE); +#else + pt.cmd.opc = NVME_OPC_SECURITY_RECEIVE; +#endif + } else { + LOG(D3) << "Security Send Command"; +#if __FreeBSD_version >= 1200058 && __FreeBSD_version < 1200081 + pt.cmd.opc_fuse = NVME_CMD_SET_OPC(NVME_OPC_SECURITY_SEND); +#else + pt.cmd.opc = NVME_OPC_SECURITY_SEND; +#endif + } + pt.cmd.cdw10 = protocol << 24 | comID << 8; + pt.cmd.cdw11 = bufferlen; + pt.len = bufferlen; + pt.buf = buffer; + + err = ioctl(fd, NVME_PASSTHROUGH_CMD, &pt); + if (err < 0) { + LOG(D4) << "NVME_PASSTHROUGH_CMD failed"; + return (errno); + } else if (nvme_completion_is_error(&pt.cpl)) { + LOG(D4) << "NVME Security Command Error: " << std::hex << +#if __FreeBSD_version >= 1200058 + pt.cpl.status; +#else + pt.cpl.status.sct << " " << pt.cpl.status.sc; +#endif + return (0xff); + } else + LOG(D4) << "NVME Security Command Success"; + return (err); +} + +void DtaDevFreeBSDNvme::identify(OPAL_DiskInfo& disk_info) +{ + struct nvme_pt_command pt; + struct nvme_controller_data cdata; + + LOG(D4) << "Entering DtaDevFreeBSDNvme::identify()"; + + memset(&pt, 0, sizeof(pt)); +#if __FreeBSD_version >= 1200058 && __FreeBSD_version < 1200081 + pt.cmd.opc_fuse = NVME_CMD_SET_OPC(NVME_OPC_IDENTIFY); +#else + pt.cmd.opc = NVME_OPC_IDENTIFY; +#endif + pt.cmd.cdw10 = 1; + pt.buf = &cdata; + pt.len = sizeof(cdata); + pt.is_read = 1; + + if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) { + LOG(E) << "Identify error " << errno; + disk_info.devType = DEVICE_TYPE_OTHER; + return; + } + + if (nvme_completion_is_error(&pt.cpl)) { + LOG(E) << "identify request returned error"; + disk_info.devType = DEVICE_TYPE_OTHER; + return; + } + + memcpy(disk_info.serialNum, cdata.sn, sizeof (disk_info.serialNum)); + memcpy(disk_info.firmwareRev, cdata.fr, sizeof(disk_info.firmwareRev)); + memcpy(disk_info.modelNum, cdata.mn, sizeof(disk_info.modelNum)); + +#if __FreeBSD_version >= 1200058 + if ((cdata.oacs >> NVME_CTRLR_DATA_OACS_SECURITY_SHIFT) & + NVME_CTRLR_DATA_OACS_SECURITY_MASK) { +#else + if (cdata.oacs.security) { +#endif + LOG(D4) << "Security Send/Receive are supported"; + disk_info.devType = DEVICE_TYPE_NVME; + } else { + LOG(D4) << "Security Send/Receive are not supported"; + disk_info.devType = DEVICE_TYPE_OTHER; + } +} + +/** Close the device reference so this object can be delete. */ +DtaDevFreeBSDNvme::~DtaDevFreeBSDNvme() +{ + LOG(D1) << "Destroying DtaDevFreeBSDNvme"; + close(fd); +} diff --git a/freebsd/DtaDevFreeBSDNvme.h b/freebsd/DtaDevFreeBSDNvme.h new file mode 100644 index 00000000..f5325742 --- /dev/null +++ b/freebsd/DtaDevFreeBSDNvme.h @@ -0,0 +1,56 @@ +/* C:B************************************************************************** +This software is Copyright 2016-2018 Alexander Motin +This software is Copyright 2014-2016 Bright Plaza Inc. + +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 . + + * C:E********************************************************************** */ +#pragma once +#include "dev/nvme/nvme.h" +#include "DtaStructures.h" +#include "DtaDevFreeBSDDrive.h" + +/** FreeBSD specific implementation of DtaDevOS. + * Uses the NVMe to send commands to the device + */ +class DtaDevFreeBSDNvme: public DtaDevFreeBSDDrive{ +public: + /** Default constructor */ + DtaDevFreeBSDNvme(); + /** Destructor */ + ~DtaDevFreeBSDNvme(); + /** NVMe specific initialization. + * This function should perform the necessary authority and environment checking + * to allow proper functioning of the program, open the device, perform an ATA + * identify, add the fields from the identify response to the disk info structure + * and if the device is an ATA device perform a call to Discovery0() to complete + * the disk_info structure + * @param devref character representation of the device is standard OS lexicon + */ + bool init(const char * devref); + /** NVMe specific method to send a command to the device + * @param cmd command to be sent to the device + * @param protocol security protocol to be used in the command + * @param comID communications ID to be used + * @param buffer input/output buffer + * @param bufferlen length of the input/output buffer + */ + uint8_t sendCmd(ATACOMMAND cmd, uint8_t protocol, uint16_t comID, + void * buffer, uint32_t bufferlen); + /** NVMe specific routine to send an identify to the device */ + void identify(OPAL_DiskInfo& disk_info); + int fd; /**< FreeBSD handle for the device */ +}; diff --git a/freebsd/DtaDevOS.cpp b/freebsd/DtaDevOS.cpp new file mode 100644 index 00000000..b1c90d85 --- /dev/null +++ b/freebsd/DtaDevOS.cpp @@ -0,0 +1,180 @@ +/* C:B************************************************************************** +This software is Copyright 2016-2018 Alexander Motin +This software is Copyright 2014-2016 Bright Plaza Inc. + +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 . + + * C:E********************************************************************** */ +#include "os.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "DtaDevOS.h" +#include "DtaHexDump.h" +#include "DtaDevFreeBSDNvme.h" +#include "DtaDevFreeBSDCAM.h" +#include "DtaDevGeneric.h" + +using namespace std; + +/** The Device class represents a FreeBSD generic storage device. + * At initialization we determine if we map to the NVMe or SATA derived class + */ +unsigned long long DtaDevOS::getSize() +{ + return 0; +} + +DtaDevOS::DtaDevOS() +{ + drive = NULL; +} + +/* Determine which type of drive we're using and instantiate a derived class of that type */ +void DtaDevOS::init(const char * devref) +{ + LOG(D1) << "DtaDevOS::init " << devref; + + memset(&disk_info, 0, sizeof(OPAL_DiskInfo)); + dev = devref; + + if (!strncmp(devref, "/dev/nvme", 9) || !strncmp(devref, "/dev/nvd", 8)) + { + drive = new DtaDevFreeBSDNvme(); + } + else + if (!strncmp(devref, "/dev/da", 7) || + !strncmp(devref, "/dev/ada", 8) || + !strncmp(devref, "/dev/nda", 8)) + { + drive = new DtaDevFreeBSDCAM(); + } + else { + LOG(E) << "DtaDevOS::init ERROR - unknown drive type"; + return; + } + + if (drive->init(devref)) + { + isOpen = TRUE; + drive->identify(disk_info); + if (disk_info.devType != DEVICE_TYPE_OTHER) + discovery0(); + } + else + isOpen = FALSE; + + return; +} + +uint8_t DtaDevOS::sendCmd(ATACOMMAND cmd, uint8_t protocol, uint16_t comID, + void * buffer, uint32_t bufferlen) +{ + if (!isOpen) return 0xfe; //disk open failed so this will too + + if (NULL == drive) + { + LOG(E) << "DtaDevOS::sendCmd ERROR - unknown drive type"; + return 0xff; + } + + return drive->sendCmd(cmd, protocol, comID, buffer, bufferlen); +} + +void DtaDevOS::identify(OPAL_DiskInfo& disk_info) +{ + if (!isOpen) return; //disk open failed so this will too + if (NULL == drive) + { + LOG(E) << "DtaDevOS::identify ERROR - unknown disk type"; + return; + } + + drive->identify(disk_info); +} + +void DtaDevOS::osmsSleep(uint32_t ms) +{ + usleep(ms * 1000); //convert to microseconds + return; +} + +int DtaDevOS::diskScan() +{ + DIR *dir; + struct dirent *dirent; + DtaDev * d; + char devname[25]; + vector devices; + string tempstring; + + LOG(D1) << "Entering DtaDevOS:diskScan "; + dir = opendir("/dev"); + if (dir != NULL) { + while ((dirent=readdir(dir)) != NULL) { + if (fnmatch("da[0-9]", dirent->d_name, 0) == 0 || + fnmatch("da[0-9][0-9]", dirent->d_name, 0) == 0 || + fnmatch("da[0-9][0-9][0-9]", dirent->d_name, 0) == 0 || + fnmatch("ada[0-9]", dirent->d_name, 0) == 0 || + fnmatch("ada[0-9][0-9]", dirent->d_name, 0) == 0 || + fnmatch("ada[0-9][0-9][0-9]", dirent->d_name, 0) == 0 || + fnmatch("nvme[0-9]",dirent->d_name, 0) == 0 || + fnmatch("nvme[0-9][0-9]",dirent->d_name, 0) == 0 || + fnmatch("nvme[0-9][0-9][0-9]",dirent->d_name,0) == 0) { + tempstring = dirent->d_name; + devices.push_back(tempstring); + } + } + closedir(dir); + } + std::sort(devices.begin(), devices.end()); + printf("Scanning for Opal compliant disks\n"); + for (int i = 0; i < devices.size(); i++) { + snprintf(devname, 23, "/dev/%s", devices[i].c_str()); + printf("%-10s", devname); + d = new DtaDevGeneric(devname); + if (d->isAnySSC()) + printf(" %s%s%s%s%s%s%s ", (d->isOpal1() ? "1" : " "), + (d->isOpal2() ? "2" : " "), (d->isEprise() ? "E" : " "), + (d->isOpalite() ? "L" : " "), (d->isPyrite1() ? "p" : " "), + (d->isPyrite2() ? "P" : " "), (d->isRuby1() ? "r" : " ")); + else + printf("%s", " No "); + + printf("%s %s\n", d->getModelNum(), d->getFirmwareRev()); + delete d; + } + printf("No more disks present ending scan\n"); + LOG(D1) << "Exiting DtaDevOS::scanDisk "; + return 0; +} + +/** Close the device reference so this object can be delete. */ +DtaDevOS::~DtaDevOS() +{ + LOG(D1) << "Destroying DtaDevOS"; + if (NULL != drive) + delete drive; +} diff --git a/freebsd/DtaDevOS.h b/freebsd/DtaDevOS.h new file mode 100644 index 00000000..f78ef139 --- /dev/null +++ b/freebsd/DtaDevOS.h @@ -0,0 +1,64 @@ +/* C:B************************************************************************** +This software is Copyright 2016-2018 Alexander Motin + +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 . + + * C:E********************************************************************** */ +#pragma once +#include "DtaDev.h" +#include "DtaDevFreeBSDDrive.h" + +/** FreeBSD specific implementation of DtaDevOS. + */ +class DtaDevOS : public DtaDev { +public: + /** Default constructor */ + DtaDevOS(); + /** Destructor */ + ~DtaDevOS(); + /** OS specific initialization. + * This function should perform the necessary authority and environment checking + * to allow proper functioning of the program, open the device, perform an ATA + * identify, add the fields from the identify response to the disk info structure + * and if the device is an ATA device perform a call to Discovery0() to complete + * the disk_info structure + * @param devref character representation of the device is standard OS lexicon + */ + void init(const char * devref); + /** OS specific method to send an ATA command to the device + * @param cmd ATA command to be sent to the device + * @param protocol security protocol to be used in the command + * @param comID communications ID to be used + * @param buffer input/output buffer + * @param bufferlen length of the input/output buffer + */ + uint8_t sendCmd(ATACOMMAND cmd, uint8_t protocol, uint16_t comID, + void * buffer, uint32_t bufferlen); + /** A static class to scan for supported drives */ + static int diskScan(); +protected: + /** OS specific command to Wait for specified number of milliseconds + * @param ms number of milliseconds to wait + */ + void osmsSleep(uint32_t ms); + /** OS specific routine to send an ATA identify to the device */ + void identify(OPAL_DiskInfo& disk_info); + /** return drive size in bytes */ + unsigned long long getSize(); + int fd; /**< FreeBSD handle for the device */ +private: + DtaDevFreeBSDDrive *drive; +}; diff --git a/freebsd/GitVersion.sh b/freebsd/GitVersion.sh new file mode 100644 index 00000000..dfbb967d --- /dev/null +++ b/freebsd/GitVersion.sh @@ -0,0 +1,3 @@ +#!/bin/sh +GITVER=`git describe --dirty` +echo "#define GIT_VERSION " \"$GITVER\" diff --git a/freebsd/os.h b/freebsd/os.h new file mode 100644 index 00000000..385ce796 --- /dev/null +++ b/freebsd/os.h @@ -0,0 +1,35 @@ +/* C:B************************************************************************** +This software is Copyright 2016-2018 Alexander Motin + +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 . + + * C:E********************************************************************** */ +#pragma once +#include +#include +#include +#include +#include +#include +#include "DtaConstants.h" +#include "log.h" +// Why can't I find these?? +#define TRUE 1 +#define FALSE 0 +// a few OS specific methods that need to be worked out +#define SNPRINTF snprintf +#define DEVICEMASK snprintf(devname,23,"/dev/da%d",i) +#define DEVICEEXAMPLE "/dev/da0" diff --git a/images/buildpbaroot b/images/buildpbaroot index ad4129a4..5a852eb3 100755 --- a/images/buildpbaroot +++ b/images/buildpbaroot @@ -30,7 +30,7 @@ sed -i '/menu "System tools"/a \\tsource "package/sedutil/Config.in"' package/Co cp -r ../../buildroot/packages/sedutil/ package/ # Make a distribution from the current source cd ../../.. -autoreconf -i +autoreconf ./configure make dist mkdir images/scratch/buildroot/dl/ @@ -48,9 +48,9 @@ cd .. # build the rootfs for 64 and 32 bit systems echo Making the 64bit PBA Linux system -make O=64bit 2>&1 | tee 64bit/build_output.txt +make -j12 O=64bit 2>&1 | tee 64bit/build_output.txt echo Making the 32bit PBA Linux system -make O=32bit 2>&1 | tee 32bit/build_output.txt +make -j12 O=32bit 2>&1 | tee 32bit/build_output.txt # back to where we started cd ../.. exit 0 diff --git a/linux/CLI/nbproject/Makefile-Debug_i686.mk b/linux/CLI/nbproject/Makefile-Debug_i686.mk index e3b0cca5..3b0f299e 100644 --- a/linux/CLI/nbproject/Makefile-Debug_i686.mk +++ b/linux/CLI/nbproject/Makefile-Debug_i686.mk @@ -43,6 +43,10 @@ OBJECTFILES= \ ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal.o \ ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal1.o \ ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal2.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpalite.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite1.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite2.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaDevRuby1.o \ ${OBJECTDIR}/_ext/7a2a93ab/DtaHashPwd.o \ ${OBJECTDIR}/_ext/7a2a93ab/DtaHexDump.o \ ${OBJECTDIR}/_ext/7a2a93ab/DtaOptions.o \ @@ -123,6 +127,26 @@ ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal2.o: ../../Common/DtaDevOpal2.cpp ${RM} "$@.d" $(COMPILE.cc) -g -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal2.o ../../Common/DtaDevOpal2.cpp +${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpalite.o: ../../Common/DtaDevOpalite.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -g -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpalite.o ../../Common/DtaDevOpalite.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite1.o: ../../Common/DtaDevPyrite1.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -g -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite1.o ../../Common/DtaDevPyrite1.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite2.o: ../../Common/DtaDevPyrite2.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -g -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite2.o ../../Common/DtaDevPyrite2.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaDevRuby1.o: ../../Common/DtaDevRuby1.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -g -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevRuby1.o ../../Common/DtaDevRuby1.cpp + ${OBJECTDIR}/_ext/7a2a93ab/DtaHashPwd.o: ../../Common/DtaHashPwd.cpp ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab ${RM} "$@.d" diff --git a/linux/CLI/nbproject/Makefile-Debug_x86_64.mk b/linux/CLI/nbproject/Makefile-Debug_x86_64.mk index 8114c8ea..05d9bdc0 100644 --- a/linux/CLI/nbproject/Makefile-Debug_x86_64.mk +++ b/linux/CLI/nbproject/Makefile-Debug_x86_64.mk @@ -43,6 +43,10 @@ OBJECTFILES= \ ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal.o \ ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal1.o \ ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal2.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpalite.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite1.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite2.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaDevRuby1.o \ ${OBJECTDIR}/_ext/7a2a93ab/DtaHashPwd.o \ ${OBJECTDIR}/_ext/7a2a93ab/DtaHexDump.o \ ${OBJECTDIR}/_ext/7a2a93ab/DtaOptions.o \ @@ -123,6 +127,26 @@ ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal2.o: ../../Common/DtaDevOpal2.cpp ${RM} "$@.d" $(COMPILE.cc) -g -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal2.o ../../Common/DtaDevOpal2.cpp +${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpalite.o: ../../Common/DtaDevOpalite.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpalite.o ../../Common/DtaDevOpalite.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite1.o: ../../Common/DtaDevPyrite1.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite1.o ../../Common/DtaDevPyrite1.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite2.o: ../../Common/DtaDevPyrite2.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite2.o ../../Common/DtaDevPyrite2.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaDevRuby1.o: ../../Common/DtaDevRuby1.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -g -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevRuby1.o ../../Common/DtaDevRuby1.cpp + ${OBJECTDIR}/_ext/7a2a93ab/DtaHashPwd.o: ../../Common/DtaHashPwd.cpp ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab ${RM} "$@.d" diff --git a/linux/CLI/nbproject/Makefile-Release_i686.mk b/linux/CLI/nbproject/Makefile-Release_i686.mk index 8d753dad..39893cbd 100644 --- a/linux/CLI/nbproject/Makefile-Release_i686.mk +++ b/linux/CLI/nbproject/Makefile-Release_i686.mk @@ -43,6 +43,10 @@ OBJECTFILES= \ ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal.o \ ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal1.o \ ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal2.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpalite.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite1.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite2.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaDevRuby1.o \ ${OBJECTDIR}/_ext/7a2a93ab/DtaHashPwd.o \ ${OBJECTDIR}/_ext/7a2a93ab/DtaHexDump.o \ ${OBJECTDIR}/_ext/7a2a93ab/DtaOptions.o \ @@ -123,6 +127,26 @@ ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal2.o: ../../Common/DtaDevOpal2.cpp ${RM} "$@.d" $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal2.o ../../Common/DtaDevOpal2.cpp +${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpalite.o: ../../Common/DtaDevOpalite.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpalite.o ../../Common/DtaDevOpalite.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite1.o: ../../Common/DtaDevPyrite1.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite1.o ../../Common/DtaDevPyrite1.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite2.o: ../../Common/DtaDevPyrite2.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite2.o ../../Common/DtaDevPyrite2.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaDevRuby1.o: ../../Common/DtaDevRuby1.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevRuby1.o ../../Common/DtaDevRuby1.cpp + ${OBJECTDIR}/_ext/7a2a93ab/DtaHashPwd.o: ../../Common/DtaHashPwd.cpp ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab ${RM} "$@.d" diff --git a/linux/CLI/nbproject/Makefile-Release_x86_64.mk b/linux/CLI/nbproject/Makefile-Release_x86_64.mk index 7023911c..8acd75d1 100644 --- a/linux/CLI/nbproject/Makefile-Release_x86_64.mk +++ b/linux/CLI/nbproject/Makefile-Release_x86_64.mk @@ -43,6 +43,10 @@ OBJECTFILES= \ ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal.o \ ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal1.o \ ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal2.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpalite.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite1.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite2.o \ + ${OBJECTDIR}/_ext/7a2a93ab/DtaDevRuby1.o \ ${OBJECTDIR}/_ext/7a2a93ab/DtaHashPwd.o \ ${OBJECTDIR}/_ext/7a2a93ab/DtaHexDump.o \ ${OBJECTDIR}/_ext/7a2a93ab/DtaOptions.o \ @@ -123,6 +127,26 @@ ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal2.o: ../../Common/DtaDevOpal2.cpp ${RM} "$@.d" $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpal2.o ../../Common/DtaDevOpal2.cpp +${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpalite.o: ../../Common/DtaDevOpalite.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevOpalite.o ../../Common/DtaDevOpalite.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite1.o: ../../Common/DtaDevPyrite1.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite1.o ../../Common/DtaDevPyrite1.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite2.o: ../../Common/DtaDevPyrite2.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevPyrite2.o ../../Common/DtaDevPyrite2.cpp + +${OBJECTDIR}/_ext/7a2a93ab/DtaDevRuby1.o: ../../Common/DtaDevRuby1.cpp + ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab + ${RM} "$@.d" + $(COMPILE.cc) -Werror -I.. -I../../Common -I../../Common/pbkdf2 -std=c++11 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/_ext/7a2a93ab/DtaDevRuby1.o ../../Common/DtaDevRuby1.cpp + ${OBJECTDIR}/_ext/7a2a93ab/DtaHashPwd.o: ../../Common/DtaHashPwd.cpp ${MKDIR} -p ${OBJECTDIR}/_ext/7a2a93ab ${RM} "$@.d" diff --git a/linux/CLI/nbproject/configurations.xml b/linux/CLI/nbproject/configurations.xml index c770abf1..0ebcd23c 100644 --- a/linux/CLI/nbproject/configurations.xml +++ b/linux/CLI/nbproject/configurations.xml @@ -27,6 +27,10 @@ ../../Common/DtaDevOpal.h ../../Common/DtaDevOpal1.h ../../Common/DtaDevOpal2.h + ../../Common/DtaDevOpalite.h + ../../Common/DtaDevPyrite1.h + ../../Common/DtaDevPyrite2.h + ../../Common/DtaDevRuby1.h ../../Common/DtaEndianFixup.h ../../Common/DtaHashPwd.h ../../Common/DtaHexDump.h @@ -63,6 +67,10 @@ ../../Common/DtaDevOpal.cpp ../../Common/DtaDevOpal1.cpp ../../Common/DtaDevOpal2.cpp + ../../Common/DtaDevOpalite.cpp + ../../Common/DtaDevPyrite1.cpp + ../../Common/DtaDevPyrite2.cpp + ../../Common/DtaDevRuby1.cpp ../../Common/DtaHashPwd.cpp ../../Common/DtaHexDump.cpp ../../Common/DtaOptions.cpp @@ -170,6 +178,22 @@ + + + + + + + + + + + + + + + + @@ -319,6 +343,22 @@ + + + + + + + + + + + + + + + + @@ -462,6 +502,22 @@ + + + + + + + + + + + + + + + + @@ -611,6 +667,22 @@ + + + + + + + + + + + + + + + + diff --git a/linux/DtaDevOS.cpp b/linux/DtaDevOS.cpp index 5261e736..e1db38c5 100644 --- a/linux/DtaDevOS.cpp +++ b/linux/DtaDevOS.cpp @@ -152,10 +152,12 @@ int DtaDevOS::diskScan() printf("%-10s", devname); d = new DtaDevGeneric(devname); if (d->isAnySSC()) - printf(" %s%s%s ", (d->isOpal1() ? "1" : " "), - (d->isOpal2() ? "2" : " "), (d->isEprise() ? "E" : " ")); + printf(" %s%s%s%s%s%s%s ", (d->isOpal1() ? "1" : " "), + (d->isOpal2() ? "2" : " "), (d->isEprise() ? "E" : " "), + (d->isOpalite() ? "L" : " "), (d->isPyrite1() ? "p" : " "), + (d->isPyrite2() ? "P" : " "), (d->isRuby1() ? "r" : " ")); else - printf("%s", " No "); + printf("%s", " No "); printf("%s %s\n",d->getModelNum(),d->getFirmwareRev()); delete d; diff --git a/linux/PSIDRevert_LINUX.txt b/linux/PSIDRevert_LINUX.txt index 6ed364d9..40ec1a38 100644 --- a/linux/PSIDRevert_LINUX.txt +++ b/linux/PSIDRevert_LINUX.txt @@ -60,7 +60,7 @@ DataStore function (0x0202) OPAL 2.0 function (0x0203) Base comID = 0x1000, Initial PIN = 0x0, Reverted PIN = 0x0, comIDs = 1 Locking Admins = 4, Locking Users = 9, Range Crossing = N -root@r0m30-PC:~# ./setutil-cli --yesIreallywanttoERASEALLmydatausingthePSID /dev/sd8 +root@r0m30-PC:~# ./setutil-cli --yesIreallywanttoERASE*ALL*mydatausingthePSID /dev/sd8 - 01:14:10.996 INFO: Performing a PSID Revert on /dev/sd8 with password - 01:14:11.165 INFO: revertTper completed successfully root@r0m30-PC:~# diff --git a/updated_windows_build-2021.txt b/updated_windows_build-2021.txt new file mode 100644 index 00000000..c169c1f7 --- /dev/null +++ b/updated_windows_build-2021.txt @@ -0,0 +1,21 @@ +Install Microsoft Visual Studio 2015 +Add C++ tools to VS2015 +In Windows Powershell, VIA Powershell: +set-executionpolicy unrestricted +-> change back when you are done with these steps! +set-executionpolicy RemoteSigned +Verify policy reset: +get-executionpolicy +Via an elevated command prompt: +c:\windows\syswow64\WindowsPowerShell\v1.0\powershell.exe -command set-executionpolicy -Scope CurrentUser unrestricted +-> change back when you are done with these steps! +c:\windows\syswow64\WindowsPowerShell\v1.0\powershell.exe -command set-executionpolicy -Scope CurrentUser Restricted +Verify policy reset: +c:\windows\syswow64\WindowsPowerShell\v1.0\powershell.exe -command get-executionpolicy +Open VS2015 +Open -> Project/Solution -> sedutil/windows/CLI/CLI.sln +Project -> Retarget Solution -> 8.1 +Build -> Configuration Manager -> Configuration -> Release +Build -> Build Solution +This should build the windows executable sedutil.exe +Make sure to change the policies back in 3 and 4 above. \ No newline at end of file diff --git a/windows/CLI/CLI.vcxproj b/windows/CLI/CLI.vcxproj index c94e5b03..1122bf50 100644 --- a/windows/CLI/CLI.vcxproj +++ b/windows/CLI/CLI.vcxproj @@ -28,6 +28,10 @@ + + + + @@ -60,6 +64,10 @@ + + + + diff --git a/windows/CLI/CLI.vcxproj.filters b/windows/CLI/CLI.vcxproj.filters index bb6a0044..fde2fd0c 100644 --- a/windows/CLI/CLI.vcxproj.filters +++ b/windows/CLI/CLI.vcxproj.filters @@ -54,6 +54,18 @@ Header Files + + Header Files + + + Header Files + + + Header Files + + + Header Files + Header Files @@ -134,6 +146,18 @@ Source Files + + Source Files + + + Source Files + + + Source Files + + + Source Files + Source Files diff --git a/windows/DtaDevOS.cpp b/windows/DtaDevOS.cpp index 4d4e769f..1733ff89 100644 --- a/windows/DtaDevOS.cpp +++ b/windows/DtaDevOS.cpp @@ -153,10 +153,12 @@ int DtaDevOS::diskScan() if (d->isPresent()) { printf("%s", devname); if (d->isAnySSC()) - printf(" %s%s%s ", (d->isOpal1() ? "1" : " "), - (d->isOpal2() ? "2" : " "), (d->isEprise() ? "E" : " ")); + printf(" %s%s%s%s%s%s%s ", (d->isOpal1() ? "1" : " "), + (d->isOpal2() ? "2" : " "), (d->isEprise() ? "E" : " "), + (d->isOpalite() ? "L" : " "), (d->isPyrite1() ? "p" : " "), + (d->isPyrite2() ? "P" : " "), (d->isRuby1() ? "r" : " ")); else - printf("%s", " No "); + printf("%s", " No "); cout << d->getModelNum() << " " << d->getFirmwareRev() << std::endl; if (MAX_DISKS == i) { LOG(I) << MAX_DISKS << " disks, really?"; diff --git a/windows/PSIDRevert_WINDOWS.txt b/windows/PSIDRevert_WINDOWS.txt index 1a1fd7af..84179a34 100644 --- a/windows/PSIDRevert_WINDOWS.txt +++ b/windows/PSIDRevert_WINDOWS.txt @@ -49,7 +49,7 @@ OPAL 2.0 function (0x0203) Base comID = 0x1000, Initial PIN = 0x0 , Reverted PIN = 0x0 , comIDs = 1 Locking Admins = 4, Locking Users = 9, Range Crossing = N -U:\sedutil-cli\Release>sedutil-cli --yesIreallywanttoERASEALLmydatausingthePSID PSIDALLCAPSNODASHES \\.\PhysicalDrive3 +U:\sedutil-cli\Release>sedutil-cli --yesIreallywanttoERASE*ALL*mydatausingthePSID PSIDALLCAPSNODASHES \\.\PhysicalDrive3 - 01:59:13.000 INFO: Performing a PSID Revert on \\.\PhysicalDrive3 with password PSIDALLCAPSNODASHES - 01:59:13.171 INFO: revertTper completed successfully