GithubHelp home page GithubHelp logo

Comments (29)

gojimmypi avatar gojimmypi commented on May 23, 2024 1

Hello @AchimPieters !

I'm going to see if I can add wolfssl as a submodule ... If you have any recommendations, I would like to here them.

Yes, I really need to put a blog together to better explain that.

First: I'm not so much a fan of using submodules, as least not as a developer. It's great for distribution of a final product but does not lend itself to being able to easily make changes.

Regarding the link you mentioned, that's an Espressif Managed Component. It is a wonderful tool for easily getting started, but that too - does not lend itself to making changes as a developer. In fact, it is even less friendly than a submodule: as soon as a change is detected, it complains. It is great for maintaining code integrity, but not for making changes.

In your example, I deleted everything in this directory except for the CMakeLists.txt file and the include directory:

esp32-homekit-demo\components\wolfssl

I then made one change to the CMakeLists.txt file, pointing to my wolfssl-arduino directory. (I have wolfssl cloned there for Arduino-specific changes).

# Optionally set your source to wolfSSL in your project CMakeLists.txt like this:
set(WOLFSSL_ROOT "c:/workspace/wolfssl-arduino" )

I was able to successfully compile the example LED project that references wolfSSL.

The cool thing here that as a developer, we can more easily see changes and contribute. The library can be shared among as many projects as desired, and versions can easily be changed either with git hashes or even pointing to a completely different directory.

Regarding the more recent SRP errors you are seeing: is that for the LED or some other example? I'm wondering if there's an issue finding the user_settings.h and/or the settings therein. I would need more details.

I might try isolating the project and using wolfSSL as a local component as seen in the examples.

from wolfssl.

gojimmypi avatar gojimmypi commented on May 23, 2024 1

Hello @AchimPieters

I have been able to replicate the compile problem you are seeing. I appreciate your persistence and patience as we work through these issues.

Try adding these to your wolfssl user_settings.h in esp32-homekit-demo\components\wolfssl\include:

#define WOLFCRYPT_HAVE_SRP
#define HAVE_CHACHA
#define HAVE_POLY1305
#define WOLFSSL_BASE64_ENCODE

Let me know if that works for you.

from wolfssl.

gojimmypi avatar gojimmypi commented on May 23, 2024 1

Hi @AchimPieters

app partition is too small for binary main.bin is the new version of wolfssl that much bigger then the previous one?

Well, yes, we turned on new features. We saw that error last year. Curious that you ran out of memory, as I still had 2% available yesterday on my classic ESP32 and did not need to adjust the partition size.

btw - see my defaults, in particular the partitions_singleapp_large.csv that may be helpful.

when I want to add the accessory to HomeKit it gives this errror: crypto_srp_init: Failed to get SRP verifier (code -1)

It looks like the suggested settings from dgarske are missing from your user_settings.h:

If you are building with USE_FAST_MATH (tfc.c) then you need #define FP_MAX_BITS (8192 * 2).
If you are building with WOLFSSL_SP_MATH_ALL (sp_int.c) then set #define SP_INT_BITS 8192

Please add the #define FP_MAX_BITS (8192 * 2) back as before & let me know how it goes.

I suggest keeping USE_FAST_MATH as that's the only wolfSSL math library supporting hardware accelerated encryption on the ESP32 at this time.

Seems you are very close! It would be great to see this all working as desired.

from wolfssl.

gojimmypi avatar gojimmypi commented on May 23, 2024 1

Hi @AchimPieters

It seems you are really close! Excellent. What's different from when you last had this working?

It's getting a bit more difficult for me to help, given that I don't have any of the Homekit hardware.

I do have some suggestions though:

  • Try to disable hardware acceleration.

Recently while working on the SSH to UART example, I discovered a problem with SHA256 hardware acceleration as noted in wolfSSL/wolfssh-examples#4. I'm working on a solution to both fix the code, and capture in wolfCrypy test. The root cause was a hash interleave that I did not properly take into account when in SINGLE_THREADED mode when calculating an SSH signature. There could well be a similar problem in the SRP.

The brute-force method to start with is to disable all hardware acceleration in the user_settings.h:

      #define NO_ESP32_CRYPT
      #define NO_WOLFSSL_ESP32_CRYPT_HASH
      #define NO_WOLFSSL_ESP32_CRYPT_AES
      #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
      #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL 
      #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD 
      #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD
  • On the topic of tests: try using the wolfCrypt test app in your environment with your respective user_settings.h.

  • Try turning on DEBUG_WOLFSSL (see examples for other debug options)

  • Try sprinkling in some printf (or better: ESP_LOGI(TAG, "message")) breadcrumbs to see where it is failing.

  • Try using a JTAG debugger with breakpoints & single-step to find exactly where things go sideways. I use the VisualGDB extension for Visual Studio with the open-source Tigard JTAG debugger. I've found this to be a very helpful and productive tool.

Let me know how that goes. I'd really like to see the your Homekit examples working again.

Best Regards

from wolfssl.

gojimmypi avatar gojimmypi commented on May 23, 2024 1

Hi @AchimPieters - I'll take a look at this today. Perhaps try not using the include and only commenting out the WOLFSSL_MSG messages.

from wolfssl.

gojimmypi avatar gojimmypi commented on May 23, 2024

Hello @AchimPieters - I've been able to reproduce the problem you are seeing.

The cause appears to be that with hardware acceleration enabled (by default), the ESP32 libraries do not properly handle this define in your user_settings.h:

#define NO_SHA

Remove that line should fix the compile problem you are seeing.

Additionally, a few other observations and recommendations:

Your example contains an entire copy of wolfSSL. I've (painfully) learned this can be problematic to maintain and troublehoot. The latest versions of the CMakeLists.txt allow for specification of where the wolfSSL source code is located, by setting WOLFSSL_ROOT. See the example template.

There's also a potential problem of distributing wolfSSL. I'm not a licensing expert, so it is probably best to contact [email protected]

It is best to include the wolfSSL settings.h in every file that uses wolfSSL. Include this before referencing any other wolfssl files. Do not explicitly include user_settings.h yourself as the settings.h. pulls it in as appropriate. Later inclusion of the user_settings.h may undo some of the settings.h actions, leading to unpredictable results.

I'm leaving this issue open, as the NO_SHA should be valid regardless of whether hardware encryption is enabled or not.

from wolfssl.

AchimPieters avatar AchimPieters commented on May 23, 2024

@gojimmypi The No SHA did the trick, git some errors that are hardware specific related, but not with Wolfssl.

I'm going to see if I can add wolfssl as a submodule: https://components.espressif.com/components/wolfssl/wolfssl
(License: Custom)

If you have any recommendations, I would like to here them.

from wolfssl.

AchimPieters avatar AchimPieters commented on May 23, 2024

@gojimmypi I solved all problems with the latest version of Wolfssl (v5.6.6-stable), I can compile my code for esp32 but now have this issue?

