60 Commits

Author SHA1 Message Date
radim.karnis
a7df5d3bee bugfix: Adjust wrapper scripts to not import themselves 2023-05-22 14:37:02 +00:00
radim.karnis
45c511de74 bugfix: Prevent importing wrapper scripts instead of modules
Closes https://github.com/espressif/esptool/issues/740

Closes https://github.com/espressif/esptool/pull/742
2022-05-24 09:10:55 +02:00
radim.karnis
30821a3f93 Make esptool callable as esptool.py even on Unix systems 2022-05-05 22:22:17 +02:00
radim.karnis
45f1da954e refactoring: Employ Black code formatting 2022-03-28 23:06:34 +02:00
radim.karnis
513898db2a refactoring: Restructure espefuse and espsecure 2022-03-28 23:05:04 +02:00
radim.karnis
aee798dbe4 refactoring: Separate executable logic 2022-03-28 23:05:04 +02:00
radim.karnis
4875e8906f refactoring: Initial structure 2022-03-28 23:05:02 +02:00
Sachin Parekh
8fa1f76ad7 espsecure.py: Support for XTS_AES_128 using 128 bit key FE scheme 2022-02-17 07:45:16 +00:00
Sachin Parekh
84f0e954fc espsecure: Refine SBV2 ECC support
- Added test cases for newly introduced schemes
2022-02-17 07:45:16 +00:00
Angus Gratton
4bacc83294 espsecure: Extend Secure Boot V2 sign & verify to support ECDSA P192 & P256 signatures 2022-02-17 07:45:16 +00:00
radim.karnis
aa608227b5 Update copyright dates 2022-01-10 11:29:08 +01:00
Roland Dobai
269c38f908 Update license headers in the short SPDX format 2021-10-26 15:59:35 +02:00
Yegor Yefremov
df13de2788 Replace license header and copyright information with SPDX identifiers
This approach follows the one suggested by REUSE project.

https://reuse.software/spec/

Closes https://github.com/espressif/esptool/pull/476
2021-10-26 14:01:55 +02:00
Marius Vikhammer
823fc7dd4f espefuse: add support for 512bit XTS_AES flash encryption key 2021-09-14 18:32:59 +08:00
Marius Vikhammer
e87c43068d espsecure: add option for 512bit key for encrypt_flash_data 2021-07-13 16:48:56 +08:00
Gnought
8438f69501 Fix to properly extract SecureBoot v2 public key
Closes https://github.com/espressif/esptool/pull/623
2021-04-27 18:12:46 +08:00
Roland Dobai
fc17800906 espsecure: Don't allow empty output and re-writing input 2021-01-22 17:27:29 +01:00
Marius Vikhammer
692a0fce38 espsecure: add aes_xts decrypt subarg 2021-01-14 14:30:23 +08:00
Marius Vikhammer
b519b9e146 espsecure: add command for encrypting file with AES-XTS
C3 and S2 uses AES-XTS for flash encryption. This MR adds --aes-xts
argument for encrypt_flash_data for encrypting files with this algorithm
2021-01-05 12:29:48 +08:00
radim.karnis
dd97d7cb68 Added custom commandline arg to main
Closes https://github.com/espressif/esptool/issues/563
2020-12-16 17:47:27 +01:00
Supreet Deshpande
3bba49f7fc Fix signature_info_v2 option for python3 2020-10-06 07:42:00 +08:00
Angus Gratton
07c1c8370e flake8: Update files to pass all flake8 conditions, including plugins and some previously excluded warnings 2020-10-05 11:55:15 +11:00
KonstantinKondrashov
05f142110a espsecure: Fix the byte order for digest_rsa_public_key 2020-09-21 15:12:23 +08:00
Angus Gratton
c67e07943b espsecure: Fix 'espsecure.py generate_signing_key --version 2' under Python 3 2020-07-23 13:53:54 +08:00
Angus Gratton
746023b5db espsecure: Replace vendored pyaes (and optional pycrypto) with pyca-cryptography
Performance significantly improves over pyaes, roughly the same as pycrypto

pyca-cryptography is already a dependency of espsecure

Progress towards https://github.com/espressif/esptool/issues/414
2020-06-18 09:47:35 +10:00
Supreet Deshpande
87286f90f4 Added an option to view secure boot v2 signature block information 2020-05-07 13:01:58 +05:30
Supreet Deshpande
3dfe2b1e59 feat/secure_boot_v2_s2: Support for secure boot v2 for esp32s2 2020-04-27 10:44:18 +05:30
Supreet Deshpande
9f87460a29 feat/eco3_secure_boot_v2: Update Secure Boot V2 utilities 2020-02-21 17:22:06 +11:00
Angus Gratton
6ba165d802 espefuse/espsecure: Small fixes to secure boot v2 utilities 2020-01-30 11:22:36 +05:30
Angus Gratton
0a0f83b28f espefuse: Support burning key digest for Secure Boot V2 2020-01-30 11:22:36 +05:30
Angus Gratton
4817237dc4 WIP Secure Boot V2 signing support 2020-01-30 11:22:36 +05:30
Angus Gratton
efb55ac15c Revert "fix/pad_secure_boot_signed_binary: 16 byte align the app/part table bins."
This reverts commit 5ec16a4f55.

