h2o / picotls

TLS 1.3 implementation in C (master supports RFC8446 as well as draft-26, -27, -28)
527 stars 140 forks source link

[minicrypto][boringssl] x25519 key derivation must fail when output is all-zero #486

Closed kazuho closed 10 months ago

kazuho commented 10 months ago

RFC 7748 states we may fail if the derived key is all-zero, RFC 8446 states we MUST.

In the OpenSSL backend we do the check (to be accurate OpenSSL does), but we have not been doing anything on the side of minicrypto and boringssl.

This implements the checks, as well as fixing memory leaks that happen when an error is returned from the derivation function (minicrypto), clearing secrets used (boringssl).