>>> HomeKit: [Client 1] Pair Setup Step 2/3
>>> homekit_server_on_pair_setup: Free heap: 201056
>>> homekit_server_on_pair_setup: [Client 1] Computing SRP shared secret
>>> homekit_server_on_pair_setup: Free heap: 201056
>>> homekit_server_on_pair_setup: [Client 1] Verifying peer's proof
>>> homekit_server_on_pair_setup: Free heap: 201376
>>> homekit_server_on_pair_setup: [Client 1] Generating own proof
>>> client_sendv: [Client 1] Sending payload: HTTP/1.1 200 OK\x0D\x0AContent-Type: application/pairing+tlv8\x0D\x0ATransfer-Encoding: chunked\x0D\x0AConnection: keep-alive\x0D\x0A\x0D\x0A
>>> client_sendv: [Client 1] Sending payload: \x34\x35\x0D\x0A\x06\x01\x04\x04\x40\x64\x44\xDC\x7E\xCC\xBC\xFE\xB4\x28\xB8\x9B\x12\x2A\xAA\x1F\x69\x1B\x5E\xF2\x9D\x6F\x7B\x7D\x30\x46\x17\xAE\x4F\xA1\x0B\x2A\x0A\x0A\x8A\x11\x9C\xD1\xD7\xC0\x1F\x08\xEA\xB4\xD1\x0D\xC0\x1E\x63\x22\x75\x84\x44\x63\xF8\xE0\x90\x49\xD5\x29\x59\x60\x50\x39\xBA\x0D\x0A
>>> client_sendv: [Client 1] Sending payload: \x30\x0D\x0A\x0D\x0A
>>> homekit_client_process: [Client 1] Finished processing
>>> HomeKit: [Client 1] Closing client connection from 192.168.178.28
>>> homekit_server_accept_client: Free heap: 210620
>>> HomeKit: [Client 1] Got new client connection from 192.168.178.145
>>> homekit_client_process: [Client 1] Got 132 incoming data
>>> homekit_server_on_pair_setup: Pair Setup
>>> homekit_server_on_pair_setup: Free heap: 211008
>>> tlv_debug: Got following TLV values:
>>> tlv_debug: Type 0 value (1 bytes): \x00
>>> tlv_debug: Type 6 value (1 bytes): \x01
>>> HomeKit: [Client 1] Pair Setup Step 1/3
>>> homekit_server_on_pair_setup: Free heap: 210920
>>> crypto_srp_new: Initializing SRP
>>> homekit_server_on_pair_setup: [Client 1] Initializing crypto
>>> homekit_server_on_pair_setup: Free heap: 201932
>>> homekit_server_on_pair_setup: [Client 1] Using user-specified password: 338-77-883
>>> 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
>>> client_sendv: [Client 1] Sending payload: HTTP/1.1 200 OK\x0D\x0AContent-Type: application/pairing+tlv8\x0D\x0ATransfer-Encoding: chunked\x0D\x0AConnection: keep-alive\x0D\x0A\x0D\x0A
>>> client_sendv: [Client 1] Sending payload: \x31\x39\x39\x0D\x0A\x03\xFF\x78\xBD\xF5\x98\xDE\xF6\x3D\x92\x93\x96\xEF\x64\x58\xAF\xB7\x5C\x33\x27\x8D\xFA\x27\x3B\xCA\x6E\x89\x86\x75\x29\xFB\xB1\x55\x90\x7A\x44\x9A\xFE\xD5\x54\x03\x70\x31\xF5\x5D\x64\xBA\xC1\x1B\x33\xE0\xFD\xE6\xDD\x7D\x05\x27\xD0\x36\x1F\xD8\x51\x78\xCD\xE9\x61\x4F\x77\xFF\xEA\x6C\xF4\xA2\x78\x61\xC9\xC9\x16\x86\xE4\xB9\xE4\xA7\x68\xAA\xC6\x06\x1A\x37\x2B\x69\x2B\x83\xE1\xF4\x40\xE4\x01\x08\x4E\x36\xF4\x99\x04\x82\x81\x35\x89\x32\x8D\x0F\x51\x21\xFF\xC7\xCB\x22\x83\x58\x20\x07\xAA\x48\x6B\x54\xAA\x1C\x2D\xDC\xED\xDB\xC7\x25\x90\xB5\x49\xB0\xEB\x7D\x6F\xA7\x4C\xE9\x38\xA7\xC8\xDC\x15\x6C\x4C\xBC\xBA\x23\xDF\xC4\x49\x03\xF9\x22\x33\x5F\x1D\x66\xDB\x41\xB5\x10\x0B\xCE\xE9\x97\x74\x0C\xEB\x65\x02\xA7\x2A\xF6\x09\xCB\xA4\xC8\xF1\x20\x04\xDC\xF1\xBC\x87\x3D\xB5\x72\x87\xFC\x4D\x3D\x1E\x44\x9C\xA4\x83\xA2\x26\x40\x89\xDD\xE1\xF3\x02\x51\x17\xB6\xA3\x7B\x72\x5D\xB2\xA7\xE0\x77\x8E\xF5\xF0\x1A\x82\x08\x46\x89\xCE\x0B\x54\x3E\x37\x29\x54\xB4\x1D\xEE\xB7\x58\x4E\xD3\xBD\x4A\x35\x8E\xE9\x5F\xC2\xBB\xA7\x8D\xE0\x68\xF2\x9A\x03\x81\xD6\xE8\x24\xB4\x0B\x67\xBD\xCC\x00\x46\x05\xB5\x99\x2E\xB5\x80\xFF\x43\x1B\x97\x50\x06\x78\xA0\x0D\xAD\x56\x4F\x83\x59\xD6\x5B\x8E\xF4\x7E\xDF\xB2\x80\x43\x54\xB0\x41\x9A\x40\xEC\x46\xA1\x74\x4C\x71\x19\xF9\x4F\x77\x1B\xAB\x7F\xC6\x1C\xB1\xC1\x20\x05\x1C\x07\x21\xCA\xD2\xE9\x35\x98\xA6\xB5\x5A\x12\xD8\xC2\x07\x4B\x45\xCC\x89\xD4\x60\x49\xB2\x36\x74\x27\x6D\x17\x71\x87\xFF\x4D\x6B\xDC\x5D\xFD\xDC\x3A\x5D\x01\xEF\xAE\xEC\x69\x07\x8B\x3C\xEA\x50\x5A\x49\x7C\x17\x0F\xFB\x43\xD6\x3D\x65\xBF\x47\xF9\x4E\xB1\x99\x18\x02\x10\xE9\x4F\xD8\xCF\xB0\x51\x21\x62\xA5\x12\xDB\xBC\xA0\x25\x34\xB5\x06\x01\x02\x0D\x0A
>>> client_sendv: [Client 1] Sending payload: \x30\x0D\x0A\x0D\x0A
>>> homekit_client_process: [Client 1] Finished processing
>>> homekit_client_process: [Client 1] Got 585 incoming data
>>> homekit_server_on_pair_setup: Pair Setup
>>> homekit_server_on_pair_setup: Free heap: 201604
>>> tlv_debug: Got following TLV values:
>>> tlv_debug: Type 6 value (1 bytes): \x03
>>> tlv_debug: Type 3 value (384 bytes): \xF4\x55\x81\xB5\x54\xB6\x24\x82\x41\x06\xFD\xC0\xE9\x6F\x72\xBD\x64\x65\xF6\xC1\xDA\xE5\x35\xB5\xED\x7D\x64\x91\xB6\x27\x23\x1B\x7F\xC4\x33\x47\xAF\xC1\xA6\x3B\xB7\x0B\xFC\x16\x54\x05\x16\x57\x0F\xFF\xD6\x9B\xD9\xB7\xDE\xD9\x86\xBA\xB2\x75\xDE\xA5\x43\xB2\x51\xB0\xF9\x9E\xCF\x65\x22\x49\xB7\x2D\xAD\x08\x05\xB1\x6E\xF7\xFC\x73\x01\x06\xCA\x00\x56\x98\x37\xB3\xD0\x53\x84\x95\x59\xE5\xE6\x1F\xC0\x80\x0D\x20\x7C\x7E\xFB\xA6\x10\x21\x85\x27\x6E\xEA\x22\x2E\x44\x52\x32\x7F\xAE\x24\x32\xD0\xCF\x11\xE4\x0D\x19\xDC\x2E\x0A\x16\x73\xC3\xD8\x9E\x26\x5C\x8C\x4F\x63\x48\xA6\x3F\x4D\xC0\x9B\x91\x01\xB4\x92\x3E\x81\x12\x34\x44\xFE\x1F\x33\x91\x7F\xFB\x0A\xC3\xC6\xB1\x26\xEF\xCE\x5E\xB7\x96\xF3\xCB\x68\x32\x8D\xAA\x7A\x7A\xC1\x89\x6A\xFF\xEC\x87\x96\xA4\xFB\x61\xE1\xEC\x44\x53\x4F\xDC\x46\x26\x78\xE6\x5E\xD3\x5D\x90\xD6\xD1\xD2\x65\x42\x37\xA9\x7C\xA3\x52\x9A\x82\xDD\x10\x89\x14\xFD\x32\xE8\x22\x09\x35\x98\xBE\x4A\x27\x4F\x0E\xD4\xA9\xDD\x2A\xFA\x24\x08\x42\x8A\x21\xBF\x44\x4E\x7F\xF5\x9F\x58\xBA\x4D\x43\x2B\x49\x97\xD9\xC5\xA4\x9B\xD5\x1C\xB4\xE6\xE8\x9B\x03\xB4\xEE\x3E\x34\xD2\x94\xB0\x36\x93\xB4\x8F\x57\xDA\x87\x5C\x60\xF2\x02\x68\xA9\x9B\xCA\xCA\x03\xEC\x12\x41\xE7\xA0\x9E\xAA\x3A\xEF\xC8\xAC\xA5\x48\x96\xFA\x06\x6B\xD3\x82\x65\x58\xE5\x67\xFE\xBF\xE5\x83\x98\x62\xEC\xCA\xDD\xB4\x8F\xAB\x3B\xFA\x79\xA2\xBF\xFE\x36\x73\x9C\x05\x62\xF5\xB5\xA5\x59\xA5\x69\x99\x30\xF3\xB0\x96\x28\xDF\xA7\xEB\x11\x8C\x9F\x7B\x72\x3A\x17\xC9\xEF\x8F\x7C\x6B\x5F\x87\xE9\xE2\x0A\xD7\xAE\x1C\x5E\x17\x5C\x47\xB3\xD5\x3C\xB8\xEE\x74\xCF\x20\x3A\xF1
>>> tlv_debug: Type 4 value (64 bytes): \x20\x58\xBA\x4A\x7E\x63\xBD\xA2\x7F\xE4\x3F\x2A\x7A\x8A\xCC\x81\x75\x33\x3B\xF4\x04\xAC\x6A\xD9\x49\xAA\x0E\x88\xC6\xFD\x49\xAD\x75\xBF\x46\xFF\xB6\x16\x21\x99\xB4\xE2\x5A\xDD\x4F\x89\xDC\x40\x73\x8B\xFF\xF1\x72\xA2\xE1\x80\xA5\x85\x59\x12\x98\x05\xED\x3A
>>> HomeKit: [Client 1] Pair Setup Step 2/3
>>> homekit_server_on_pair_setup: Free heap: 201036
>>> homekit_server_on_pair_setup: [Client 1] Computing SRP shared secret
>>> homekit_server_on_pair_setup: Free heap: 201036
>>> homekit_server_on_pair_setup: [Client 1] Verifying peer's proof
>>> homekit_server_on_pair_setup: Free heap: 201356
>>> homekit_server_on_pair_setup: [Client 1] Generating own proof
>>> client_sendv: [Client 1] Sending payload: HTTP/1.1 200 OK\x0D\x0AContent-Type: application/pairing+tlv8\x0D\x0ATransfer-Encoding: chunked\x0D\x0AConnection: keep-alive\x0D\x0A\x0D\x0A
>>> client_sendv: [Client 1] Sending payload: \x34\x35\x0D\x0A\x06\x01\x04\x04\x40\x07\xFC\x7A\xFC\xEF\xDD\x3A\xED\x41\xCE\x15\x53\xB3\x77\xF3\x12\x9F\x3A\x50\x69\x23\x1B\xA9\x19\x51\x84\x63\x89\x41\xEE\x3A\x6E\x4E\x2C\xD9\xD2\x6A\xF5\x84\x64\x4A\xCC\xCF\x9D\xDB\x4B\x94\xA2\x3C\x07\x97\x17\xC8\xF5\xB7\xCC\x05\xF1\x22\xC7\x7B\xCB\x42\x48\x0D\x0A
>>> client_sendv: [Client 1] Sending payload: \x30\x0D\x0A\x0D\x0A
>>> homekit_client_process: [Client 1] Finished processing
>>> HomeKit: [Client 1] Closing client connection from 192.168.178.145