Not possible to pad the current binary signature format and also use
espsecure.py verify.
2020-01-02 18:06:05 +11:00
Supreet Deshpande
5ec16a4f55 fix/pad_secure_boot_signed_binary: 16 byte align the app/part table bins.
Description:
Unsigned binaries are 16 byte aligned. Adding secure boot version 1 signature(68 bytes) misaligns them. Flash encryption requires 16 bytes of chunks to encrypt.
During OTA with SB+FE the last chunk is not 16 byte aligned and can result in FE error.
Thus, Padding 12 bytes of 0xFF to ensure 16 byte alignment.

Padding also added to parition table as it is signed but is inconsequential.
2019-11-18 18:53:41 +05:30
Rafael Vuijk
abfacc0f99 espsecure: improve encryption speed
Cherry-picked from https://github.com/espressif/esptool/pull/416

* Try to use Crypto.Cipher.AES since it should be faster than pyaes.
* Use bignum and iterate through address bits instead of key bits.
* Correct bit order in _flash_encryption_tweak_range_bits. Correct style.
* espsecure: Make key tweak in parallel in python3

  We can calculate this all with some giant multiplies if we recognize
  that the bits are always contiguous regions of bits except for the two
  truncated ones.  This takes away the manual check for each bit position.

* espsecure: Only perform int.from_bytes(...) once per encryption

  This saves time overall.

* espsecure: Remove input_fole.tell() invocation

  It turns out that invoking this in each loop results in a system call,
  at least in Linux.  This reduces the overhead of this routine by removing
  these extraneous system calls.
2019-07-11 17:56:11 +10:00
Angus Gratton
c583756c11 espsecure: Add --keylen option to generate_flash_encryption_key for 3/4 Coding Scheme
Also change internal representation from string to int.
2019-04-24 17:52:33 +10:00
Angus Gratton
fbd8c865e5 espsecure: Fix flash_encrypt_data / flash_decrypt_data on Python 3
Closes https://github.com/espressif/esptool/issues/369
2018-12-20 17:11:52 +11:00
Angus Gratton
d978421db9 espsecure: Add support and tests for using verify_signature with binary public key file
Previously, keyfile could only be in PEM format

Closes https://github.com/espressif/esptool/issues/357
2018-12-20 17:11:52 +11:00
Angus Gratton
955ee9b18b espsecure: Fix verify_signature (regression in 8305193b44)
Closes https://github.com/espressif/esptool/issues/374
2018-12-20 14:58:54 +11:00
Angus Gratton
057a7e2d84 espsecure digest_secure_bootloader: Fix Python 3 string vs bytes usage
Closes https://github.com/espressif/esptool/issues/382
2018-12-20 14:16:44 +11:00
Angus Gratton
f262eacbc0 espsecure encrypt_data: Making padding a 'note' rather than a a 'WARNING' 2018-12-18 09:49:46 +11:00
Angus Gratton
8305193b44 espsecure.py: Add support for 192 bit key operations on the host:
* encrypt_flash_data
* decrypt_flash_data
* digest_private_key
2018-10-12 13:18:48 +11:00
Angus Gratton
86094717dd espsecure: Fix bug in digest_secure_bootloader() producing incorrect digest
ROM bootloader ignores any part of the appended SHA-256 digest
after the last 128 byte block.
2018-07-17 15:21:31 +10:00
Angus Gratton
754f81aa35 Merge pull request #233 from Cabalist/import_cleanup
PEP8 imports  Remove unused import statements.
2017-10-24 12:58:40 +08:00
Angus Gratton
ab23d5d52a Remove bare except: statements
New requirement of pycodestyle
2017-10-24 12:57:08 +08:00
Milan Kupcevic
f4bd22b4db correct espsecure.py command name 2017-10-23 23:48:46 -04:00
Ryan Jarvis
fa7e37aa4c PEP8 imports (https://www.python.org/dev/peps/pep-0008/#imports). Remove unused import statements. 2017-09-17 12:22:03 -07:00
Miro Hrončok
476128901e Display usage information when no arguments are provided
Previously a traceback was shown instead.

Fixes https://github.com/espressif/esptool/issues/211
2017-06-22 11:54:55 +02:00
Angus Gratton
1ff7ee801d especure & espefuse: Fix pyflakes future failures 2017-04-24 15:01:41 +10:00
M Hickford
d291846bb4 In setup.py specify console_scripts rather than scripts.
This is preferable cross-platform compatibility. See https://packaging.python.org/distributing/#scripts and https://setuptools.readthedocs.io/en/latest/setuptools.html#automatic-script-creation.

Fixes https://github.com/espressif/esptool/issues/181
2017-03-06 08:27:17 +00:00
Angus Gratton
7f4dda26b4 Update README for esptool.py v2.0 2017-01-09 17:59:58 +11:00