[gnutls-devel] GnuTLS | supported_groups: rewrite group negotiation without nested loop (!2120)

(Deprecated) Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Mon Aug 3 10:44:15 CEST 2026



Merge request https://gitlab.com/gnutls/gnutls/-/merge_requests/2120 was reviewed by Zoltán Fridrich

--
  
Zoltán Fridrich started a new discussion on lib/ext/supported_groups.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/2120#note_3635593790

 > +		     c <= GROUP_CLASS_MAX; c++) {
 > +			if (cpos_by_class[c] < cpos) {
 > +				cpos = cpos_by_class[c];

could be
```
cpos = session->internals.priorities->server_precedence ? NOT_FOUND : cpos_by_class[c];
```
and the duplicated for loop could be removed.

--
  
Zoltán Fridrich started a new discussion on lib/ext/supported_groups.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/2120#note_3635593858

 > +		 * TLS 1.3 as an encrypted extension. */
 > +		return 0;
 > +	} else {

I would just remove `else` when the `if` just returns. It would be nicer to read.
The same pattern is seen elsewhere.

--
  
Zoltán Fridrich started a new discussion on lib/ext/supported_groups.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/2120#note_3635593868

 > -		}
 > +		return client_send_params(session, extdata);
 > +	} else {

remove `else`

--
  
Zoltán Fridrich started a new discussion on lib/ext/supported_groups.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/2120#note_3635593881

 > +	if (group->pk == GNUTLS_PK_DH) {
 > +		return GROUP_CLASS_DH;
 > +	} else if (IS_EC(group->pk)) {

I would remove `else`. They all return anyway.


-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/2120
You're receiving this email because of your account on gitlab.com. Unsubscribe from this thread: https://gitlab.com/-/namespace/17175643/sent_notifications/6-3osb0z9svo799bgzb7je6bdyw-a84t7/unsubscribe | Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20260803/f1427eeb/attachment-0001.html>


More information about the Gnutls-devel mailing list