Skip to content

fix(idf): enable noise-c protocol name table for Noise_KKpsk2 - #129

Open
raine-works wants to merge 1 commit into
Sendspin:encryption-supportfrom
raine-works:fix/noise-c-protocol-name-table
Open

raine-works wants to merge 1 commit into
Sendspin:encryption-supportfrom
raine-works:fix/noise-c-protocol-name-table

Conversation

@raine-works

Copy link
Copy Markdown

Problem

When building sendspin-cpp for ESP-IDF / ESPHome with esphome__noise-c, upstream esphome__noise-c hardcodes NOISE_USE_PROTOCOL_NAME_TABLE=0. This causes noise-c to compile names-single.c, which only registers Noise_NNpsk0 (used by ESPHome's native API).

When Music Assistant connects with Noise_KKpsk2_25519_ChaChaPoly_SHA256, noise_handshakestate_new_by_name() fails with NOISE_ERROR_UNKNOWN_NAME (0x0202):

[E][sendspin.noise_session]: noise_handshakestate_new_by_name failed for suite Noise_KKpsk2_25519_ChaChaPoly_SHA256

Solution

  1. In CMakeLists.txt, inspect target definitions on esphome__noise-c and __idf_esphome__noise-c. Remove NOISE_USE_PROTOCOL_NAME_TABLE=0 and set NOISE_USE_PROTOCOL_NAME_TABLE=1, enabling the full protocol suite table.
  2. In src/noise_session.cpp, log the error code returned by noise_handshakestate_new_by_name() to aid diagnosis.

Testing

Tested end-to-end on ESP32 hardware running ESPHome with ESP-IDF against Music Assistant. The Noise_KKpsk2 handshake completes successfully and activates encrypted transport:

[sendspin.noise_handshake]: Noise handshake complete: server_id=... psk_category=2
[sendspin.connection]: Noise transport active

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant