Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UUID #383

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

UUID #383

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 15 additions & 25 deletions LinuxPBA/GetPassPhrase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,34 +58,24 @@ char getch(void)
return getch_(0);
}

string GetPassPhrase(const char *prompt, bool show_asterisk)
string GetPassPhrase()
{
const char BACKSPACE=127;
const char RETURN=10;
FILE* uuid_file;
char ch;
string password;
unsigned char ch=0;
LOG(D4) << "Enter GetPassPhrase" << endl;
printf("\n\n%s",prompt);
while((ch=getch_())!=RETURN)
{
// LOG(I) << "key value" << (uint16_t) ch << endl;
if(ch==BACKSPACE)
{
if(password.length()!=0)
{
if(show_asterisk)
printf("\b \b");
password.resize(password.length()-1);
}
}
else if(ch!=27) // ignore 'escape' key
{
password+=ch;
if(show_asterisk)
printf("*");
}
uuid_file = fopen("/sys/devices/virtual/dmi/id/product_uuid", "r");
if(uuid_file) {
int len = 0;
while((ch = fgetc(uuid_file)) != EOF && ch != '\n' && len < 100) {
if(ch >= 'A' && ch <= 'Z') {
ch += 32;
}
password += ch;
++len;
}

} else {
printf("Cannot open\n");
}
return password;
}

Expand Down
2 changes: 1 addition & 1 deletion LinuxPBA/GetPassPhrase.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ along with sedutil. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#include <string>
using namespace std;
string GetPassPhrase(const char *prompt, bool show_asterisk=true);
string GetPassPhrase();
3 changes: 2 additions & 1 deletion LinuxPBA/LinuxPBA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ int main(int argc, char** argv) {
LOG(D4) << "Legacy PBA start" << endl;
// system ("tput clear");
printf("DTA LINUX Pre Boot Authorization \n");
string p = GetPassPhrase("Please enter pass-phrase to unlock OPAL drives: ");
printf("Test Version\n");
string p = GetPassPhrase();
UnlockSEDs((char *)p.c_str());
if (strcmp(p.c_str(), "debug")) {
printf("Starting OS \n");
Expand Down
2 changes: 1 addition & 1 deletion images/buildroot/package/sedutil/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ config BR2_PACKAGE_SEDUTIL
This package provides support for Self Encrypting Drives (SEDs)

https://DriveTrust.com/
https://github.com/Drive-Trust-Alliance/sedutil
https://github.com/ChiZhang0907/sedutil

comment "sedutil needs a toolchain w/ C++"
depends on !BR2_INSTALL_LIBSTDCPP
4 changes: 2 additions & 2 deletions images/conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# Setup versions for image components
# This script should be sourced by the other scripts
SYSLINUX=syslinux-6.03
#BUILDROOT=git://git.buildroot.net/buildroot
BUILDROOT=git@github.com:buildroot/buildroot.git
BUILDROOT=git://git.buildroot.net/buildroot
# BUILDROOT=git@github.com:buildroot/buildroot.git
BUILDROOT_TAG=2017.05.1