[gnutls-devel] GnuTLS | When negotiating TLS1.3 enforce certificate key usage (!902)

Development of GNU's TLS library gnutls-devel at lists.gnutls.org
Wed Feb 6 10:06:17 CET 2019


Tim Rühsen commented on a discussion on lib/auth.c:

>  		}
>  	}
>  
> +	/* sanity tests */
> +	if (type == GNUTLS_CRD_CERTIFICATE) {
> +		gnutls_certificate_credentials_t c = cred;
> +		unsigned i;
> +		bool allow_tls13 = 0;
> +		unsigned key_usage;
> +
> +		if (c != NULL && c->ncerts > 0) {

Prepare to see warnings from static analyzers when you compare like `unsigned-var with > 0`. Since it might be a hint that the programmer didn't know / respect the unsignedness of the variable.

My personal favorite is to leave away redundant information whenever they add no value to the reader. In this case i prefer `if (c !=NULL && c->ncerts)` or even better `if (c && c->ncerts)`. If it wasn't against the GnuTLS coding style.

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/merge_requests/902#note_138660982
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20190206/b5a3eec0/attachment-0001.html>


More information about the Gnutls-devel mailing list