From: Iceman Date: Fri, 24 Mar 2017 06:46:34 +0000 (+0100) Subject: Merge pull request #244 from marshmellow42/master X-Git-Tag: v3.0.0~38 X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/41f4bcabc6e44b9fb71414d4c5fb41fcd2dab7ea?hp=2b4898ec7152d275384956a75666bf54c592f963 Merge pull request #244 from marshmellow42/master fix lf file includes to include own .h --- diff --git a/client/util.c b/client/util.c index 7c70d55d..d07c915c 100644 --- a/client/util.c +++ b/client/util.c @@ -27,6 +27,7 @@ #ifndef _WIN32 #include #include +#include int ukbhit(void) { @@ -34,19 +35,18 @@ int ukbhit(void) int error; static struct termios Otty, Ntty; - - if ( tcgetattr( 0, &Otty) == -1 ) return -1; + if ( tcgetattr(STDIN_FILENO, &Otty) == -1 ) return -1; Ntty = Otty; - Ntty.c_iflag = 0; /* input mode */ - Ntty.c_oflag = 0; /* output mode */ - Ntty.c_lflag &= ~ICANON; /* raw mode */ - Ntty.c_cc[VMIN] = CMIN; /* minimum time to wait */ - Ntty.c_cc[VTIME] = CTIME; /* minimum characters to wait for */ - - if (0 == (error = tcsetattr(0, TCSANOW, &Ntty))) { - error += ioctl(0, FIONREAD, &cnt); - error += tcsetattr(0, TCSANOW, &Otty); + Ntty.c_iflag = 0x0000; // input mode + Ntty.c_oflag = 0x0000; // output mode + Ntty.c_lflag &= ~ICANON; // control mode = raw + Ntty.c_cc[VMIN] = 1; // return if at least 1 character is in the queue + Ntty.c_cc[VTIME] = 0; // no timeout. Wait forever + + if (0 == (error = tcsetattr(STDIN_FILENO, TCSANOW, &Ntty))) { // set new attributes + error += ioctl(STDIN_FILENO, FIONREAD, &cnt); // get number of characters availabe + error += tcsetattr(STDIN_FILENO, TCSANOW, &Otty); // reset attributes } return ( error == 0 ? cnt : -1 ); diff --git a/common/crapto1/crapto1.h b/common/crapto1/crapto1.h index e718b1f2..96ab96a2 100644 --- a/common/crapto1/crapto1.h +++ b/common/crapto1/crapto1.h @@ -25,7 +25,7 @@ extern "C" { #endif struct Crypto1State {uint32_t odd, even;}; -#if defined(__arm__) +#if defined(__arm__) && !defined(__linux__) && !defined(_WIN32) && !defined(__APPLE__) // bare metal ARM Proxmark lacks malloc()/free() void crypto1_create(struct Crypto1State *s, uint64_t key); #else struct Crypto1State *crypto1_create(uint64_t key); diff --git a/common/crapto1/crypto1.c b/common/crapto1/crypto1.c index a3f64a9f..61f6fe66 100644 --- a/common/crapto1/crypto1.c +++ b/common/crapto1/crypto1.c @@ -23,7 +23,7 @@ #define SWAPENDIAN(x)\ (x = (x >> 8 & 0xff00ff) | (x & 0xff00ff) << 8, x = x >> 16 | x << 16) -#if defined(__arm__) && !defined(__linux__) && !defined(_WIN32) // bare metal ARM lacks malloc()/free() +#if defined(__arm__) && !defined(__linux__) && !defined(_WIN32) && !defined(__APPLE__) // bare metal ARM Proxmark lacks malloc()/free() void crypto1_create(struct Crypto1State *s, uint64_t key) { int i;