maximkulkin / esp32-homekit-camera

Firmware for esp32-camera module to act as Apple Homekit IP camera
MIT License
394 stars 78 forks source link

Failed to dump SPR public key (code -199) #48

Closed Tobias007 closed 4 years ago

Tobias007 commented 4 years ago

Hi Maxim, I'm impressed about your Homekit implementation. However I get the following error.

` [0;32mI (29) boot: ESP-IDF v3.3 2nd stage bootloader I (29) boot: compile time 22:11:44 I (29) boot: Enabling RNG early entropy source... I (33) boot: SPI Speed : 40MHz I (37) boot: SPI Mode : DIO I (41) boot: SPI Flash Size : 4MB I (45) boot: Partition Table: I (49) boot: ## Label Usage Type ST Offset Length I (56) boot: 0 nvs WiFi data 01 02 00009000 00006000 I (64) boot: 1 phy_init RF data 01 01 0000f000 00001000 I (71) boot: 2 factory factory app 00 00 00010000 00200000 I (79) boot: End of partition table I (83) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0xb0d4c (724300) map I (346) esp_image: segment 1: paddr=0x000c0d74 vaddr=0x3ffb0000 size=0x03e00 ( 15872) load I (352) esp_image: segment 2: paddr=0x000c4b7c vaddr=0x40080000 size=0x00400 ( 1024) load I (353) esp_image: segment 3: paddr=0x000c4f84 vaddr=0x40080400 size=0x0b08c ( 45196) load I (380) esp_image: segment 4: paddr=0x000d0018 vaddr=0x400d0018 size=0x11f920 (1177888) map I (794) esp_image: segment 5: paddr=0x001ef940 vaddr=0x4008b48c size=0x0c884 ( 51332) load I (829) boot: Loaded app from partition at offset 0x10000 I (830) boot: Disabling RNG early entropy source... I (830) psram: This chip is ESP32-D0WD I (836) spiram: Found 64MBit SPI RAM device I (839) spiram: SPI RAM mode: flash 40m sram 40m I (844) spiram: PSRAM initialized, cache is in low/high (2-core) mode. I (852) cpu_start: Pro cpu up. I (855) cpu_start: Application information: I (860) cpu_start: Project name: esp32-homekit-camera I (866) cpu_start: App version: v3.3 I (871) cpu_start: Compile time: Dec 1 2019 22:11:47 I (877) cpu_start: ELF file SHA256: 13212f43026bdf65... I (883) cpu_start: ESP-IDF: v3.3 I (888) cpu_start: Starting app cpu, entry point is 0x40081520 I (0) cpu_start: App cpu up. I (1779) spiram: SPI SRAM memory test OK I (1779) heap_init: Initializing. RAM available for dynamic allocation: I (1779) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM I (1786) heap_init: At 3FFBBC88 len 00024378 (144 KiB): DRAM I (1792) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM I (1798) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM I (1805) heap_init: At 40097D10 len 000082F0 (32 KiB): IRAM I (1811) cpu_start: Pro cpu start user code I (1816) spiram: Adding pool of 4096K of external SPI memory to heap allocator I (160) cpu_start: Chip Revision: 1 W (160) cpu_start: Chip revision is higher than the one configured in menuconfig. Suggest to upgrade it. I (164) cpu_start: Starting scheduler on PRO CPU. I (0) cpu_start: Starting scheduler on APP CPU. I (174) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations I (234) wifi: wifi driver task: 3ffcb8d0, prio:23, stack:3584, core=0 I (234) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE I (234) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE I (274) wifi: wifi firmware version: aeed694 I (274) wifi: config NVS flash: enabled I (274) wifi: config nano formating: disabled I (274) wifi: Init dynamic tx buffer num: 32 I (274) wifi: Init data frame dynamic rx buffer num: 32 I (284) wifi: Init management frame dynamic rx buffer num: 32 I (284) wifi: Init management short buffer num: 32 I (294) wifi: Init static tx buffer num: 16 I (294) wifi: Init static rx buffer size: 1600 I (294) wifi: Init static rx buffer num: 10 I (304) wifi: Init dynamic rx buffer num: 32 I (404) phy: phy_version: 4102, 2fa7a43, Jul 15 2019, 13:06:06, 0, 0 I (404) wifi: mode : sta (xxxxxxxxxxxxxx) I (404) esp32_camera: STA start I (524) wifi: new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1 I (1654) wifi: state: init -> auth (b0) I (1664) wifi: state: auth -> assoc (0) I (1674) wifi: state: assoc -> run (10) I (1684) wifi: connected with xxxxxxxxxxx, channel 1, HT20, bssid = xxxxxxxx I (1684) wifi: pm start, type: 1

I (2224) event: sta ip: 192.168.xxx.xxx, mask: 255.255.255.0, gw: xxxxxxxxxxx I (2224) esp32_camera: WiFI ready I (2224) esp32_camera: Free heap: 4364024 I (2234) gpio: GPIO[13]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0  I (2244) gpio: GPIO[14]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0  I (2254) sccb: pin_sda 26 pin_scl 27  I (2254) gpio: GPIO[32]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0  E (2284) sccb: SCCB_Write Failed addr:0x3c, reg:0xff, data:0x01, ret:-1 E (2284) sccb: SCCB_Write Failed addr:0x3c, reg:0x12, data:0x80, ret:-1 I (2364) gpio: GPIO[35]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0  I (2364) gpio: GPIO[34]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0  I (2374) gpio: GPIO[39]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0  I (2384) gpio: GPIO[36]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0  I (2394) gpio: GPIO[21]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0  I (2404) gpio: GPIO[19]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0  I (2414) gpio: GPIO[18]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0  I (2424) gpio: GPIO[5]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0  I (2434) gpio: GPIO[25]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0  I (2444) gpio: GPIO[23]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0  I (2454) gpio: GPIO[22]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0  I (2464) camera: Allocating 2 frame buffers (75 KB total) I (2474) camera: Allocating 37 KB frame buffer in OnBoard RAM I (2484) camera: Allocating 37 KB frame buffer in OnBoard RAM

HomeKit: Starting server HomeKit: Using existing accessory ID: 72:3E:79:92:B6:29 I (2674) esp32_camera: Initializing streaming HomeKit: Configuring mDNS I (2684) esp32_camera: Streaming initialized HomeKit: Got new client connection: 56 from 192.168.xxx.xxx HomeKit: [Client 56] Pair Setup Step 1/3 !!! HomeKit: [Client 56] Failed to dump SPR public key (code -199) HomeKit: [Client 56] Closing client connection `

