From 8cfa5da1ceceae3918f8d1c3443b75ea83012610 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Wed, 30 Jun 2021 15:41:16 +0200 Subject: [PATCH] docs: fix typos in comments [skip_ci] --- core/embed/extmod/modtrezorio/diskio.h | 4 ++-- core/embed/extmod/modtrezorio/ff.c | 12 ++++++------ core/embed/extmod/modtrezorio/ff.h | 2 +- core/embed/extmod/modtrezorio/ffconf.h | 2 +- core/embed/extmod/modtrezorui/display-stm32_T.h | 2 +- core/embed/extmod/modtrezorui/display.c | 2 +- core/embed/rust/src/micropython/list.rs | 2 +- core/embed/trezorhal/random_delays.c | 2 +- core/embed/trezorhal/usbd_conf.c | 4 ++-- core/embed/unix/flash.c | 2 +- core/embed/unix/sdcard.c | 2 +- core/src/apps/cardano/README.md | 2 +- core/src/apps/common/cbor.py | 4 ++-- core/src/apps/management/recovery_device/__init__.py | 2 +- core/src/apps/misc/get_ecdh_session_key.py | 2 +- .../apps/monero/signing/step_01_init_transaction.py | 2 +- core/src/apps/tezos/sign_tx.py | 2 +- core/src/apps/webauthn/README.md | 2 +- core/src/trezor/ui/__init__.py | 4 ++-- core/src/trezor/ui/components/common/text.py | 6 +++--- core/src/trezor/workflow.py | 2 +- legacy/bootloader/CHANGELOG.md | 2 +- legacy/bootloader/signatures.c | 2 +- legacy/firmware/u2f.c | 4 ++-- legacy/gen/bitmaps/generate.py | 2 +- legacy/usb_standard.c | 2 +- 26 files changed, 38 insertions(+), 38 deletions(-) diff --git a/core/embed/extmod/modtrezorio/diskio.h b/core/embed/extmod/modtrezorio/diskio.h index c931d25e7..bfc681967 100644 --- a/core/embed/extmod/modtrezorio/diskio.h +++ b/core/embed/extmod/modtrezorio/diskio.h @@ -1,7 +1,7 @@ // clang-format off /*-----------------------------------------------------------------------/ -/ Low level disk interface modlue include file (C)ChaN, 2019 / +/ Low level disk interface module include file (C)ChaN, 2019 / /-----------------------------------------------------------------------*/ #ifndef _DISKIO_DEFINED @@ -42,7 +42,7 @@ DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff); #define STA_PROTECT 0x04 /* Write protected */ -/* Command code for disk_ioctrl fucntion */ +/* Command code for disk_ioctrl function */ /* Generic command (Used by FatFs) */ #define CTRL_SYNC 0 /* Complete pending write process (needed at FF_FS_READONLY == 0) */ diff --git a/core/embed/extmod/modtrezorio/ff.c b/core/embed/extmod/modtrezorio/ff.c index 6e747433f..415849999 100644 --- a/core/embed/extmod/modtrezorio/ff.c +++ b/core/embed/extmod/modtrezorio/ff.c @@ -1319,7 +1319,7 @@ static void gen_numname ( seq = (UINT)sreg; } - /* itoa (hexdecimal) */ + /* itoa (hexadecimal) */ i = 7; do { c = (BYTE)((seq % 16) + '0'); @@ -1628,7 +1628,7 @@ static void get_fileinfo ( fno->altname[di] = 0; /* Terminate the SFN (null string means SFN is invalid) */ if (fno->fname[0] == 0) { /* If LFN is invalid, altname[] needs to be copied to fname[] */ - if (di == 0) { /* If LFN and SFN both are invalid, this object is inaccesible */ + if (di == 0) { /* If LFN and SFN both are invalid, this object is inaccessible */ fno->fname[di++] = '?'; } else { for (si = di = 0, lcf = NS_BODY; fno->altname[si]; si++, di++) { /* Copy altname[] to fname[] with case information */ @@ -1987,7 +1987,7 @@ static FRESULT mount_volume ( /* FR_OK(0): successful, !=0: an error occurred */ /* Find an FAT volume on the drive */ fmt = find_volume(fs, LD2PT(vol)); - if (fmt == 4) return FR_DISK_ERR; /* An error occured in the disk I/O layer */ + if (fmt == 4) return FR_DISK_ERR; /* An error occurred in the disk I/O layer */ if (fmt >= 2) return FR_NO_FILESYSTEM; /* No FAT volume is found */ bsect = fs->winsect; /* Volume location */ @@ -2218,7 +2218,7 @@ FRESULT f_open ( } } else { /* Open an existing file */ - if (res == FR_OK) { /* Is the object exsiting? */ + if (res == FR_OK) { /* Is the object existing? */ if (dj.obj.attr & AM_DIR) { /* File open against a directory */ res = FR_NO_FILE; } else { @@ -2654,7 +2654,7 @@ FRESULT f_opendir ( FREE_NAMBUF(); if (res == FR_NO_FILE) res = FR_NO_PATH; } - if (res != FR_OK) dp->obj.fs = 0; /* Invalidate the directory object if function faild */ + if (res != FR_OK) dp->obj.fs = 0; /* Invalidate the directory object if function failed */ LEAVE_FF(fs, res); } @@ -2986,7 +2986,7 @@ FRESULT f_mkdir ( st_clust(fs, fs->win + SZDIRE, pcl); fs->wflag = 1; } - res = dir_register(&dj); /* Register the object to the parent directoy */ + res = dir_register(&dj); /* Register the object to the parent directory */ } } if (res == FR_OK) { diff --git a/core/embed/extmod/modtrezorio/ff.h b/core/embed/extmod/modtrezorio/ff.h index 62e4092ce..434282c15 100644 --- a/core/embed/extmod/modtrezorio/ff.h +++ b/core/embed/extmod/modtrezorio/ff.h @@ -252,7 +252,7 @@ typedef struct { WORD ftime; /* Modified time */ BYTE fattrib; /* File attribute */ #if FF_USE_LFN - TCHAR altname[FF_SFN_BUF + 1];/* Altenative file name */ + TCHAR altname[FF_SFN_BUF + 1];/* Alternative file name */ TCHAR fname[FF_LFN_BUF + 1]; /* Primary file name */ #else TCHAR fname[12 + 1]; /* File name */ diff --git a/core/embed/extmod/modtrezorio/ffconf.h b/core/embed/extmod/modtrezorio/ffconf.h index 65424d93c..8e127d2c9 100644 --- a/core/embed/extmod/modtrezorio/ffconf.h +++ b/core/embed/extmod/modtrezorio/ffconf.h @@ -189,7 +189,7 @@ / number and only an FAT volume found on the physical drive will be mounted. / When this function is enabled (1), each logical drive number can be bound to / arbitrary physical drive and partition listed in the VolToPart[]. Also f_fdisk() -/ funciton will be available. */ +/ function will be available. */ #define FF_MIN_SS 512 diff --git a/core/embed/extmod/modtrezorui/display-stm32_T.h b/core/embed/extmod/modtrezorui/display-stm32_T.h index b5bb8379f..5843b0038 100644 --- a/core/embed/extmod/modtrezorui/display-stm32_T.h +++ b/core/embed/extmod/modtrezorui/display-stm32_T.h @@ -467,7 +467,7 @@ void display_init_seq(void) { } void display_init(void) { - // init peripherials + // init peripherals __HAL_RCC_GPIOE_CLK_ENABLE(); __HAL_RCC_TIM1_CLK_ENABLE(); __HAL_RCC_FMC_CLK_ENABLE(); diff --git a/core/embed/extmod/modtrezorui/display.c b/core/embed/extmod/modtrezorui/display.c index aebf4739e..79968b7b5 100644 --- a/core/embed/extmod/modtrezorui/display.c +++ b/core/embed/extmod/modtrezorui/display.c @@ -349,7 +349,7 @@ void display_icon(int x, int y, int w, int h, const void *data, } } -// see docs/misc/toif.md for defintion of the TOIF format +// see docs/misc/toif.md for definition of the TOIF format bool display_toif_info(const uint8_t *data, uint32_t len, uint16_t *out_w, uint16_t *out_h, bool *out_grayscale) { if (len < 12 || memcmp(data, "TOI", 3) != 0) { diff --git a/core/embed/rust/src/micropython/list.rs b/core/embed/rust/src/micropython/list.rs index 28120bf89..23882d50c 100644 --- a/core/embed/rust/src/micropython/list.rs +++ b/core/embed/rust/src/micropython/list.rs @@ -8,7 +8,7 @@ pub type List = ffi::mp_obj_list_t; impl List { pub fn alloc(values: &[Obj]) -> Gc { - // SAFETY: Altough `values` are copied into the new list and not mutated, + // SAFETY: Although `values` are copied into the new list and not mutated, // `mp_obj_new_list` is taking them through a mut pointer. unsafe { let list = ffi::mp_obj_new_list(values.len(), values.as_ptr() as *mut Obj); diff --git a/core/embed/trezorhal/random_delays.c b/core/embed/trezorhal/random_delays.c index f83be9ba8..6ad90b71e 100644 --- a/core/embed/trezorhal/random_delays.c +++ b/core/embed/trezorhal/random_delays.c @@ -18,7 +18,7 @@ */ /* -Random delay interrupts (RDI) is a contermeasure agains side channel attacks. It +Random delay interrupts (RDI) is a contermeasure against side channel attacks. It consists of an interrupt handler that is supposed to be called every millisecond or so. The handler waits for a random number of cpu ticks that is a sample of so called floating mean distribution. That means that the number is the sum of two diff --git a/core/embed/trezorhal/usbd_conf.c b/core/embed/trezorhal/usbd_conf.c index e54935751..c9b45e3df 100644 --- a/core/embed/trezorhal/usbd_conf.c +++ b/core/embed/trezorhal/usbd_conf.c @@ -646,10 +646,10 @@ USBD_StatusTypeDef USBD_LL_PrepareReceive(USBD_HandleTypeDef *pdev, } /** - * @brief Returns the last transfered packet size. + * @brief Returns the last transferred packet size. * @param pdev: Device handle * @param ep_addr: Endpoint Number - * @retval Recived Data Size + * @retval Received Data Size */ uint32_t USBD_LL_GetRxDataSize(USBD_HandleTypeDef *pdev, uint8_t ep_addr) { diff --git a/core/embed/unix/flash.c b/core/embed/unix/flash.c index 30f7ab5a4..7af3e11bf 100644 --- a/core/embed/unix/flash.c +++ b/core/embed/unix/flash.c @@ -106,7 +106,7 @@ void flash_init(void) { struct stat sb; int r = stat(FLASH_FILE, &sb); - // (re)create if non existant or wrong size + // (re)create if non existent or wrong size if (r != 0 || sb.st_size != FLASH_SIZE) { int fd = open(FLASH_FILE, O_RDWR | O_CREAT | O_TRUNC, (mode_t)0600); ensure(sectrue * (fd >= 0), "open failed"); diff --git a/core/embed/unix/sdcard.c b/core/embed/unix/sdcard.c index 46cc5b0f2..c06e7a3b4 100644 --- a/core/embed/unix/sdcard.c +++ b/core/embed/unix/sdcard.c @@ -55,7 +55,7 @@ void sdcard_init(void) { int r = stat(SDCARD_FILE, &sb); int should_clear = 0; - // (re)create if non existant or wrong size + // (re)create if non existent or wrong size if (r != 0 || sb.st_size != SDCARD_SIZE) { int fd = open(SDCARD_FILE, O_RDWR | O_CREAT | O_TRUNC, (mode_t)0600); ensure(sectrue * (fd >= 0), "open failed"); diff --git a/core/src/apps/cardano/README.md b/core/src/apps/cardano/README.md index fc52f89bc..24e9a50ff 100644 --- a/core/src/apps/cardano/README.md +++ b/core/src/apps/cardano/README.md @@ -32,7 +32,7 @@ _Current mainnet network id:_ 1 ## Key types -In Shelley two types of keys are used. Payment key and staking key. Payment keys are derived from _m/1852'/1815'/x/[0,1]/y_ paths and are used for holding/transfering funds. Staking keys are derived from _m/1852'/1815'/x/2/0_ paths, thus there is only one staking key per account. They are used for staking operations - certificates, withdrawals. Shelley addresses are built from the combination of hashes of these keys. +In Shelley two types of keys are used. Payment key and staking key. Payment keys are derived from _m/1852'/1815'/x/[0,1]/y_ paths and are used for holding/transferring funds. Staking keys are derived from _m/1852'/1815'/x/2/0_ paths, thus there is only one staking key per account. They are used for staking operations - certificates, withdrawals. Shelley addresses are built from the combination of hashes of these keys. ## Addresses diff --git a/core/src/apps/common/cbor.py b/core/src/apps/common/cbor.py index b2bdc1333..f82795056 100644 --- a/core/src/apps/common/cbor.py +++ b/core/src/apps/common/cbor.py @@ -58,7 +58,7 @@ def _header(typ: int, l: int) -> bytes: elif l < 2 ** 64: return struct.pack(">BQ", typ + 27, l) else: - raise NotImplementedError("Length %d not suppported" % l) + raise NotImplementedError("Length %d not supported" % l) def _cbor_encode(value: Value) -> Iterator[bytes]: @@ -128,7 +128,7 @@ def _read_length(r: utils.BufferReader, aux: int) -> int: elif aux == _CBOR_UINT64_FOLLOWS: return readers.read_uint64_be(r) else: - raise NotImplementedError("Length %d not suppported" % aux) + raise NotImplementedError("Length %d not supported" % aux) def _cbor_decode(r: utils.BufferReader) -> Value: diff --git a/core/src/apps/management/recovery_device/__init__.py b/core/src/apps/management/recovery_device/__init__.py index 94a58f7e3..f00a1bc66 100644 --- a/core/src/apps/management/recovery_device/__init__.py +++ b/core/src/apps/management/recovery_device/__init__.py @@ -28,7 +28,7 @@ DRY_RUN_ALLOWED_FIELDS = ("dry_run", "word_count", "enforce_wordlist", "type") async def recovery_device(ctx: wire.Context, msg: RecoveryDevice) -> Success: """ Recover BIP39/SLIP39 seed into empty device. - Recovery is also possible with replugged Trezor. We call this process Persistance. + Recovery is also possible with replugged Trezor. We call this process Persistence. User starts the process here using the RecoveryDevice msg and then they can unplug the device anytime and continue without a computer. """ diff --git a/core/src/apps/misc/get_ecdh_session_key.py b/core/src/apps/misc/get_ecdh_session_key.py index 4626c9b07..8091712fb 100644 --- a/core/src/apps/misc/get_ecdh_session_key.py +++ b/core/src/apps/misc/get_ecdh_session_key.py @@ -17,7 +17,7 @@ if False: from apps.common.paths import Bip32Path # This module implements the SLIP-0017 Elliptic Curve Diffie-Hellman algorithm, using a -# determinstic hierarchy, see https://github.com/satoshilabs/slips/blob/master/slip-0017.md. +# deterministic hierarchy, see https://github.com/satoshilabs/slips/blob/master/slip-0017.md. async def get_ecdh_session_key( diff --git a/core/src/apps/monero/signing/step_01_init_transaction.py b/core/src/apps/monero/signing/step_01_init_transaction.py index 5049cf622..71328dc9d 100644 --- a/core/src/apps/monero/signing/step_01_init_transaction.py +++ b/core/src/apps/monero/signing/step_01_init_transaction.py @@ -71,7 +71,7 @@ async def init_transaction( # Ensure change is correct _check_change(state, tsx_data.outputs) - # At least two outpus are required, this applies also for sweep txs + # At least two outputs are required, this applies also for sweep txs # where one fake output is added. See _check_change for more info if state.output_count < 2: raise signing.NotEnoughOutputsError("At least two outputs are required") diff --git a/core/src/apps/tezos/sign_tx.py b/core/src/apps/tezos/sign_tx.py index 16bdf2606..4f0ec4dc5 100644 --- a/core/src/apps/tezos/sign_tx.py +++ b/core/src/apps/tezos/sign_tx.py @@ -23,7 +23,7 @@ async def sign_tx(ctx, msg, keychain): node = keychain.derive(msg.address_n) if msg.transaction is not None: - # if the tranasction oprtation is used to execute code on a smart contract + # if the transaction operation is used to execute code on a smart contract if msg.transaction.parameters_manager is not None: parameters_manager = msg.transaction.parameters_manager diff --git a/core/src/apps/webauthn/README.md b/core/src/apps/webauthn/README.md index f0ac535ec..608f8da02 100644 --- a/core/src/apps/webauthn/README.md +++ b/core/src/apps/webauthn/README.md @@ -31,7 +31,7 @@ Credential selection is supported directly on the device. The `authenticatorGetN * COSE algorithm ES256 (-7): ECDSA using the NIST P-256 curve with SHA-256. * COSE algorithm EdDSA (-8): Pure EdDSA using the Ed25519 curve. -### Extenstions +### Extensions * hmac-secret extension. diff --git a/core/src/trezor/ui/__init__.py b/core/src/trezor/ui/__init__.py index 997be3c9e..857b0ad2a 100644 --- a/core/src/trezor/ui/__init__.py +++ b/core/src/trezor/ui/__init__.py @@ -187,7 +187,7 @@ def grid( spacing: int = 0, # spacing size between cells ) -> Area: """ - Returns area (tuple of four integers, in pixels) of a cell on i-th possition + Returns area (tuple of four integers, in pixels) of a cell on i-th position in a table you define yourself. Example: >>> ui.grid(4, n_x=2, n_y=3, start_x=20, start_y=20) @@ -219,7 +219,7 @@ RENDER = const(-255) # Event dispatched when components should mark themselves for re-painting. REPAINT = const(-256) -# How long, in milliseconds, should the layout rendering task sleep betweeen +# How long, in milliseconds, should the layout rendering task sleep between # the render calls. _RENDER_DELAY_MS = const(10) diff --git a/core/src/trezor/ui/components/common/text.py b/core/src/trezor/ui/components/common/text.py index 837277e8d..5e2bfd230 100644 --- a/core/src/trezor/ui/components/common/text.py +++ b/core/src/trezor/ui/components/common/text.py @@ -206,11 +206,11 @@ def render_text( if false, the trailing "..." is not shown. This is useful when the rendered text is in fact paginated. - `font` specifies the default font, but that can be overriden by font instructions + `font` specifies the default font, but that can be overridden by font instructions in `items`. - `fg` specifies default foreground color, which can also be overriden by instructions + `fg` specifies default foreground color, which can also be overridden by instructions in `items`. - `bg` specifies background color. This cannot be overriden. + `bg` specifies background color. This cannot be overridden. `offset_x` and `offset_y` specify starting XY position of the text bounding box. `line_width` specifies width of the bounding box. Height of the bounding box is diff --git a/core/src/trezor/workflow.py b/core/src/trezor/workflow.py index df6ae408e..c0b2c5be3 100644 --- a/core/src/trezor/workflow.py +++ b/core/src/trezor/workflow.py @@ -9,7 +9,7 @@ if False: IdleCallback = Callable[[], None] if __debug__: - # Used in `on_close` bellow for memory statistics. + # Used in `on_close` below for memory statistics. import micropython diff --git a/legacy/bootloader/CHANGELOG.md b/legacy/bootloader/CHANGELOG.md index f20061702..65b970a62 100644 --- a/legacy/bootloader/CHANGELOG.md +++ b/legacy/bootloader/CHANGELOG.md @@ -85,7 +85,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed - Clean USB descriptor. - Return firmware_present in Features response. -- Don't halt on broken firware, stay in bootloader. +- Don't halt on broken firmware, stay in bootloader. ## 1.2.8 [September 2016] diff --git a/legacy/bootloader/signatures.c b/legacy/bootloader/signatures.c index 20d0cce80..d18345644 100644 --- a/legacy/bootloader/signatures.c +++ b/legacy/bootloader/signatures.c @@ -102,7 +102,7 @@ int signatures_old_ok(void) { } if (0 != ecdsa_verify_digest(&secp256k1, pubkey[sigindex3 - 1], (const uint8_t *)FLASH_META_SIG3, - hash)) { // failture + hash)) { // failure return SIG_FAIL; } diff --git a/legacy/firmware/u2f.c b/legacy/firmware/u2f.c index 786aee2bb..cd15213cb 100644 --- a/legacy/firmware/u2f.c +++ b/legacy/firmware/u2f.c @@ -240,7 +240,7 @@ void u2fhid_read_start(const U2FHID_FRAME *f) { break; } - // wait for next commmand/ button press + // wait for next command/button press reader->cmd = 0; reader->seq = 255; while (dialog_timeout > 0 && reader->cmd == 0) { @@ -644,7 +644,7 @@ void u2f_register(const APDU *a) { return; } - // Didnt expect to get here + // Didn't expect to get here dialog_timeout = 0; } diff --git a/legacy/gen/bitmaps/generate.py b/legacy/gen/bitmaps/generate.py index 3c6904ec7..bbe7963de 100755 --- a/legacy/gen/bitmaps/generate.py +++ b/legacy/gen/bitmaps/generate.py @@ -25,7 +25,7 @@ for fn in sorted(glob.glob("*.png")): name = os.path.splitext(fn)[0] w, h = im.size if w % 8 != 0: - raise Exception("Width must be divisable by 8! (%s is %dx%d)" % (fn, w, h)) + raise Exception("Width must be divisible by 8! (%s is %dx%d)" % (fn, w, h)) img = list(im.getdata()) hdrs.append("extern const BITMAP bmp_%s;\n" % name) imgs.append("const BITMAP bmp_%s = {%d, %d, bmp_%s_data};\n" % (name, w, h, name)) diff --git a/legacy/usb_standard.c b/legacy/usb_standard.c index fba2455f6..25a8c1fde 100644 --- a/legacy/usb_standard.c +++ b/legacy/usb_standard.c @@ -198,7 +198,7 @@ usb_standard_get_descriptor(usbd_device *usbd_dev, return USBD_REQ_NOTSUPP; } - /* Strings with Language ID differnet from + /* Strings with Language ID different from * USB_LANGID_ENGLISH_US are not supported */ if (req->wIndex != USB_LANGID_ENGLISH_US) { return USBD_REQ_NOTSUPP;