Skip to content

Commit d04ed9a

Browse files
committed
Minor changes related to code review
1 parent 375eb1c commit d04ed9a

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src_features/performPrivacyOperation/cmd_performPrivacyOperation.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
#define P2_SHARED_SECRET 0x01
99

1010
void decodeScalar(const uint8_t *scalarIn, uint8_t *scalarOut) {
11-
uint8_t i;
12-
for (i=0; i<32; i++) {
11+
for (uint8_t i=0; i<32; i++) {
1312
switch(i) {
1413
case 0:
1514
scalarOut[0] = (scalarIn[31] & 0x7f) | 0x40;
@@ -33,7 +32,6 @@ void handlePerformPrivacyOperation(uint8_t p1,
3332
uint8_t privateKeyData[INT256_LENGTH];
3433
uint8_t privateKeyDataSwapped[INT256_LENGTH];
3534
uint32_t bip32Path[MAX_BIP32_PATH];
36-
uint32_t i;
3735
uint8_t bip32PathLength = *(dataBuffer++);
3836
cx_err_t status = CX_OK;
3937
if (p2 == P2_PUBLIC_ENCRYPTION_KEY) {
@@ -58,7 +56,7 @@ void handlePerformPrivacyOperation(uint8_t p1,
5856
if ((p1 != P1_CONFIRM) && (p1 != P1_NON_CONFIRM)) {
5957
THROW(0x6B00);
6058
}
61-
for (i = 0; i < bip32PathLength; i++) {
59+
for (uint8_t i = 0; i < bip32PathLength; i++) {
6260
bip32Path[i] = U4BE(dataBuffer, 0);
6361
dataBuffer += 4;
6462
}
@@ -105,7 +103,7 @@ void handlePerformPrivacyOperation(uint8_t p1,
105103
"0x%.*s",
106104
40,
107105
tmpCtx.publicKeyContext.address);
108-
for (i=0; i<32; i++) {
106+
for (uint8_t i=0; i<32; i++) {
109107
privateKeyData[i] = tmpCtx.publicKeyContext.publicKey.W[32 - i];
110108
}
111109
snprintf(strings.common.fullAmount, sizeof(strings.common.fullAmount) - 1, "%.*H", 32, privateKeyData);
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
#include "shared_context.h"
22

33
uint32_t set_result_perform_privacy_operation() {
4-
uint32_t tx = 0, i;
5-
for (i=0; i<32; i++) {
4+
for (uint8_t i=0; i<32; i++) {
65
G_io_apdu_buffer[i] = tmpCtx.publicKeyContext.publicKey.W[32 - i];
76
}
8-
tx = 32;
9-
return tx;
7+
return 32;
108
}

0 commit comments

Comments
 (0)