RPi: Add support for signing messages

This commit is contained in:
Marcelo Aquino
2016-10-18 22:11:47 -02:00
parent e3e285f996
commit ec1c209645
7 changed files with 312 additions and 4 deletions
+18
View File
@@ -64,6 +64,23 @@ static char i2h(uint8_t i)
}
}
#ifdef __linux__
static void DEBUG_SIGNING_PRINTBUF(const char *str, uint8_t* buf, uint8_t sz) {
static char printBuffer[300];
for (int i=0; i<sz; i++)
{
printBuffer[i * 2] = i2h(buf[i] >> 4);
printBuffer[(i * 2) + 1] = i2h(buf[i]);
}
printBuffer[sz * 2] = '\0';
debug(str);
if (sz > 0)
{
debug(printBuffer);
}
}
#else
static void DEBUG_SIGNING_PRINTBUF(const __FlashStringHelper* str, uint8_t* buf, uint8_t sz) {
static char printBuffer[300];
#ifdef MY_GATEWAY_FEATURE
@@ -88,6 +105,7 @@ static void DEBUG_SIGNING_PRINTBUF(const __FlashStringHelper* str, uint8_t* buf,
}
MY_SERIALDEVICE.println("");
}
#endif /* __linux__ */
#else
#define DEBUG_SIGNING_PRINTBUF(str, buf, sz)
#endif