[tls] Poison initial key derivation function master secret A freshly initialised key derivation function master secret has the "keyed" flag clear and so cannot accidentally be used to establish a full TLS connection. As an additional layer of defence in depth, poison the initial key derivation master secret so that a predictable all-zero secret can never be used accidentally in future. Signed-off-by: Michael Brown <mcb30@ipxe.org>
diff --git a/src/net/tls.c b/src/net/tls.c index f0cad9f..9c2f4cd 100644 --- a/src/net/tls.c +++ b/src/net/tls.c
@@ -549,6 +549,9 @@ /* Initialise handshake context */ digest_init ( digest, key->handshake ); + /* Poison key derivation function master secret */ + tls_ephemeral_label ( tls, "kdf poison", key->kdf, kdfsize ); + /* Sanity checks */ assert ( ! key->keyed ); assert ( ! key->bound );