Skip to content
Permalink
Browse files
Added additional byte for null termination in hex strings
  • Loading branch information
Midren committed Jun 17, 2020
1 parent 6d2c408 commit 9e797b1772eff5750933118b6cf1836b54ee4b2a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
@@ -425,7 +425,7 @@ void transaction_msgToSign(Transaction* self, uint8_t index, uint8_t* msg_digest
memcpy(&shaInput[32], (uint8_t*)&self->inAddress[index], 32);
#ifdef EMULATOR
#if EMULATOR
char str[128];
char str[129];
tohex(str, shaInput, 64);
printf("InnerHash computation on %s\n", str);
#endif
@@ -457,7 +457,7 @@ void TxSignCtx_printSHA256(TxSignContext* ctx) {
}

void TxSignCtx_printInnerHash(TxSignContext* ctx) {
char innerHash[64];
char innerHash[65];
tohex(innerHash,ctx->innerHash,32);
printf("Inner hash: %s\n",innerHash);
}
@@ -124,7 +124,7 @@ ErrCode_t msgSkycoinSignMessageImpl(SkycoinSignMessage *msg, ResponseSkycoinSign
// -> fail with an error
return ErrFailed;
}
const size_t hex_len = 2 * SKYCOIN_SIG_LEN;
const size_t hex_len = 2 * SKYCOIN_SIG_LEN + 1;
char signature_in_hex[hex_len];
tohex(signature_in_hex, signature, SKYCOIN_SIG_LEN);
memcpy(resp->signed_message, signature_in_hex, hex_len);
@@ -257,7 +257,7 @@ msgTransactionSignImpl(TransactionSign *msg, ErrCode_t (*funcConfirmTxn)(char *,
}
resp->signatures_count++;
#if EMULATOR
char str[64];
char str[65];
tohex(str, (uint8_t*)digest, 32);
printf("Signing message: %s\n", str);
printf("Signed message: %s\n", resp->signatures[i]);
@@ -269,7 +269,7 @@ msgTransactionSignImpl(TransactionSign *msg, ErrCode_t (*funcConfirmTxn)(char *,
return ErrFailed;
}
#if EMULATOR
char str[64];
char str[65];
tohex(str, transaction.innerHash, 32);
printf("InnerHash %s\n", str);
printf("Signed message: %s\n", resp->signatures[0]);

0 comments on commit 9e797b1

Please sign in to comment.