Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Espressif SHA224 Fails wolfssl_test #6059

Closed
gojimmypi opened this issue Feb 5, 2023 · 1 comment
Closed

[Bug]: Espressif SHA224 Fails wolfssl_test #6059

gojimmypi opened this issue Feb 5, 2023 · 1 comment
Assignees
Labels

Comments

@gojimmypi
Copy link
Contributor

Contact Details

[email protected]

Version

Latest master branch

Description

The Espressif ESP32 wolfSSL Crypt Test Example fails when SHA224 is enabled.

Reproduction steps

Add #define WOLFSSL_SHA224 to the default user_settings.h used by the installed wolfSSL component (disabled by default) and observe failure message: SHA-224 test failed! error = -2207.

See wolfcrypt/test/test.c on or about line 2739:

image

I found this while working on #5948

Relevant log output

ets Jun  8 2016 00:22:57

rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:7000
load:0x40078000,len:15452
ho 0 tail 12 room 4
load:0x40080400,len:3840
entry 0x4008064c
I (28) boot: ESP-IDF v5.0-dirty 2nd stage bootloader
I (28) boot: compile time 09:40:20
I (28) boot: chip revision: v1.0
I (31) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (38) boot.esp32: SPI Speed      : 40MHz
I (43) boot.esp32: SPI Mode       : DIO
I (47) boot.esp32: SPI Flash Size : 2MB
I (52) boot: Enabling RNG early entropy source...
I (57) boot: Partition Table:
I (61) boot: ## Label            Usage          Type ST Offset   Length
I (68) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (76) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (83) boot:  2 factory          factory app      00 00 00010000 00177000
I (91) boot: End of partition table
I (95) boot_comm: chip revision: 1, min. application chip revision: 0
I (102) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=167d0h ( 92112) map
I (144) esp_image: segment 1: paddr=000267f8 vaddr=3ffb0000 size=027d0h ( 10192) load
I (148) esp_image: segment 2: paddr=00028fd0 vaddr=40080000 size=07048h ( 28744) load
I (162) esp_image: segment 3: paddr=00030020 vaddr=400d0020 size=42ed8h (274136) map
I (261) esp_image: segment 4: paddr=00072f00 vaddr=40087048 size=04bd4h ( 19412) load
I (269) esp_image: segment 5: paddr=00077adc vaddr=50000000 size=00010h (    16) load
I (275) boot: Loaded app from partition at offset 0x10000
I (275) boot: Disabling RNG early entropy source...
I (289) cpu_start: Pro cpu up.
I (290) cpu_start: Starting app cpu, entry point is 0x4008112c
I (277) cpu_start: App cpu up.
I (304) cpu_start: Pro cpu start user code
I (304) cpu_start: cpu freq: 160000000 Hz
I (304) cpu_start: Application information:
I (309) cpu_start: Project name:     wolfssl_test
I (314) cpu_start: App version:      v5.5.4-stable-221-gc68c039b1-di
I (321) cpu_start: Compile time:     Feb  5 2023 09:40:01
I (327) cpu_start: ELF file SHA256:  6b8c0534d16c2ad1...
I (333) cpu_start: ESP-IDF:          v5.0-dirty
I (339) heap_init: Initializing. RAM available for dynamic allocation:
I (346) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (352) heap_init: At 3FFB30E0 len 0002CF20 (179 KiB): DRAM
I (358) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (364) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (371) heap_init: At 4008BC1C len 000143E4 (80 KiB): IRAM
I (378) spi_flash: detected chip: generic
I (382) spi_flash: flash io: dio
W (386) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (400) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (409) wolfssl_test: --------------------------------------------------------
I (419) wolfssl_test: --------------------------------------------------------
I (429) wolfssl_test: ---------------------- BEGIN MAIN ----------------------
I (429) wolfssl_test: --------------------------------------------------------
I (439) wolfssl_test: --------------------------------------------------------
I (449) wolfssl_test: CONFIG_IDF_TARGET = esp32
I (449) wolfssl_test: LIBWOLFSSL_VERSION_STRING = 5.5.4
I (459) wolfssl_test: LIBWOLFSSL_VERSION_GIT_HASH = c68c039b188c9416af2940805d1d4b528b583e3b
I (469) wolfssl_test: LIBWOLFSSL_VERSION_GIT_SHORT_HASH = c68c039b1
I (479) wolfssl_test: LIBWOLFSSL_VERSION_GIT_HASH_DATE = 'Thu Feb 2 10:00:35 2023 -0800'
I (489) wolfssl_test: CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ = 160 MHz
I (489) wolfssl_test: Xthal_have_ccount = 1
I (499) wolfssl_test: Stack HWM: 53664

I (499) wolfssl_test: ESP32WROOM32_CRYPT is enabled.
------------------------------------------------------------------------------
 wolfSSL version 5.5.4
------------------------------------------------------------------------------
error    test passed!
MEMORY   test passed!
base64   test passed!
asn      test passed!
RANDOM   test passed!
MD5      test passed!
MD4      test passed!
SHA      test passed!
SHA-224  test failed!
 error = -2207
I (559) wolfcrypt_test: Exiting main with return code: -1

E (559) wolfssl_test: wolf_test_task FAIL result code = -1
@gojimmypi
Copy link
Contributor Author

This issue was fixed with the merge of #6287