And when compiling for an ESP32C3:

>>> 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: Failed to get SRP verifier (code -1)
!!! HomeKit: [Client 1] Failed to initialize SRP
>>> client_sendv: [Client 1] Sending payload: HTTP/1.1 200 OK\x0D\x0AContent-Type: application/pairing+tlv8\x0D\x0ATransfer-Encoding: chunked\x0D\x0AConnection: keep-alive\x0D\x0A\x0D\x0A
>>> client_sendv: [Client 1] Sending payload: \x36\x0D\x0A\x06\x01\x02\x07\x01\x01\x0D\x0A
>>> client_sendv: [Client 1] Sending payload: \x30\x0D\x0A\x0D\x0A
>>> homekit_client_process: [Client 1] Finished processing
>>> HomeKit: [Client 1] Closing client connection from 192.168.178.28

The crypto_srp_init: Failed to get SRP verifier (code -1) error returns? srp errors #6870

latest information can be found here: https://github.com/AchimPieters/esp32-homekit-demo.git

from wolfssl.

AchimPieters avatar AchimPieters commented on May 23, 2024

Hello @gojimmypi,

I was able to successfully compile the example LED project that references wolfSSL.

Also for the esp32C3 or ESPC2?

In your example, I deleted everything in this directory except for the CMakeLists.txt file and the include directory:

Did you do so with my current version, or my old version?

I have tried everything with the latest version of wolffsl 5.6.6-stable-update2-esp32 but noting works any more?

Even the basic ESP32 setup, that worked like a charm, doesn't work any more.
Here is my latest user_settings.h file https://github.com/AchimPieters/esp32-homekit-demo/blob/main/components/wolfssl/include/user_settings.h

Maybe clone my latest repro to see what I mean? https://github.com/AchimPieters/esp32-homekit-demo

from wolfssl.

gojimmypi avatar gojimmypi commented on May 23, 2024

Did you do so with my current version, or my old version?

I did this with the same code clone mentioned above, so within the last couple of weeks.

Also for the esp32C3 or ESPC2?

I only tested for the ESP32, but would expect similar successful results with others such the -C3 ad -C2. Did you see different results?

but noting works any more?

I'll need a little more detail, please.

Maybe clone my latest repro to see what I mean?

I'll revisit switch your latest code soon. I just need to finish up a few customer requests.

Any additional information would be helpful, such as specific error messages, please.

from wolfssl.

AchimPieters avatar AchimPieters commented on May 23, 2024

Reproduction steps

Open a terminal window:
Install docker
Install IDF Latest - docker pull espressif/idf:latest
Clone repository - git clone --recursive https://github.com/AchimPieters/esp32-homekit-demo.git
start IDF - docker run -it -v ~/esp32-homekit-demo:/project -w /project espressif/idf:latest
cd examples
cd led
idf.py set-target esp32
idf.py menuconfig

  • Serial flasher config ---> Flash size (2 MB) ---> (X) 4 MB
  • StudioPieters ---> (myssid) WiFi SSID and (mypassword) WiFi Password
  • Component config ---> HomeKit ---> [*] Debug output
    Save configuration
    idf.py build

Open a new (second) terminal window:
cd /Users/USERNAME/esp32-homekit-demo/examples/led
esptool.py erase_flash
python -m esptool --chip esp32 -b 460800 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_size 4MB --flash_freq 40m 0x1000 build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin 0x10000 build/main.bin

screen /dev/tty.usbserial-01FD1166 115200

