Skip to content

Put the Samsung classic DTLS profile back where the library owns the context - #137

Draft
tabascoz wants to merge 1 commit into
QuiteYellow:mainfrom
tabascoz:fix/samsung-classic-cert-dtls-profile
Draft

tabascoz wants to merge 1 commit into
QuiteYellow:mainfrom
tabascoz:fix/samsung-classic-cert-dtls-profile

Conversation

@tabascoz

Copy link
Copy Markdown

I'm submitting anyway a draft for your evaluation, let me know if you agree with the approach.

I started from the LocalThings-side workaround that was closed in mbillow/localthings#862. That workaround did the same thing from outside the package: it reached into the certificate-backed DTLS contexts and forced the narrow classic cert profile my refrigerator accepts.

This changes only the certificate-backed DTLS profile. It keeps the existing ECDHE-ECDSA-AES128-GCM-SHA256 cipher list, but it also disables TLS 1.3 and tickets on the certificate contexts, which stops OpenSSL 3 from putting TLS 1.3 suites and extensions into the first ClientHello.
I applied it in the same places that already own the certificate DTLS shape: auth.py for the provider contexts, and dtls_probe.py for the stateless probe and diagnostic contexts. The PSK path is untouched.

On my refrigerator, before this change the stateless probe gets no useful first-flight response and the diagnostic path returns a fatal handshake_failure. After the change, the ClientHello is a single classic DTLS 1.2 flight, HelloVerifyRequest comes back, and the diagnostic drive reaches the full server flight. Home Assistant/LocalThings setup succeeds and the device stays online.

I kept the claim narrow because that is the appliance I measured. I am not asking to say that every Samsung certificate-backed appliance behaves this way.

For now, this is a compatibility default for the certificate-backed path that was already narrow; PSK remains separate.

Tests: I updated the existing profile expectations because the certificate contexts now set the expected options, and I added a ClientHello shape test that checks the certificate-backed first flight does not advertise TLS 1.3 suites or TLS 1.3-only extensions.

This is a draft because I would like feedback on whether this should live as a default here, as an opt-in flag, or as a separate Samsung profile/provider.

Thanks! Tabascoz

@QuiteYellow

QuiteYellow commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Thanks for moving this into the library. I've opened #139 with a smaller version. It sets OP_NO_TICKET on the default path for #33's reason, drops OP_NO_TLSv1_3, and keeps your test updates, with you as co-author. It runs clean on my dryer and oven.

Could you check whether #139 gives your fridge the same outcome as your patch did? I don't have that model, so I can't test it here. If you can, a run without any patch just before it would also show whether the ticket change fixed #136.

@tabascoz

Copy link
Copy Markdown
Author

Thanks for moving this into the library. I've opened #139 with a smaller version. It sets OP_NO_TICKET on the default path for #33's reason, drops OP_NO_TLSv1_3, and keeps your test updates, with you as co-author. It runs clean on my dryer and oven.

Could you check whether #139 gives your fridge the same outcome as your patch did? I don't have that model, so I can't test it here. If you can, a run without any patch just before it would also show whether the ticket change fixed #136.

Thanks for moving this into the library. I've opened #139 with a smaller version. It sets OP_NO_TICKET on the default path for #33's reason, drops OP_NO_TLSv1_3, and keeps your test updates, with you as co-author. It runs clean on my dryer and oven.

Could you check whether #139 gives your fridge the same outcome as your patch did? I don't have that model, so I can't test it here. If you can, a run without any patch just before it would also show whether the ticket change fixed #136.

Yep I'll test today and revert. thanks!

@tabascoz

Copy link
Copy Markdown
Author

Could you check whether #139 gives your fridge the same outcome as your patch did? I don't have that model, so I can't test it here. If you can, a run without any patch just before it would also show whether the ticket change fixed #136.

I checked and solely applying #139 brought the fridge not working - unfortunately. I'm investigating it further ...

@tabascoz

Copy link
Copy Markdown
Author

Tested both on the fridge. #139 does not give the same outcome — it ran for about seven minutes and then failed permanently; #137 recovered it in seconds.

Same host, same Home Assistant, same libraries, same appliance — only the deployed protocol/auth.py and protocol/dtls_probe.py changed. I power-cycled the appliance while #139 was deployed and it stayed down (the failure counter kept climbing for another ~15 min); it came back 5 s after swapping to #137 with nothing else touched.

deployed result
#139 worked 14:55:13 → 15:02:28, then 119 failed polls, 0 successes, unavailable for 63 cycles, timeouts at 12.001 s, no fatal alert
#137 35 entities discovered at 16:31:27, 37/37 polls, 0 failures, live Observe notifications

Measured on that host with _client_hello_flight(mtu=1500) + _configure_certificate_server(ctx, None), records reassembled and the ClientHello parsed:

variant on the wire records ClientHello 35 ticket 43 supported_versions 51 key_share
main (37a2035) 1649 B 7 (256×6 + 113) 1474 B yes yes 1258 B
#139 1645 B 7 1470 B no yes 1258 B
#137 194 B 1 169 B no no none

#139 is a 4-byte change — the session_ticket extension and nothing else. The hello still offers DTLS 1.3 and still carries a 1258-byte key_share, 1216 B of which is a single post-quantum x25519mlkem768 share (ML-KEM-768 pk 1184 + X25519 32). That one extension is 85% of the ClientHello and is the sole reason the flight splits into seven UDP datagrams the appliance has to reassemble. #137 removes it: one 194-byte classic DTLS 1.2 record.

Both branches pass here on 3.14 (full suite 1395 passed for each).

One heads-up for anyone reproducing: a bare DTLS_METHOD context yields 1689 B with supported_versions on the system OpenSSL that runs the appliances, but 206 B without it in a uv venv on cryptography's vendored OpenSSL — identical reported version strings. The wire difference isn't visible from dev/CI, so any claim about it has to be measured on the runtime that actually talks to the devices.

This branch has not been deployed

No deployments
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.

2 participants