Note that #define WOLFSSL_SHA224 may need to be added to user_settings.h.

Here's a sample output from the ESP32 running the wolfssl_test example:

ets Jun  8 2016 00:22:57

rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:7000
load:0x40078000,len:15452
ho 0 tail 12 room 4
load:0x40080400,len:3840
entry 0x4008064c
I (28) boot: ESP-IDF v5.0-dirty 2nd stage bootloader
I (28) boot: compile time 09:03:50
I (28) boot: chip revision: v1.0
I (31) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (38) boot.esp32: SPI Speed      : 40MHz
I (43) boot.esp32: SPI Mode       : DIO
I (48) boot.esp32: SPI Flash Size : 2MB
I (52) boot: Enabling RNG early entropy source...
I (57) boot: Partition Table:
I (61) boot: ## Label            Usage          Type ST Offset   Length
I (68) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (76) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (83) boot:  2 factory          factory app      00 00 00010000 00177000
I (91) boot: End of partition table
I (95) boot_comm: chip revision: 1, min. application chip revision: 0
I (102) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=16ec0h ( 93888) map
I (145) esp_image: segment 1: paddr=00026ee8 vaddr=3ffb0000 size=027d0h ( 10192) load
I (149) esp_image: segment 2: paddr=000296c0 vaddr=40080000 size=06958h ( 26968) load
I (161) esp_image: segment 3: paddr=00030020 vaddr=400d0020 size=468cch (288972) map
I (266) esp_image: segment 4: paddr=000768f4 vaddr=40086958 size=052c4h ( 21188) load
I (275) esp_image: segment 5: paddr=0007bbc0 vaddr=50000000 size=00010h (    16) load
I (281) boot: Loaded app from partition at offset 0x10000
I (282) boot: Disabling RNG early entropy source...
I (297) cpu_start: Pro cpu up.
I (297) cpu_start: Starting app cpu, entry point is 0x4008112c
I (284) cpu_start: App cpu up.
I (311) cpu_start: Pro cpu start user code
I (311) cpu_start: cpu freq: 160000000 Hz
I (312) cpu_start: Application information:
I (316) cpu_start: Project name:     wolfssl_test
I (322) cpu_start: App version:      v5.6.0-stable-323-g1a8f09d01-di
I (329) cpu_start: Compile time:     May  3 2023 09:03:35
I (335) cpu_start: ELF file SHA256:  64cbc206b5e7a8d5...
I (341) cpu_start: ESP-IDF:          v5.0-dirty
I (346) heap_init: Initializing. RAM available for dynamic allocation:
I (353) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (359) heap_init: At 3FFB30D0 len 0002CF30 (179 KiB): DRAM
I (365) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (372) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (378) heap_init: At 4008BC1C len 000143E4 (80 KiB): IRAM
I (386) spi_flash: detected chip: generic
I (389) spi_flash: flash io: dio
W (393) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Usi
ng the size in the binary image header.
I (407) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (417) wolfssl_test: --------------------------------------------------------
I (427) wolfssl_test: --------------------------------------------------------
I (437) wolfssl_test: ---------------------- BEGIN MAIN ----------------------
I (437) wolfssl_test: --------------------------------------------------------
I (447) wolfssl_test: --------------------------------------------------------
I (457) wolfssl_test: CONFIG_IDF_TARGET = esp32
I (457) wolfssl_test: LIBWOLFSSL_VERSION_STRING = 5.6.0
I (467) wolfssl_test: LIBWOLFSSL_VERSION_GIT_HASH = 1a8f09d013975acf429be3af48a002972df6b5fd
I (477) wolfssl_test: LIBWOLFSSL_VERSION_GIT_SHORT_HASH = 1a8f09d01
I (487) wolfssl_test: LIBWOLFSSL_VERSION_GIT_HASH_DATE = 'Wed May 3 07:46:29 2023 +1000'
I (497) wolfssl_test: CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ = 160 MHz
I (497) wolfssl_test: Xthal_have_ccount = 1
I (507) wolfssl_test: Stack HWM: 53664

I (507) wolfssl_test: ESP32WROOM32_CRYPT is enabled.
------------------------------------------------------------------------------
 wolfSSL version 5.6.0
------------------------------------------------------------------------------
error    test passed!
MEMORY   test passed!
base64   test passed!
asn      test passed!
RANDOM   test passed!
MD5      test passed!
MD4      test passed!
SHA      test passed!
SHA-224  test passed!
SHA-256  test passed!
SHA-512  test passed!
SHA-512/224  test passed!
SHA-512/256  test passed!
Hash     test passed!
HMAC-MD5 test passed!
HMAC-SHA test passed!
HMAC-SHA224 test passed!
HMAC-SHA256 test passed!
HMAC-SHA512 test passed!
HMAC-KDF    test passed!
TLSv1.3 KDF test passed!
GMAC     test passed!
DES      test passed!
DES3     test passed!
AES      test passed!
AES192   test passed!
AES256   test passed!
AES-GCM  test passed!
RSA      test passed!
PWDBASED test passed!
ECC      test passed!
ECC buffer test passed!
CURVE25519 test passed!
ED25519  test passed!
logging  test passed!
time test passed!
mutex    test passed!
Test complete
I (159367) wolfcrypt_test: Exiting main with return code:  0

I (159367) wolfssl_test: wolf_test_task complete success result code = 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant