Skip to content

Commit 0d31737

Browse files
authored
Merge pull request #180 from Zondax/fix_signature_candid
Fix signature candid
2 parents 0346a2b + 517c152 commit 0d31737

File tree

11 files changed

+13
-4
lines changed

11 files changed

+13
-4
lines changed

app/Makefile.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ APPVERSION_M=2
33
# This is the minor version of this release
44
APPVERSION_N=1
55
# This is the patch version of this release
6-
APPVERSION_P=6
6+
APPVERSION_P=7

app/src/crypto.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,14 @@ typedef struct {
149149
cx_hash(&ctx.header, CX_LAST, TMPDIGEST, CX_SHA256_SIZE, ENDDIGEST, CX_SHA256_SIZE); \
150150
}
151151

152+
#define HASH_BYTES_PTR_END(FIELDNAME, FIELDVALUE, TMPDIGEST, ENDDIGEST) { \
153+
MEMZERO(TMPDIGEST,sizeof(TMPDIGEST)); \
154+
cx_hash_sha256((uint8_t *)FIELDNAME, sizeof(FIELDNAME) - 1, TMPDIGEST, CX_SHA256_SIZE); \
155+
cx_hash(&ctx.header, 0, TMPDIGEST, CX_SHA256_SIZE, NULL, 0); \
156+
cx_hash_sha256((uint8_t *)(FIELDVALUE).dataPtr, (FIELDVALUE).len, TMPDIGEST, CX_SHA256_SIZE); \
157+
cx_hash(&ctx.header, CX_LAST, TMPDIGEST, CX_SHA256_SIZE, ENDDIGEST, CX_SHA256_SIZE); \
158+
}
159+
152160
zxerr_t crypto_getDigest(uint8_t *digest, txtype_e txtype){
153161
cx_sha256_t ctx;
154162
cx_sha256_init(&ctx);
@@ -168,7 +176,7 @@ zxerr_t crypto_getDigest(uint8_t *digest, txtype_e txtype){
168176
if(fields->has_nonce){
169177
HASH_BYTES_INTERMEDIATE("nonce", fields->nonce, tmpdigest);
170178
}
171-
HASH_BYTES_END("arg", fields->method_args, tmpdigest, digest);
179+
HASH_BYTES_PTR_END("arg", fields->method_args, tmpdigest, digest);
172180
return zxerr_ok;
173181
}
174182
case state_transaction_read: {

app/src/parser_impl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ parser_error_t readContent(CborValue *content_map, parser_tx_t *v) {
439439
} else {
440440
READ_STRING(content_map, "arg", fields->method_args)
441441
CHECK_PARSER_ERR(readPayload(v, fields->method_args.data, fields->method_args.len))
442+
fields->method_args.dataPtr = fields->method_args.data;
442443
}
443444

444445
} else if (strcmp(v->request_type.data, "read_state") == 0) {
-9 Bytes
Loading
-9 Bytes
Loading
-6 Bytes
Loading
-6 Bytes
Loading
-6 Bytes
Loading

0 commit comments

Comments
 (0)