Skip to content

Commit

Permalink
[fix][#38] Capital characters frequently and randomly lowered
Browse files Browse the repository at this point in the history
  • Loading branch information
lpascal-ledger committed Feb 27, 2024
1 parent 9293b49 commit d0a8456
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 5 deletions.
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.1.3] - 2024-??-??

### Fix

- Bug #38: some applications were randomly lowering capital characters, leading passwords containing
capital characters to be almost always wrong.

## [1.1.2] - 2023-10-12 (Stax only)

### Fix

- Updated porting to Stax SDK evolutions

## [1.1.1] - 2023-04-25 (Stax only)

### Fix

- Derivation path changed, from `44'/1` to `5265220'`

## [1.1.0] - 2023-04-12 (Stax only)

### Add

- Stax porting

## [1.0.2] - 2022-03-02

Original Passwords application
16 changes: 11 additions & 5 deletions src/password_typing.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ bool type_password(uint8_t *data,
uint32_t led_status;
uint8_t tmp[64];
uint8_t i;
uint8_t report[REPORT_SIZE];
uint8_t report[REPORT_SIZE] = {0};

cx_hash_sha256(data, dataSize, tmp, sizeof(tmp));
derive[0] = DERIVE_PASSWORD_PATH;
Expand All @@ -86,11 +86,10 @@ bool type_password(uint8_t *data,

generate_password(&ctx, setMask, minFromSet, tmp, size);

memset(report, 0, sizeof(report));
// Insert EMPTY_REPORT CAPS_REPORT EMPTY_REPORT to avoid undesired capital letter on KONSOLE
led_status = G_led_status;
usb_write_wait((uint8_t *) EMPTY_REPORT);

// Insert EMPTY_REPORT CAPS_REPORT EMPTY_REPORT to avoid undesired capital letter on KONSOLE
usb_write_wait((uint8_t *) EMPTY_REPORT);
usb_write_wait((uint8_t *) CAPS_REPORT);
usb_write_wait((uint8_t *) EMPTY_REPORT);

Expand All @@ -99,11 +98,17 @@ bool type_password(uint8_t *data,
usb_write_wait((uint8_t *) CAPS_LOCK_REPORT);
usb_write_wait((uint8_t *) EMPTY_REPORT);
}

for (i = 0; i < size; i++) {
// If keyboard layout not initialized, use the default
map_char(N_storage.keyboard_layout, tmp[i], report);

usb_write_wait(report);
usb_write_wait((uint8_t *) EMPTY_REPORT);
if (report[0] & SHIFT_KEY) {
usb_write_wait((uint8_t *) CAPS_REPORT);
} else {
usb_write_wait((uint8_t *) EMPTY_REPORT);
}

// for international keyboard, make sure to insert space after special symbols
if (N_storage.keyboard_layout == HID_MAPPING_QWERTY_INTL) {
Expand All @@ -120,6 +125,7 @@ bool type_password(uint8_t *data,
}
}
}
usb_write_wait((uint8_t *) EMPTY_REPORT);
// restore shift state
if (led_status & 2) {
usb_write_wait((uint8_t *) CAPS_LOCK_REPORT);
Expand Down

0 comments on commit d0a8456

Please sign in to comment.