Tobias007 commented 4 years ago

I tried to erase flash/reflash: the error remains - but a few more steps are visible:

homekit_client_process: [Client 56] Got 124 incomming data homekit_server_on_pair_setup: Pair Setup homekit_server_on_pair_setup: Free heap: 4243364 tlv_debug: Got following TLV values: tlv_debug: Type 0 value (1 bytes): \x00 tlv_debug: Type 6 value (1 bytes): \x01 HomeKit: [Client 56] Pair Setup Step 1/3 homekit_server_on_pair_setup: Free heap: 4243312 crypto_srp_new: Initializing SRP homekit_server_on_pair_setup: [Client 56] Initializing crypto homekit_server_on_pair_setup: Free heap: 4242656 homekit_server_on_pair_setup: [Client 56] Using user-specified password: 111-11-111 crypto_srp_init: Generating salt crypto_srp_init: Setting SRP username crypto_srp_init: Setting SRP params crypto_srp_init: Setting SRP password crypto_srp_init: Getting SRP verifier crypto_srp_init: Setting SRP verifier crypto_srp_get_public_key: Calculating public key !!! HomeKit: [Client 56] Failed to dump SPR public key (code -199) send_tlv_response: [Client 56] Sending TLV response tlv_debug: Got following TLV values: tlv_debug: Type 6 value (1 bytes): \x02 tlv_debug: Type 7 value (1 bytes): \x01 client_send: [Client 56] Sending payload: HTTP/1.1 200 OK\x0D\x0AContent-Type: application/pairing+tlv8\x0D\x0AContent-Length: 6\x0D\x0AConnection: keep-alive\x0D\x0A\x0D\x0A\x06\x01\x02\x07\x01\x01 homekit_client_process: [Client 56] Finished processing HomeKit: [Client 56] Closing client connection

Tobias007 commented 4 years ago

I checked the wolf cryptolib: Seems, following error is related to number -199: RNG_FAILURE_E = -199, / RNG Failed, Reinitialize / (s.th. with random number generation...)

Tobias007 commented 4 years ago

Its solved. It seems the other components were not loaded correctly. I used the ones (git clone recursive) from your package and then it works ...