[gnutls-devel] GnuTLS | WIP: Compare DNs by comparing their string representations (!1223)

Development of GNU's TLS library gnutls-devel at lists.gnutls.org
Thu Mar 26 12:20:24 CET 2020




Pierre Ossman (Work account) commented on a discussion on lib/x509/dn.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/1223#note_311885518

>  	}
> -	if (memcmp(dn1->data, dn2->data, dn2->size) != 0) {
> +
> +	ret = gnutls_x509_rdn_get2(dn2, &str2, 0);
> +	if (ret < 0) {
>  		gnutls_assert();
> +		_gnutls_free_datum(&str1);
>  		return 0;
>  	}
> -	return 1;		/* they match */
> +
> +	if (str1.size != str2.size) {
> +		ret = 0;
> +		goto cleanup;
> +	}
> +	if (memcmp(str1.data, str2.data, str2.size) != 0) {

I've added a unit test for the case discussed. Is that sufficient?

I used #809 for getting some test certificates. Unfortunately those instructions generate a slightly broken certificate that triggers an assert. The test still passes though. Is that okay? I'm not sure how to generate better certificates right now.

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1223#note_311885518
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/20200326/00e86185/attachment-0001.html>


More information about the Gnutls-devel mailing list