diff --git a/scripts/prepare-devenv.sh b/scripts/prepare-devenv.sh index 0ed7214..2dee36d 100755 --- a/scripts/prepare-devenv.sh +++ b/scripts/prepare-devenv.sh @@ -2,7 +2,7 @@ set -e if [ -d clang-arm-fropi -a -d gcc-arm-none-eabi-5_3-2016q1 -a -d nanos-secure-sdk-f9e1c7b8904df2eee0ae7e603f552b876c169334 ]; then - echo "Devend is already prepared. Exiting." + echo "Devenv is already prepared. Exiting." exit fi diff --git a/src/signMessage.c b/src/signMessage.c index 1609f35..8b004c1 100644 --- a/src/signMessage.c +++ b/src/signMessage.c @@ -1,13 +1,14 @@ #include "signMessage.h" #include "os.h" #include "utils.h" +#include "blake2b.h" static char message[0xFC]; static uint32_t accountNumber; static uint8_t *data; static uint32_t dataLength; -static const char SIGN_MAGIC[] = "æternity Signed Message:\n"; +static const char SIGN_MAGIC[] = "aeternity Signed Message:\n"; static unsigned int io_seproxyhal_touch_signMessage_ok(const bagl_element_t *e) { uint8_t message[0xFC + sizeof(SIGN_MAGIC) - 1 + 2]; @@ -26,12 +27,10 @@ static unsigned int io_seproxyhal_touch_signMessage_ok(const bagl_element_t *e) os_memmove(message + messageLength, data, dataLength); messageLength += dataLength; - sign( - accountNumber, - message, - messageLength, - G_io_apdu_buffer - ); + uint8_t hash[32]; + blake2b(&hash, 32, message, messageLength); + + sign(accountNumber, hash, 32, G_io_apdu_buffer); sendResponse(64, true); return 0; // do not redraw the widget } diff --git a/src/signTransaction.c b/src/signTransaction.c index 7c68fb5..99903fb 100644 --- a/src/signTransaction.c +++ b/src/signTransaction.c @@ -11,7 +11,7 @@ static char payload[80]; static uint32_t accountNumber; static uint32_t remainTransactionLength; static char networkId[NETWORK_ID_MAX_LENGTH + 1]; -cx_blake2b_t hash; +static cx_blake2b_t hash; static txType transactionType; static void singAndSend() {