mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
components: convert string to bytes to fix TypeError There is a string passed as an argument for function, but a format of a string seemingly refers to bytes therefore it needs to be converted to bytes Solves https://esp32.com/viewtopic.php?f=13&t=16529
(cherry picked from commit cb0bdb8bba
)
This commit is contained in:
parent
53605395cf
commit
2595326978
@ -786,7 +786,7 @@ def decrypt(args):
|
|||||||
page_num = 0
|
page_num = 0
|
||||||
page_max_size = 4096
|
page_max_size = 4096
|
||||||
start_entry_offset = 0
|
start_entry_offset = 0
|
||||||
empty_data_entry = bytearray('\xff') * 32
|
empty_data_entry = bytearray(b'\xff') * nvs_read_bytes
|
||||||
|
|
||||||
# Check if key file has .bin extension
|
# Check if key file has .bin extension
|
||||||
input_files = [args.input, args.key, args.output]
|
input_files = [args.input, args.key, args.output]
|
||||||
|
@ -2881,6 +2881,36 @@ TEST_CASE("test nvs apis for nvs partition generator utility with encryption ena
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("test decrypt functionality for encrypted data", "[nvs_part_gen]")
|
||||||
|
{
|
||||||
|
|
||||||
|
//retrieving the temporary test data
|
||||||
|
int status = system("cp -rf ../nvs_partition_generator/testdata .");
|
||||||
|
CHECK(status == 0);
|
||||||
|
|
||||||
|
//encoding data from sample_multipage_blob.csv
|
||||||
|
status = system("python ../nvs_partition_generator/nvs_partition_gen.py generate ../nvs_partition_generator/sample_multipage_blob.csv partition_encoded.bin 0x5000 --outdir ../nvs_partition_generator");
|
||||||
|
CHECK(status == 0);
|
||||||
|
|
||||||
|
//encrypting data from sample_multipage_blob.csv
|
||||||
|
status = system("python ../nvs_partition_generator/nvs_partition_gen.py encrypt ../nvs_partition_generator/sample_multipage_blob.csv partition_encrypted.bin 0x5000 --inputkey ../nvs_partition_generator/testdata/sample_encryption_keys.bin --outdir ../nvs_partition_generator");
|
||||||
|
CHECK(status == 0);
|
||||||
|
|
||||||
|
//decrypting data from partition_encrypted.bin
|
||||||
|
status = system("python ../nvs_partition_generator/nvs_partition_gen.py decrypt ../nvs_partition_generator/partition_encrypted.bin ../nvs_partition_generator/testdata/sample_encryption_keys.bin ../nvs_partition_generator/partition_decrypted.bin");
|
||||||
|
CHECK(status == 0);
|
||||||
|
|
||||||
|
status = system("diff ../nvs_partition_generator/partition_decrypted.bin ../nvs_partition_generator/partition_encoded.bin");
|
||||||
|
CHECK(status == 0);
|
||||||
|
CHECK(WEXITSTATUS(status) == 0);
|
||||||
|
|
||||||
|
|
||||||
|
//cleaning up the temporary test data
|
||||||
|
status = system("rm -rf testdata");
|
||||||
|
CHECK(status == 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("test nvs apis for nvs partition generator utility with encryption enabled using keygen", "[nvs_part_gen]")
|
TEST_CASE("test nvs apis for nvs partition generator utility with encryption enabled using keygen", "[nvs_part_gen]")
|
||||||
{
|
{
|
||||||
int childpid = fork();
|
int childpid = fork();
|
||||||
|
@ -59,7 +59,7 @@ test_nvs_on_host:
|
|||||||
extends: .host_test_template
|
extends: .host_test_template
|
||||||
script:
|
script:
|
||||||
- cd components/nvs_flash/test_nvs_host
|
- cd components/nvs_flash/test_nvs_host
|
||||||
- make test
|
- ${IDF_PATH}/tools/ci/multirun_with_pyenv.sh make test
|
||||||
|
|
||||||
test_nvs_coverage:
|
test_nvs_coverage:
|
||||||
extends: .host_test_template
|
extends: .host_test_template
|
||||||
|
Loading…
Reference in New Issue
Block a user