I (3838) IP_EVENT: WiFI ready
>>> HomeKit: Starting server
>>> HomeKit: Using existing accessory ID: B9:8B:90:79:57:C7
>>> HomeKit: Configuring mDNS
>>> homekit_setup_mdns: Accessory Setup ID = 1QJ8
>>> homekit_run_server: Starting HTTP server
>>> homekit_server_accept_client: Free heap: 210868
>>> HomeKit: [Client 1] Got new client connection from 192.168.178.28
>>> homekit_client_process: [Client 1] Got 132 incoming data
>>> homekit_server_on_pair_setup: Pair Setup
>>> homekit_server_on_pair_setup: Free heap: 211256
>>> tlv_debug: Got following TLV values:
>>> tlv_debug: Type 0 value (1 bytes): \x00
>>> tlv_debug: Type 6 value (1 bytes): \x01
>>> HomeKit: [Client 1] Pair Setup Step 1/3
>>> homekit_server_on_pair_setup: Free heap: 211144
>>> crypto_srp_new: Initializing SRP
>>> homekit_server_on_pair_setup: [Client 1] Initializing crypto
>>> homekit_server_on_pair_setup: Free heap: 202168
>>> homekit_server_on_pair_setup: [Client 1] Using user-specified password: 338-77-883
>>> 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
>>> client_sendv: [Client 1] Sending payload: HTTP/1.1 200 OK\x0D\x0AContent-Type: application/pairing+tlv8\x0D\x0ATransfer-Encoding: chunked\x0D\x0AConnection: keep-alive\x0D\x0A\x0D\x0A
>>> client_sendv: [Client 1] Sending payload: \x31\x39\x39\x0D\x0A\x03\xFF\xF4\x87\xCB\x6C\x4D\x61\x76\x50\x78\xEA\x36\x9A\x35\x55\x5B\x42\x08\xCE\x0E\xC4\x0A\xE7\x38\x22\xDA\x00\x26\x79\x1B\x76\xA7\xCF\xC4\xB5\x5E\x7D\xF3\xB6\xEF\xD0\x55\xA7\x8D\x21\xFD\x05\x1C\x65\xF8\x19\x08\xEA\xBE\x86\x97\x91\x65\x28\x2C\xE6\x5C\x7D\xB7\x75\xFE\xF8\x66\x2D\x4E\xB1\x53\x7A\x40\xA1\x22\xE6\x3C\xBC\xE2\x3A\x5B\xEC\x49\x84\xC4\x9B\xF5\x93\x62\x95\xAC\x3B\xF6\x3E\x99\x48\x60\x7E\xAD\x3E\xBD\x70\x0E\x10\xC1\x57\xE8\x12\x7C\x38\x36\xCF\x6B\x8E\x95\x2E\x04\x7F\xE0\x30\x82\x11\x2C\x48\x6B\x17\x66\x6F\x5E\x45\x80\x5B\xD3\xA0\xC6\xF9\x9F\x11\xA3\xB8\xC3\x80\xD9\xA1\x24\xDB\xDB\x3D\x2E\xE7\x2D\x14\x06\x12\x02\x2C\x38\x0B\xDD\x0E\x06\xA9\x1D\xBD\xD7\x71\xD8\x0C\x50\xAA\xD2\x94\x2F\x35\x99\x80\x1A\xC0\x93\xAD\x86\x9D\x6A\xC7\x31\xD0\xF9\xCC\xBE\xD2\x66\x14\x15\x4E\xED\x71\x02\xAB\xFC\x8E\xF9\x14\xC1\x9A\xD7\x8A\xB1\xD9\x7A\xC1\xBF\x59\x73\xD1\xA9\x31\xF6\x91\x7C\xE6\xC7\xE8\xF2\xB5\xB0\xE5\x32\x0E\x09\x0A\x9E\x32\xAE\xFB\x90\x06\xC7\xB6\x42\xA6\xA7\x30\xB4\x0B\x16\x53\x17\xC7\x17\xC9\x17\x78\xD3\xF8\x6B\x03\x81\xBB\xEF\x21\x17\xBC\x6D\x59\x1C\x6A\x80\x20\x25\x22\x65\xE3\x9E\x73\xD4\x71\x72\xC6\x83\x39\xCB\x22\x08\x20\xAB\xBD\x71\x8C\x6D\xCA\xC8\x26\x33\x8A\xCD\xDA\xF1\x1D\x73\xDE\xA5\xA9\xAC\x9E\x05\xD3\xBB\xC2\xBB\x3A\x45\x8F\xEE\x38\x12\xE4\x06\xE6\x9E\x47\x8E\xF3\xD1\x85\xC9\xA2\xFA\x84\xB4\x4D\x98\x45\x72\x0B\xE0\x19\x9F\x2D\xE8\x52\xDA\x43\x47\x85\x8F\x5B\xB4\x6E\xC5\x28\x20\x13\x05\x68\x8A\xC4\x5C\x18\x8E\xD9\xD5\xE4\xE8\x29\x64\xB7\x70\x25\x3E\x4A\x7B\xC6\x3B\x9B\xD5\x63\x21\x88\x54\x3C\x92\xD5\x1D\x49\xC0\x12\x02\x10\x2E\x6D\xF4\x69\x1F\x60\x80\x9B\xCA\x46\xDE\xC2\x21\xDA\x5B\x76\x06\x01\x02\x0D\x0A
>>> client_sendv: [Client 1] Sending payload: \x30\x0D\x0A\x0D\x0A
>>> homekit_client_process: [Client 1] Finished processing
>>> homekit_client_process: [Client 1] Got 585 incoming data
>>> homekit_server_on_pair_setup: Pair Setup
>>> homekit_server_on_pair_setup: Free heap: 201856
>>> tlv_debug: Got following TLV values:
>>> tlv_debug: Type 6 value (1 bytes): \x03
>>> tlv_debug: Type 3 value (384 bytes): \x4D\xC4\x55\xBE\x2B\xA6\x56\x28\xAF\x6B\xDA\xAA\x05\x0D\x6E\xDA\xBE\x8C\x5E\x25\x5F\xBD\x0F\x39\x6F\x6B\x68\xB4\xEB\xFD\x5D\xA1\xFD\x50\x4F\xA0\x1A\x6C\xAF\x4E\x94\x38\xB2\xF2\x3C\xAD\x68\x51\x0C\x30\x44\x9A\x7E\x2C\xBA\x31\xF5\x3A\x5E\xEE\x77\xC2\x8A\x43\x75\xC5\x58\xDD\x91\x2A\x16\x48\x27\x5C\x07\xE0\x9A\x0A\xE2\x7E\x79\x11\x33\xBD\x61\xE1\x0D\xB8\x7B\x26\x45\xFC\xED\xAA\x31\x23\x64\xE9\xB7\x28\x73\x0D\x1C\x93\x39\x8C\xCC\x30\x83\x60\x17\x65\x01\xC5\x70\xE5\x3C\xD3\x09\x9C\xE4\xA4\xF4\x09\x99\x58\xC4\x2F\x89\x62\xE7\x02\x7D\x3D\x15\xB7\x5F\x2C\x22\xD6\xCE\x51\x41\x18\x6D\x98\x1B\x78\xA4\x10\x76\xA9\xB2\x7A\x68\xF3\x13\x64\xA2\xB2\x63\x44\xAA\x81\x70\x94\x8A\x83\xD3\xAF\x1D\x8E\xC2\x87\xFA\x4B\xFE\xF3\x78\xE3\x67\xFB\x1E\xC9\x08\xE0\xAA\xDA\xEF\x20\x88\x9B\x9B\x45\x3F\x1B\x5A\xF4\x6E\xED\x7E\x7E\x65\x8F\xC1\x57\xC0\x90\xE9\x5F\xF0\x27\x4A\x21\x1E\x6D\xF6\x10\xEB\xB5\xD6\x83\x76\xF3\xA8\xAA\xCF\xD5\xB1\x62\xF1\xA7\xD5\x82\x02\x9A\x4D\x0E\xD1\xFB\x34\x07\x48\xB8\x32\xF4\xB4\xDF\x75\xB4\x94\xEB\x3E\x5F\xEA\x25\xAF\xC7\xAD\xB1\x40\x79\xCF\xAC\x4F\xA8\x71\xD3\xFC\xB9\x9D\x9C\xB2\x25\x4D\x45\x5A\x31\x7F\x2A\xD1\xF5\x5F\x76\x26\x97\x2B\x2B\xB1\x10\xC6\x84\x0E\x2D\x80\xA2\x42\xEA\xA2\x3F\xEE\x46\x24\x9C\xDC\x13\x18\x9A\xBA\x36\x57\xEC\xB1\x6F\x8E\xA2\x1B\x74\xDD\x94\x1E\xE6\x44\xC0\x4B\x43\x50\x56\xFA\xE8\xF6\xDB\xD7\x41\x58\xAC\x8F\x80\x3C\x83\xDA\x4D\x7A\x80\xCC\xEC\xCE\x33\x07\x41\x3D\xF4\x42\x4C\x34\xC2\x9C\x14\xD1\x15\x40\xC7\x16\x6B\xEC\x4E\x5C\x90\x3E\x0E\x2E\xD1\x80\xB9\xB7\x38\xE4\x1A\xFF\x81\x97\x14\x49\x98
>>> tlv_debug: Type 4 value (64 bytes): \x54\x4D\xBE\xFA\x76\x14\x8D\x15\x79\x2F\x0D\xB6\x19\x55\x5A\x5C\xCE\x11\xE2\x02\xD0\xA5\x34\x9B\x28\x00\xB1\x15\xFC\x6D\xC2\xBB\xEB\xD8\x77\x49\xC8\x47\x16\x13\x30\x3F\xD5\x48\x14\x6F\xA7\xBA\x9C\xC4\x42\x9D\x7B\xDE\x37\xE2\xA2\xBD\x40\xE7\xCA\x41\x81\xBB
>>> HomeKit: [Client 1] Pair Setup Step 2/3
>>> homekit_server_on_pair_setup: Free heap: 201288
>>> homekit_server_on_pair_setup: [Client 1] Computing SRP shared secret
>>> homekit_server_on_pair_setup: Free heap: 201288
>>> homekit_server_on_pair_setup: [Client 1] Verifying peer's proof
>>> homekit_server_on_pair_setup: Free heap: 201516
>>> homekit_server_on_pair_setup: [Client 1] Generating own proof
>>> client_sendv: [Client 1] Sending payload: HTTP/1.1 200 OK\x0D\x0AContent-Type: application/pairing+tlv8\x0D\x0ATransfer-Encoding: chunked\x0D\x0AConnection: keep-alive\x0D\x0A\x0D\x0A
>>> client_sendv: [Client 1] Sending payload: \x34\x35\x0D\x0A\x06\x01\x04\x04\x40\x0B\x44\x43\x70\x0B\xFD\xBA\xC4\x11\x42\xFF\xD6\x91\xCC\xB1\xBB\x33\xDC\x7D\xB6\xDF\x0A\x8D\x24\x00\xF7\xA8\xE8\x44\xAB\x3D\x38\x0B\xAC\x86\xBE\x71\x25\x13\xF1\xF4\x47\x5D\xF0\xD9\x7F\x62\xCD\xF0\x4E\x8D\x6F\x4B\xF6\x61\x95\x6E\x30\x2A\x66\x9F\x7A\x0C\x39\x0D\x0A
>>> client_sendv: [Client 1] Sending payload: \x30\x0D\x0A\x0D\x0A
>>> homekit_client_process: [Client 1] Finished processing
>>> HomeKit: [Client 1] Closing client connection from 192.168.178.28

in HomeKit app -> Unable to add Accessory

from wolfssl.

gojimmypi avatar gojimmypi commented on May 23, 2024

Hello @AchimPieters

It looks like you are making excellent progress on your project!

I've reviewed your log, above: it appears wolfSSL is compiling and working properly for you now. What was the problem & solution with your SRP initializer?

Recall I don't have any Apple products, so I am unable to test the HomeKit app with your examples.

The message Unable to add Accessory is rather vague. I'm not sure how I can help you. Is there something with wolfSSL that still needs attention?

from wolfssl.

AchimPieters avatar AchimPieters commented on May 23, 2024

Hello @gojimmypi,

I'm totally lost, can we take it from the top again?

Reproduction steps

Open a terminal window on your mac.

docker pull espressif/idf:latest
  • At this point idf (ESP-IDF v5.3-dev-2032-g4d90eedb6e)
git clone --recursive https://github.com/AchimPieters/esp32-homekit-demo.git
docker run -it -v ~/esp32-homekit-demo:/project -w /project espressif/idf:latest
cd examples/led
idf.py set-target esp32
idf.py menuconfig
  • Select StudioPieters and then (mysid) WIFI SSID and fill in your Wi-Fi Network name, then select (mypassword) WiFI Password and fill in your Wi-Fi Network password.
  • Select component config and then homekit and put a tick at debug output
  • Then press ESC until you are asked Save Configuration? and select (Y)es
idf.py build

And then the errors appear:

