Skip to content

Commit

Permalink
Minor changes related to code review
Browse files Browse the repository at this point in the history
  • Loading branch information
BTChip github committed Mar 22, 2022
1 parent 375eb1c commit d04ed9a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
#define P2_SHARED_SECRET 0x01

void decodeScalar(const uint8_t *scalarIn, uint8_t *scalarOut) {
uint8_t i;
for (i=0; i<32; i++) {
for (uint8_t i=0; i<32; i++) {
switch(i) {
case 0:
scalarOut[0] = (scalarIn[31] & 0x7f) | 0x40;
Expand All @@ -33,7 +32,6 @@ void handlePerformPrivacyOperation(uint8_t p1,
uint8_t privateKeyData[INT256_LENGTH];
uint8_t privateKeyDataSwapped[INT256_LENGTH];
uint32_t bip32Path[MAX_BIP32_PATH];
uint32_t i;
uint8_t bip32PathLength = *(dataBuffer++);
cx_err_t status = CX_OK;
if (p2 == P2_PUBLIC_ENCRYPTION_KEY) {
Expand All @@ -58,7 +56,7 @@ void handlePerformPrivacyOperation(uint8_t p1,
if ((p1 != P1_CONFIRM) && (p1 != P1_NON_CONFIRM)) {
THROW(0x6B00);
}
for (i = 0; i < bip32PathLength; i++) {
for (uint8_t i = 0; i < bip32PathLength; i++) {
bip32Path[i] = U4BE(dataBuffer, 0);
dataBuffer += 4;
}
Expand Down Expand Up @@ -105,7 +103,7 @@ void handlePerformPrivacyOperation(uint8_t p1,
"0x%.*s",
40,
tmpCtx.publicKeyContext.address);
for (i=0; i<32; i++) {
for (uint8_t i=0; i<32; i++) {
privateKeyData[i] = tmpCtx.publicKeyContext.publicKey.W[32 - i];
}
snprintf(strings.common.fullAmount, sizeof(strings.common.fullAmount) - 1, "%.*H", 32, privateKeyData);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#include "shared_context.h"

uint32_t set_result_perform_privacy_operation() {
uint32_t tx = 0, i;
for (i=0; i<32; i++) {
for (uint8_t i=0; i<32; i++) {
G_io_apdu_buffer[i] = tmpCtx.publicKeyContext.publicKey.W[32 - i];
}
tx = 32;
return tx;
return 32;
}

0 comments on commit d04ed9a

Please sign in to comment.