pem: Fix a bad l_free
PATCH 1/3 pem: Fix a bad l_free
On error pem_load_buffer will not set @label so it may end up being uninitialized when we l_free it. pem_load_buffer may also fail under normal circumstances at the end of file, make sure we only l_free(label) if the call succeeded.
--- ell/pem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
ell/pem.c +2 -1
@@ -284,8 +284,9 @@ LIB_EXPORT struct l_queue *l_pem_load_certificate_list(const char *filename) der =pem_load_buffer (ptr, end - ptr,0 , &label, &der_len, &ptr);if (!der ||strcmp (label,"CERTIFICATE" )) { +if (der) +l_free (label);l_free (der); -l_free (label);if (!ptr)/* EOF */ break ;
Signature · 1 line
2.19.1
PATCH 2/3 tls: Reset .negotiated_ff_group on handshake reset
--- ell/tls.c | 1 + 1 file changed, 1 insertion(+)
ell/tls.c +1 -0
@@ -197,6 +197,7 @@ static void tls_reset_handshake(struct l_tls *tls) tls->peer_pubkey =NULL ; tls->peer_pubkey_size =0 ; tls->negotiated_curve =NULL ; + tls->negotiated_ff_group =NULL ;for (hash =0 ; hash < __HANDSHAKE_HASH_COUNT; hash++)tls_drop_handshake_hash (tls, hash);
Signature · 1 line
2.19.1
PATCH 3/3 tls: Check DH is supported by keyctl before offering DHE suites
In reply to Andrew Zaborowski--- ell/tls.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
ell/tls.c +13 -0
@@ -464,6 +464,19 @@ static bool tls_cipher_suite_is_compatible(struct l_tls *tls,return false; } +if (suite->key_xchg->need_ffdh && + !l_key_is_supported (L_KEY_FEATURE_DH )) { +if (error) { + *error = error_buf; +snprintf (error_buf,sizeof (error_buf), +"Cipher suite %s's key exchange " +"mechanism needs kernel DH support" , + suite->name); + } + +return false; + } + leaf =l_certchain_get_leaf (tls->cert);if (leaf && !suite->key_xchg->validate_cert_key_type (leaf)) {if (error) {
Signature · 1 line
2.19.1
Hi Andrew,
Quoted 7 lines · Andrew Zaborowski
On error
pem_load_bufferwill not set @label so it may end up being uninitialized when wel_freeit.pem_load_buffermay also fail under normal circumstances at the end of file, make sure we onlyl_free(label)if the call succeeded.--- ell/pem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
All applied, thanks.
Regards,
-Denis