it/CMakeFiles/__idf_homekit.dir/src/crypto.c.obj -c /project/components/homekit/src/crypto.c
/project/components/homekit/src/crypto.c:59:19: error: unknown type name 'Srp'
   59 | int wc_SrpSetKeyH(Srp *srp, byte *secret, word32 size) {
      |                   ^~~
/project/components/homekit/src/crypto.c:80:1: error: unknown type name 'Srp'
   80 | Srp *crypto_srp_new() {
      | ^~~
/project/components/homekit/src/crypto.c: In function 'crypto_srp_new':
/project/components/homekit/src/crypto.c:81:9: error: unknown type name 'Srp'
   81 |         Srp *srp = malloc(sizeof(Srp));
      |         ^~~
/project/components/homekit/src/crypto.c:81:34: error: 'Srp' undeclared (first use in this function); did you mean 'srp'?
   81 |         Srp *srp = malloc(sizeof(Srp));
      |                                  ^~~
      |                                  srp
/project/components/homekit/src/crypto.c:81:34: note: each undeclared identifier is reported only once for each function it appears in
/project/components/homekit/src/crypto.c:84:17: error: implicit declaration of function 'wc_SrpInit' [-Werror=implicit-function-declaration]
   84 |         int r = wc_SrpInit(srp, SRP_TYPE_SHA512, SRP_CLIENT_SIDE);
      |                 ^~~~~~~~~~
/project/components/homekit/src/crypto.c:84:33: error: 'SRP_TYPE_SHA512' undeclared (first use in this function); did you mean 'WC_HASH_TYPE_SHA512'?
   84 |         int r = wc_SrpInit(srp, SRP_TYPE_SHA512, SRP_CLIENT_SIDE);
      |                                 ^~~~~~~~~~~~~~~
      |                                 WC_HASH_TYPE_SHA512
/project/components/homekit/src/crypto.c:84:50: error: 'SRP_CLIENT_SIDE' undeclared (first use in this function)
   84 |         int r = wc_SrpInit(srp, SRP_TYPE_SHA512, SRP_CLIENT_SIDE);
      |                                                  ^~~~~~~~~~~~~~~
/project/components/homekit/src/crypto.c:89:12: error: request for member 'keyGenFunc_cb' in something not a structure or union
   89 |         srp->keyGenFunc_cb = wc_SrpSetKeyH;
      |            ^~
/project/components/homekit/src/crypto.c:89:30: error: 'wc_SrpSetKeyH' undeclared (first use in this function)
   89 |         srp->keyGenFunc_cb = wc_SrpSetKeyH;
      |                              ^~~~~~~~~~~~~
/project/components/homekit/src/crypto.c: At top level:
/project/components/homekit/src/crypto.c:95:22: error: unknown type name 'Srp'
   95 | void crypto_srp_free(Srp *srp) {
      |                      ^~~
/project/components/homekit/src/crypto.c:101:21: error: unknown type name 'Srp'
  101 | int crypto_srp_init(Srp *srp, const char *username, const char *password) {
      |                     ^~~
/project/components/homekit/src/crypto.c:153:25: error: unknown type name 'Srp'
  153 | int crypto_srp_get_salt(Srp *srp, byte *buffer, size_t *buffer_size) {
      |                         ^~~
/project/components/homekit/src/crypto.c:168:31: error: unknown type name 'Srp'
  168 | int crypto_srp_get_public_key(Srp *srp, byte *buffer, size_t *buffer_size) {
      |                               ^~~
/project/components/homekit/src/crypto.c:187:9: error: unknown type name 'Srp'
  187 |         Srp *srp,
      |         ^~~
/project/components/homekit/src/crypto.c:205:23: error: unknown type name 'Srp'
  205 | int crypto_srp_verify(Srp *srp, const byte *proof, size_t proof_size) {
      |                       ^~~
/project/components/homekit/src/crypto.c:216:26: error: unknown type name 'Srp'
  216 | int crypto_srp_get_proof(Srp *srp, byte *proof, size_t *proof_size) {
      |                          ^~~
/project/components/homekit/src/crypto.c:263:9: error: unknown type name 'Srp'
  263 |         Srp *srp,
      |         ^~~
/project/components/homekit/src/crypto.c: In function 'crypto_chacha20poly1305_decrypt':
/project/components/homekit/src/crypto.c:282:29: error: 'CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE' undeclared (first use in this function)
  282 |         if (message_size <= CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE) {
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/project/components/homekit/src/crypto.c:298:17: error: implicit declaration of function 'wc_ChaCha20Poly1305_Decrypt'; did you mean 'crypto_chacha20poly1305_decrypt'? [-Werror=implicit-function-declaration]
  298 |         int r = wc_ChaCha20Poly1305_Decrypt(
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                 crypto_chacha20poly1305_decrypt
/project/components/homekit/src/crypto.c: In function 'crypto_chacha20poly1305_encrypt':
/project/components/homekit/src/crypto.c:315:37: error: 'CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE' undeclared (first use in this function)
  315 |         size_t len = message_size + CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE;
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/project/components/homekit/src/crypto.c:323:17: error: implicit declaration of function 'wc_ChaCha20Poly1305_Encrypt'; did you mean 'crypto_chacha20poly1305_encrypt'? [-Werror=implicit-function-declaration]
  323 |         int r = wc_ChaCha20Poly1305_Encrypt(
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                 crypto_chacha20poly1305_encrypt
cc1: some warnings being treated as errors
[909/921] Building C object esp-idf/es...s/__idf_espressif__mdns.dir/mdns.c.obj
ninja: build stopped: subcommand failed.
ninja failed with exit code 1, output of the command is in the /project/examples/led/build/log/idf_py_stderr_output_471 and /project/examples/led/build/log/idf_py_stdout_output_471
root@6659c5f65e9d:/project/examples/led# 

here is my current unchanged user settings file: https://github.com/AchimPieters/esp32-homekit-demo/blob/main/components/wolfssl/include/user_settings.h

I've tried the "old" fixes, but they resolve the problem "kindisch", maybebe we can have a look specific at the current setup en solve them step by step, to see if this solves the problems?

from wolfssl.

AchimPieters avatar AchimPieters commented on May 23, 2024

@gojimmypi I added the lines and did a compile, everything worked fine until this error?

app partition is too small for binary main.bin is the new version of wolfssl that much bigger then the previous one?

FAILED: esp-idf/esptool_py/CMakeFiles/app_check_size /project/examples/led/build/esp-idf/esptool_py/CMakeFiles/app_check_size 
cd /project/examples/led/build/esp-idf/esptool_py && /opt/esp/python_env/idf5.3_py3.10_env/bin/python /opt/esp/idf/components/partition_table/check_sizes.py --offset 0x8000 partition --type app /project/examples/led/build/partition_table/partition-table.bin /project/examples/led/build/main.bin
Error: app partition is too small for binary main.bin size 0x100720:
  - Part 'factory' 0/0 @ 0x10000 size 0x100000 (overflow 0x720)
ninja: build stopped: subcommand failed.
ninja failed with exit code 1, output of the command is in the /project/examples/led/build/log/idf_py_stderr_output_471 and /project/examples/led/build/log/idf_py_stdout_output_471
root@18cf358e7bae:/project/examples/led# 

When changing the partition table to:

# ESP-IDF Partition Table
# Name,   Type, SubType, Offset,  Size,   Flags
nvs,      data, nvs,     0x9000,  0x5000,
phy_init, data, phy,     0xe000,  0x1000,
homekit,  data, homekit, 0xf000,  0x1000,
factory,  app,  factory, 0x10000, 2M,

I can compile without any error, but then when I want to add the accessory to HomeKit it gives this errror:

I (3851) IP_EVENT: WiFI ready
>>> HomeKit: Starting server
>>> HomeKit: Using existing accessory ID: 2B:BC:E2:25:EC:3F
>>> HomeKit: Configuring mDNS
>>> homekit_setup_mdns: Accessory Setup ID = 1QJ8
>>> homekit_run_server: Starting HTTP server
>>> homekit_server_accept_client: Free heap: 210860
>>> HomeKit: [Client 1] Got new client connection from 192.168.178.28
>>> homekit_client_process: [Client 1] Got 132 incoming data
>>> homekit_server_on_pair_setup: Pair Setup
>>> homekit_server_on_pair_setup: Free heap: 211248
>>> tlv_debug: Got following TLV values:
>>> tlv_debug: Type 0 value (1 bytes): \x00
>>> tlv_debug: Type 6 value (1 bytes): \x01
>>> HomeKit: [Client 1] Pair Setup Step 1/3
>>> homekit_server_on_pair_setup: Free heap: 211136
>>> crypto_srp_new: Initializing SRP
>>> homekit_server_on_pair_setup: [Client 1] Initializing crypto
>>> homekit_server_on_pair_setup: Free heap: 208304
>>> homekit_server_on_pair_setup: [Client 1] Using user-specified password: 338-77-883
>>> 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: Failed to get SRP verifier (code -1)
!!! HomeKit: [Client 1] Failed to initialize SRP
>>> client_sendv: [Client 1] Sending payload: HTTP/1.1 200 OK\x0D\x0AContent-Type: application/pairing+tlv8\x0D\x0ATransfer-Encoding: chunked\x0D\x0AConnection: keep-alive\x0D\x0A\x0D\x0A
>>> client_sendv: [Client 1] Sending payload: \x36\x0D\x0A\x06\x01\x02\x07\x01\x01\x0D\x0A
>>> client_sendv: [Client 1] Sending payload: \x30\x0D\x0A\x0D\x0A
>>> homekit_client_process: [Client 1] Finished processing
>>> HomeKit: [Client 1] Closing client connection from 192.168.178.28

so the known >>> crypto_srp_init: Failed to get SRP verifier (code -1) as seen here: #6870 (comment)

I could follow the steps above, but want to do this together with you, so we are and stay on the same page.

So what do you recommend doing.

from wolfssl.

AchimPieters avatar AchimPieters commented on May 23, 2024

@gojimmypi

Okay, that did something. Now I still get "Unable to add accessory" and in the terminal:

I (4262) IP_EVENT: WiFI ready
>>> HomeKit: Starting server
>>> HomeKit: Using existing accessory ID: 30:EC:BB:7A:1F:40
>>> HomeKit: Configuring mDNS
>>> homekit_setup_mdns: Accessory Setup ID = 1QJ8
>>> homekit_run_server: Starting HTTP server
>>> homekit_server_accept_client: Free heap: 210832
>>> HomeKit: [Client 1] Got new client connection from 192.168.178.28
>>> homekit_client_process: [Client 1] Got 132 incoming data
>>> homekit_server_on_pair_setup: Pair Setup
>>> homekit_server_on_pair_setup: Free heap: 211220
>>> tlv_debug: Got following TLV values:
>>> tlv_debug: Type 0 value (1 bytes): \x00
>>> tlv_debug: Type 6 value (1 bytes): \x01
>>> HomeKit: [Client 1] Pair Setup Step 1/3
>>> homekit_server_on_pair_setup: Free heap: 211112
>>> crypto_srp_new: Initializing SRP
>>> homekit_server_on_pair_setup: [Client 1] Initializing crypto
>>> homekit_server_on_pair_setup: Free heap: 202136
>>> homekit_server_on_pair_setup: [Client 1] Using user-specified password: 338-77-883
>>> 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
>>> client_sendv: [Client 1] Sending payload: HTTP/1.1 200 OK\x0D\x0AContent-Type: application/pairing+tlv8\x0D\x0ATransfer-Encoding: chunked\x0D\x0AConnection: keep-alive\x0D\x0A\x0D\x0A
>>> client_sendv: [Client 1] Sending payload: \x31\x39\x39\x0D\x0A\x03\xFF\x1E\xCD\xCB\xE9\x02\x7A\x15\x06\xDB\x98\x8C\xC5\xA5\x8A\xCE\x94\xAC\xE7\x9B\xFD\x3E\xCE\x6A\x71\x2E\x09\x61\xC3\xB1\xF9\x26\x70\xEC\x3C\xCA\x81\x0F\x51\x52\x43\x36\x4C\xC2\xB8\x28\x77\x32\xFB\x4B\xBC\x8E\xB5\x26\xE8\x16\xFF\x8E\x67\xA5\x99\x37\x3D\x9D\x20\x9E\xDE\x08\x34\xF0\xB9\x20\xE8\x37\x4E\xE9\x8F\xFE\x0F\x03\xE0\x7A\x44\x4C\x0A\xA5\xFB\x77\xA4\x57\x2B\xC9\xA3\x9B\x17\x96\xFA\x94\xBA\xEA\xCD\x37\x22\x4D\x31\xE0\x80\x34\x8D\x8D\x0F\x88\x84\x38\x76\xCE\x29\xEF\x7C\x1C\x58\xD4\x02\xF5\x6C\x5B\xD5\xF6\x2B\xCF\x0F\x2C\xFC\x49\xDA\x8E\xDB\xAE\xBC\xD3\xF0\xDD\x17\x10\x6E\x3D\xA4\x45\x2C\xF5\x6B\x38\x5D\x48\x3A\x21\xF1\xCB\xEB\xA1\xE4\x05\x06\xFD\xB8\x84\x4D\x60\x9D\xFE\xC4\xEB\x61\x1D\x65\xEB\xA7\xD4\xC1\xD0\x64\x7E\xD4\xF1\x59\xB4\xCE\x9E\x34\x07\xCA\x8E\x0D\x13\x65\xE0\x4E\x73\x94\xFE\xDF\x02\xE7\x86\x88\xFB\xAB\xC4\x9F\xAB\x10\x25\x81\xC9\xDF\x19\x08\x02\xEA\x1B\x0F\xD5\xC7\xC3\x76\x2D\x57\x77\xA5\x29\xBA\x77\x95\x7F\xB0\xC0\xE7\x69\x9F\xFE\x2D\x0F\xDC\x31\x02\x7D\xFA\x95\xC1\xBC\x4C\xD7\xE3\x1C\x94\x9B\x03\x81\x20\xB2\x15\xFD\xBE\xFB\x3B\xD2\xC3\x7A\x9E\xCA\xBF\xE1\x2B\x78\x54\xDA\xB8\xB4\x7D\x51\x53\x3D\xB6\xF2\x98\x19\xBB\xAD\x48\xDB\xE4\x84\xF8\xAA\x38\xDF\x1A\x18\x03\x95\x77\x2B\xD2\x62\xAC\xA0\x6E\x84\xB9\x5E\xE4\xD7\x0B\x38\x4F\x81\x74\xCF\x6F\x11\x91\x9A\xA8\xD8\x08\xAF\x83\x42\xC8\x74\x9A\x77\x82\x98\x18\xFF\x01\x2A\x0F\x17\xCC\xAC\x29\xD4\xF7\xF5\xC2\x7E\x77\x3F\x98\x52\x19\x9F\x89\xFC\x9D\xE1\xA3\x6F\x67\xEE\x6D\x69\x07\x40\xDA\x85\x7A\xCC\x5D\x76\x85\x54\x9C\xCF\x1D\xEC\x63\x3D\x37\xFC\xCF\xC2\xD3\x4E\x10\x02\x10\x7E\x21\xAF\xFD\xDA\x5A\x55\xE5\x8C\x71\x85\x6D\x89\x18\x30\xFF\x06\x01\x02\x0D\x0A
>>> client_sendv: [Client 1] Sending payload: \x30\x0D\x0A\x0D\x0A
>>> homekit_client_process: [Client 1] Finished processing
>>> homekit_client_process: [Client 1] Got 585 incoming data
>>> homekit_server_on_pair_setup: Pair Setup
>>> homekit_server_on_pair_setup: Free heap: 201500
>>> tlv_debug: Got following TLV values:
>>> tlv_debug: Type 6 value (1 bytes): \x03
>>> tlv_debug: Type 3 value (384 bytes): \xC1\x73\xA4\xDF\xCF\x66\xFD\xC3\x74\x21\x5C\x05\xB2\xB7\x47\x30\x9E\xAB\xCA\xA9\x88\x50\x3B\x20\x29\xE9\xCB\x9D\x38\xDD\xA5\x94\x9C\xE3\xE3\x7E\xC5\x28\xD5\x31\xC8\x3E\x8A\x0A\x6D\x8A\xE2\x0B\x1C\x3F\xF7\xEC\x6D\x45\xAD\xDD\x7B\xFF\x7A\xA1\x4A\xA3\x81\xBA\x9B\x7A\xC0\x0C\xF7\x50\x32\xA1\x52\xEE\xF0\x74\x27\x04\x3C\x58\x1B\xD2\xE9\x21\xF4\x64\xDA\x4A\x0A\xCC\x13\x20\xB2\x93\x57\x1B\x5C\xF2\x8B\x94\xDF\x37\x86\x3A\x46\x18\x3F\x47\x05\x98\xA5\x7C\xE3\x41\x33\x21\x1F\xD7\x8E\x4E\xD2\x8C\x55\x20\x4B\x1B\x9F\x29\x8C\x06\xBA\xCC\x76\x82\x44\x94\x53\xE2\xCF\xB1\x88\x1E\x82\x6A\xC9\x96\x5B\xF5\x59\x24\x8E\x6A\x9E\x67\x5A\x2F\xA2\x87\xF4\xE3\x31\x20\xA7\x2D\xF3\x29\x74\xBF\x91\xC0\xFF\x4B\x3C\x51\x13\x27\x25\xE0\xF6\x34\xCC\x5F\x88\xED\x36\x7E\xAA\xB8\x1F\x39\xE9\x21\x92\xED\x03\x49\xCE\xFD\xBA\x38\xD8\x38\x6B\x83\x7E\x5C\xB0\xD3\xAC\x79\x14\x24\xC4\xD3\xCE\x9F\xA0\xC0\x07\x7E\x53\xF3\xD8\xA0\x45\xC7\x8E\xC0\xE2\x71\x84\x04\x25\x39\x17\x40\xD4\xCA\xDF\x85\xD7\x33\x6A\xA3\x4F\xF3\x34\x72\x67\xCA\x2C\x78\x72\xFD\x09\xBB\x79\x4C\x99\x45\x69\xAC\x7E\xAC\xBD\xF2\x5E\x02\x02\x31\x2E\x89\x80\x84\x14\xE2\x02\x47\x41\x93\xE2\xB1\x38\x79\xFB\xE7\x97\x66\xEE\xD2\x68\xDA\x06\x46\x68\x39\x50\xD3\xBA\x7D\x1D\xB5\x87\xF1\x18\xCF\xBA\x76\x13\xAB\x51\xD4\x1D\x5F\x96\x07\x53\x23\xF8\x94\x3E\x0D\xEC\x1D\x20\xD0\x7D\x00\xF4\x8A\x0E\x7D\xB2\x92\x3E\x0E\x0C\xAF\xD9\xE8\x16\x37\xA4\x9B\x1A\x9E\xD7\x54\x18\x20\x38\x97\x30\x40\xAD\x36\xAC\x93\x8F\x41\x00\x1A\x3A\xA1\xAB\xB2\xFD\xCC\xED\xFF\x7A\x5F\xDF\x7C\x97\x98\x89\x46\x6F\x4D\xD3\x6F\x6E\xAE
>>> tlv_debug: Type 4 value (64 bytes): \x29\xD0\x37\xD9\xCE\x1C\x35\x4B\x00\x61\xC1\x75\xD8\xF0\xF6\x4B\x90\x7D\xB0\x32\x35\x77\x7E\xF0\xCF\x56\xBD\x0C\xD4\x2E\xA3\x96\x53\xD9\x87\xBB\x25\x52\xC3\x4F\xEC\x6A\x5C\x7F\x40\x46\x7A\x7E\x6B\xC3\x9E\x0C\x9D\x3B\x84\x88\x39\x30\x1A\xF9\xCB\x20\xB4\x7A
>>> HomeKit: [Client 1] Pair Setup Step 2/3
>>> homekit_server_on_pair_setup: Free heap: 201104
>>> homekit_server_on_pair_setup: [Client 1] Computing SRP shared secret
>>> homekit_server_on_pair_setup: Free heap: 201180
>>> homekit_server_on_pair_setup: [Client 1] Verifying peer's proof
>>> homekit_server_on_pair_setup: Free heap: 201500
>>> homekit_server_on_pair_setup: [Client 1] Generating own proof
>>> client_sendv: [Client 1] Sending payload: HTTP/1.1 200 OK\x0D\x0AContent-Type: application/pairing+tlv8\x0D\x0ATransfer-Encoding: chunked\x0D\x0AConnection: keep-alive\x0D\x0A\x0D\x0A
>>> client_sendv: [Client 1] Sending payload: \x34\x35\x0D\x0A\x06\x01\x04\x04\x40\x6A\x2C\x00\x97\x57\xF4\x26\x0B\xD5\x58\x1D\x79\xE0\x3B\x5F\x23\xF4\x22\xB5\x85\xEF\xC2\xB3\x72\x52\x16\x8A\x70\x3E\xB8\x41\xC1\x3E\x90\x67\xF9\x2F\x36\x40\x02\x73\x7E\x85\x85\xD6\xEB\x9B\x3A\xB2\xFB\x29\xA6\x18\x96\xA7\x4B\xE2\x37\xAE\x97\x21\x4B\x89\x8B\x0D\x0A
>>> client_sendv: [Client 1] Sending payload: \x30\x0D\x0A\x0D\x0A
>>> homekit_client_process: [Client 1] Finished processing
>>> HomeKit: [Client 1] Closing client connection from 192.168.178.28

The SRP works kindich...

Current files and setup: https://github.com/AchimPieters/esp32-homekit-demo.git

from wolfssl.

AchimPieters avatar AchimPieters commented on May 23, 2024

@gojimmypi The first test worked, I'm going to do some tests this weekend to see if it also works on a ESPC2-02 and other esp models. I Will let you know, so far so good!

I enabled all these lines in user_settings.h

#define NO_ESP32_CRYPT
   #define NO_WOLFSSL_ESP32_CRYPT_HASH
   #define NO_WOLFSSL_ESP32_CRYPT_AES
   #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
   #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL 
   #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD 
   #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD

from wolfssl.

AchimPieters avatar AchimPieters commented on May 23, 2024

Tested:

ESP32 WROOM 32D - SUCCES!
ESP32C2 (ESP8684) - Still looking in too...
ESPC3 (ESP-C3-12F Kit):

I (3643) IP_EVENT: WiFI ready
>>> HomeKit: Starting server
>>> HomeKit: Using existing accessory ID: C5:D6:C1:32:8A:B4
>>> HomeKit: Configuring mDNS
>>> homekit_setup_mdns: Accessory Setup ID = 1QJ8
>>> homekit_run_server: Starting HTTP server
>>> homekit_server_accept_client: Free heap: 209740
>>> HomeKit: [Client 1] Got new client connection from 192.168.178.28
>>> homekit_client_process: [Client 1] Got 132 incoming data
>>> homekit_server_on_pair_setup: Pair Setup
>>> homekit_server_on_pair_setup: Free heap: 211476
>>> tlv_debug: Got following TLV values:
>>> tlv_debug: Type 0 value (1 bytes): \x00
>>> tlv_debug: Type 6 value (1 bytes): \x01
>>> HomeKit: [Client 1] Pair Setup Step 1/3
>>> homekit_server_on_pair_setup: Free heap: 211376
>>> crypto_srp_new: Initializing SRP
>>> homekit_server_on_pair_setup: [Client 1] Initializing crypto
>>> homekit_server_on_pair_setup: Free heap: 208564
>>> homekit_server_on_pair_setup: [Client 1] Using user-specified password: 338-77-883
>>> 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: Failed to get SRP verifier (code -1)
!!! HomeKit: [Client 1] Failed to initialize SRP
>>> client_sendv: [Client 1] Sending payload: HTTP/1.1 200 OK\x0D\x0AContent-Type: application/pairing+tlv8\x0D\x0ATransfer-Encoding: chunked\x0D\x0AConnection: keep-alive\x0D\x0A\x0D\x0A
>>> client_sendv: [Client 1] Sending payload: \x36\x0D\x0A\x06\x01\x02\x07\x01\x01\x0D\x0A
>>> client_sendv: [Client 1] Sending payload: \x30\x0D\x0A\x0D\x0A
>>> homekit_client_process: [Client 1] Finished processing
>>> HomeKit: [Client 1] Closing client connection from 192.168.178.28

The SRP error is back Failed to get SRP verifier (code -1) ?

from wolfssl.

gojimmypi avatar gojimmypi commented on May 23, 2024

Hi @AchimPieters - That's awesome you have it working!

Regarding your ESP-C3-12F Kit: The default hardware acceleration disabling is SoC-specific. Can you please confirm you've disabled it for the ESP32-C3 in your user_settings.h for the CONFIG_IDF_TARGET_ESP32C3?

You may also consider moving the definitions completely outside of the conditional SoC check to disable all hardware acceleration for all devices.

I'll need to look into why the hardware acceleration passes all tests but apparently causes the SRP to fail.

Well done on making such great progress! Cheers

from wolfssl.

AchimPieters avatar AchimPieters commented on May 23, 2024

@gojimmypi, You are awesome, couldn't do it without you! Thank you so much!

Regarding the User_settings.h here is my latest files: https://github.com/AchimPieters/esp32-homekit-demo.git

I'll keep working en testing this weekend, and will share my results!

from wolfssl.

AchimPieters avatar AchimPieters commented on May 23, 2024

@gojimmypi I have checked, double-checked, Krajiceked...

But the SRP verifier (code -1) keeps a mystery.

I also have ordered some ESP32XX Devkits for better debugging capabilities...

from wolfssl.

gojimmypi avatar gojimmypi commented on May 23, 2024

Hello @AchimPieters -

Can you please confirm the SRP is fully operational with the hardware acceleration confirmed as disabled for the respective target ESP32 SoC flavor? (I'm not sure I understand the Richard Krajicek tennis link: essentially "quadruple checked"?). Your prior comment seemed to indicate success, but the most recent comment indicates otherwise.

Unless running out of heap or stack, or something wrong with the calling application... I would expect the wolfSSL SRP to be 100% operational in software only mode. (and in theory with hardware acceleration, if everything there is working properly).

I'm assuming this is a hardware acceleration problem, similar to the issue I mentioned with the wolfSSH signature and the interleaved hash calcs not being handled properly. I recently updated the wolfCrypt tests for checking SHA interleaving in #7262.

I believe I've resolved SHA interleave problem with another PR coming soon. It could well be the SRP has a similar or same problem.

I'll be giving this a high priority to resolve. I need to be 100% certain of the results your are seeing, particularly since I don't have the hardware to reproduce myself.

If you are ordering new ESP32 boards: one thing I should have mentioned that in addition to the Tigard external JTAG, the newer Espressif boards with 2 USB ports typically also have JTAG built-in to the board. It is of course not as flexible as having a stand-alone JTAG, but at least that specific board can use the JTAG debugger quite easily.

Thanks for your help. Cheers

from wolfssl.

AchimPieters avatar AchimPieters commented on May 23, 2024

@gojimmypi the SRP is fully operational with the hardware acceleration confirmed as disabled for the respective target ESP32 SoC flavor, But Not for the ESP32C3 and other models.

The Krajicek, was maybe a bad word joke, sorry but that....

ETA for the new ESP boards with double USB ports for better debugging is 7 days, once I receive them, I can do a model by model test. Thank You for your continuous support, you're the best!

from wolfssl.

AchimPieters avatar AchimPieters commented on May 23, 2024

@gojimmypi, I received the modules ESP32, ESP32C2, ESP32C3 and ESP32S3.

As said the ESP32 works, but the other models got SRP errors, I attach a log from every model.
ESP32S2.log
ESP32C3.log
ESP32C2.log
ESP32.log

from wolfssl.

gojimmypi avatar gojimmypi commented on May 23, 2024

@AchimPieters Thank you for the additional details and congratulations on your new purchases of other ESP32 devices!

As you said the ESP32 works, but we disabled the hardware acceleration there, right? It appears that your user_settings.h also has hardware disabled for the ESP32-C3. Are you saying that even in software-only mode, you are still seeing SRP errors?

If indeed your are seeing software-only problems, I suggest turning on the stack smashing and heap corruption detection. Perhaps there's a low memory problem. The SRP is fairly robust and unlikely to have problems with hardware acceleration turned off.

I'm actively working on a solution to this & appreciate any additional information.

from wolfssl.

AchimPieters avatar AchimPieters commented on May 23, 2024

@gojimmypi

Are you saying that even in software-only mode, you are still seeing SRP errors?
Yes, as we discussed above, I changed the user_settings.h and there are still SRP errors.

So I'm going to try to follow your advice and turn on the stack smashing and heap corruption detection, and keep you updated.

from wolfssl.

gojimmypi avatar gojimmypi commented on May 23, 2024

Hi @AchimPieters

Thanks for the confirmation. I have a fix in the works for the SRP issue. It's my active development branch, but this commit should be relatively good if you'd like to take it for a test drive.

In particular, I have this updated wolfssl_test app that specifically includes a test for the SRP enabled. (and many other features enabled, for the most exhaustive ESP32 test ever). fwiw - I never saw an SRP failure in software-only mode.

It is of course not the same as your actual Homekit app: Perhaps an updated test is in order if you've found something new.

I hope to have a PR together in the relatively near future.

from wolfssl.

AchimPieters avatar AchimPieters commented on May 23, 2024

@gojimmypi Okay I have given it a try, but got this error:

[858/926] Building C object esp-idf/wo...df_wolfssl.dir/wolfcrypt/src/tfm.c.obj
FAILED: esp-idf/wolfssl/CMakeFiles/__idf_wolfssl.dir/wolfcrypt/src/tfm.c.obj 
ccache /opt/esp/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc -DESP_PLATFORM -DIDF_VER=\"v5.3-dev-2032-g4d90eedb6e\" -DLIBWOLFSSL_VERSION_GIT_BRANCH=\"main\" -DLIBWOLFSSL_VERSION_GIT_HASH=\"1844b49d56e923e612beb14ae11174f0e59f9fc4\" -DLIBWOLFSSL_VERSION_GIT_HASH_DATE="\"'Sun Mar 10 16:22:33 2024 +0100'\"" -DLIBWOLFSSL_VERSION_GIT_ORIGIN=\"https://github.com/AchimPieters/esp32-homekit-demo.git\" -DLIBWOLFSSL_VERSION_GIT_SHORT_HASH=\"1844b49\" -DLIBWOLFSSL_VERSION_WOLFSSL_ROOT=\"/project/components/wolfssl\" -DSOC_MMU_PAGE_SIZE=CONFIG_MMU_PAGE_SIZE -DSOC_XTAL_FREQ_MHZ=CONFIG_XTAL_FREQ -DWOLFSSL_USER_SETTINGS_DIR=\"//project//examples//led//components//wolfssl//include//user_settings.h\" -D_GLIBCXX_HAVE_POSIX_SEMAPHORE -D_GLIBCXX_USE_POSIX_SEMAPHORE -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS -I/project/examples/led/build/config -I/project/components/wolfssl/include -I/project/components/wolfssl -I/project/components/wolfssl/wolfssl -I/project/components/wolfssl/wolfssl/wolfcrypt -I/project/components/wolfssl/wolfssl/wolfcrypt/port/Espressif -I/opt/esp/idf/components/freertos/FreeRTOS-Kernel/include/freertos -I/opt/esp/idf/components/newlib/platform_include -I/opt/esp/idf/components/freertos/config/include -I/opt/esp/idf/components/freertos/config/include/freertos -I/opt/esp/idf/components/freertos/config/xtensa/include -I/opt/esp/idf/components/freertos/FreeRTOS-Kernel/include -I/opt/esp/idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include -I/opt/esp/idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos -I/opt/esp/idf/components/freertos/esp_additions/include -I/opt/esp/idf/components/esp_hw_support/include -I/opt/esp/idf/components/esp_hw_support/include/soc -I/opt/esp/idf/components/esp_hw_support/include/soc/esp32 -I/opt/esp/idf/components/esp_hw_support/dma/include -I/opt/esp/idf/components/esp_hw_support/port/esp32/. -I/opt/esp/idf/components/esp_hw_support/port/esp32/include -I/opt/esp/idf/components/heap/include -I/opt/esp/idf/components/log/include -I/opt/esp/idf/components/soc/include -I/opt/esp/idf/components/soc/esp32 -I/opt/esp/idf/components/soc/esp32/include -I/opt/esp/idf/components/hal/platform_port/include -I/opt/esp/idf/components/hal/esp32/include -I/opt/esp/idf/components/hal/include -I/opt/esp/idf/components/esp_rom/include -I/opt/esp/idf/components/esp_rom/include/esp32 -I/opt/esp/idf/components/esp_rom/esp32 -I/opt/esp/idf/components/esp_common/include -I/opt/esp/idf/components/esp_system/include -I/opt/esp/idf/components/esp_system/port/soc -I/opt/esp/idf/components/esp_system/port/include/private -I/opt/esp/idf/components/xtensa/esp32/include -I/opt/esp/idf/components/xtensa/include -I/opt/esp/idf/components/xtensa/deprecated_include -I/opt/esp/idf/components/lwip/include -I/opt/esp/idf/components/lwip/include/apps -I/opt/esp/idf/components/lwip/include/apps/sntp -I/opt/esp/idf/components/lwip/lwip/src/include -I/opt/esp/idf/components/lwip/port/include -I/opt/esp/idf/components/lwip/port/freertos/include -I/opt/esp/idf/components/lwip/port/esp32xx/include -I/opt/esp/idf/components/lwip/port/esp32xx/include/arch -I/opt/esp/idf/components/lwip/port/esp32xx/include/sys -mlongcalls -Wno-frame-address  -DWOLFSSL_USER_SETTINGS -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX -fdiagnostics-color=always -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -Og -fno-shrink-wrap -fmacro-prefix-map=/project/examples/led=. -fmacro-prefix-map=/opt/esp/idf=/IDF -fstrict-volatile-bitfields -fno-jump-tables -fno-tree-switch-conversion -std=gnu17 -Wno-old-style-declaration -MD -MT esp-idf/wolfssl/CMakeFiles/__idf_wolfssl.dir/wolfcrypt/src/tfm.c.obj -MF esp-idf/wolfssl/CMakeFiles/__idf_wolfssl.dir/wolfcrypt/src/tfm.c.obj.d -o esp-idf/wolfssl/CMakeFiles/__idf_wolfssl.dir/wolfcrypt/src/tfm.c.obj -c /project/components/wolfssl/wolfcrypt/src/tfm.c
/project/components/wolfssl/wolfcrypt/src/tfm.c: In function '_fp_exptmod_nct':
/project/components/wolfssl/wolfcrypt/src/tfm.c:2467:6: error: implicit declaration of function 'WOLFSSL_MSG_EX' [-Werror=implicit-function-declaration]
 2467 |      WOLFSSL_MSG_EX("_fp_exptmod_nct XMALLOC failed: %d", (word32)sizeof(fp_int)*((1 << winsize) + 1));
      |      ^~~~~~~~~~~~~~
/project/components/wolfssl/wolfcrypt/src/tfm.c: In function 'fp_exptmod_nct':
/project/components/wolfssl/wolfcrypt/src/tfm.c:3313:7: error: implicit declaration of function 'WOLFSSL_MSG'; did you mean 'WOLFSSL_API'? [-Werror=implicit-function-declaration]
 3313 |       WOLFSSL_MSG("handle modulus of zero");
      |       ^~~~~~~~~~~
      |       WOLFSSL_API
cc1: some warnings being treated as errors
[863/926] Building C object esp-idf/wo...df_wolfssl.dir/wolfcrypt/src/srp.c.obj
ninja: build stopped: subcommand failed.
ninja failed with exit code 1, output of the command is in the /project/examples/led/build/log/idf_py_stderr_output_713 and /project/examples/led/build/log/idf_py_stdout_output_713
root@5afeccbad994:/project/examples/led# 

I don't know whether I did something wrong or something wrong with your branch?

from wolfssl.

gojimmypi avatar gojimmypi commented on May 23, 2024

Hi @AchimPieters

My branch is under active development so at some point, there might have been inoperable code at some point.

When WOLFSSL_MSG and/or WOLFSSL_MSG_EX is missing, simply include the wolfSSL logging header:

#include <wolfssl/wolfcrypt/logging.h>

The wolfcrypt TFM library does not include this by default. I must have been testing something. Feel free to add the include or simply comment out those lines. They are only interesting with #define DEBUG_WOLFSSL in the user_settings.h and turned on with wolfSSL_Debugging_ON();

My latest branch update is working well with SRP and includes an improved logging messages when heap allocation fails. It would be great for you to take it for a test drive.

from wolfssl.

AchimPieters avatar AchimPieters commented on May 23, 2024

@gojimmypi I've updated wolfssl to the latest branch update, but got the same error. Then I added #include <wolfssl/wolfcrypt/logging.h> but then I got this:

ir/src/internal.c.obj -c /project/components/wolfssl/src/internal.c
In file included from /project/components/wolfssl/wolfssl/wolfcrypt/logging.h:3,
                 from /project/components/wolfssl/include/user_settings.h:23,
                 from /project/components/wolfssl/wolfssl/wolfcrypt/settings.h:301,
                 from /project/components/wolfssl/src/internal.c:28:
/project/components/wolfssl/wolfssl/wolfcrypt/types.h:1293:46: error: missing binary operator before token "("
 1293 |     #if defined(HAVE_FIPS) && FIPS_VERSION_LT(5,3)
      |                                              ^
/project/components/wolfssl/wolfssl/wolfcrypt/types.h:1648:24: error: missing binary operator before token "("
 1648 |     #if FIPS_VERSION_GE(5,1)
      |                        ^
/project/components/wolfssl/wolfssl/wolfcrypt/settings.h:1006: warning: "XMALLOC" redefined
 1006 |         #define XMALLOC(s, h, type)  ((void)(h), (void)(type), pvPortMalloc((s)))
      | 
/project/components/wolfssl/wolfssl/wolfcrypt/types.h:575: note: this is the location of the previous definition
  575 |                 #define XMALLOC(s, h, t)     ((void)(h), (void)(t), wolfSSL_Malloc((s)))
      | 
/project/components/wolfssl/wolfssl/wolfcrypt/settings.h:1007: warning: "XFREE" redefined
 1007 |         #define XFREE(p, h, type)    ((void)(h), (void)(type), vPortFree((p)))
      | 
/project/components/wolfssl/wolfssl/wolfcrypt/types.h:579: note: this is the location of the previous definition
  579 |                     #define XFREE(p, h, t)       {void* xp = (p); (void)(h); (void)(t); if (xp) wolfSSL_Free(xp);}
      | 
/project/components/wolfssl/wolfssl/wolfcrypt/settings.h:1012: warning: "XREALLOC" redefined
 1012 |                 #define XREALLOC(p, n, h, t) ((void)(h), (void)(t), realloc((p), (n)))
      | 
/project/components/wolfssl/wolfssl/wolfcrypt/types.h:581: note: this is the location of the previous definition
  581 |                 #define XREALLOC(p, n, h, t) ((void)(h), (void)(t), wolfSSL_Realloc((p), (n)))
      | 
ninja: build stopped: subcommand failed.
ninja failed with exit code 1, output of the command is in the /project/examples/led/build/log/idf_py_stderr_output_7284 and /project/examples/led/build/log/idf_py_stdout_output_7284
root@9eb0400574ee:/project/examples/led# 

from wolfssl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.