gnutls_dh_set_prime_bits(3)

πŸ’– gnutls_dh_set_prime_bits(3) πŸ’–

okay bestie, sit down, we're doing a gnutls page from the gnutls manual (v3.8.13, she's giving vintage-but-current πŸ’…) and honestly? this one is short, deprecated, and a little dramatic. let's go πŸ¦‹


✨ NAME ✨

gnutls_dh_set_prime_bits β€” the API function that sets your DH prime size, no cap 🌸


πŸŽ€ SYNOPSIS πŸŽ€

#include <gnutls/gnutls.h>

void gnutls_dh_set_prime_bits(gnutls_session_t session, unsigned int bits);

like, look at her. two arguments. returns nothing. zero drama in the signature, maximum drama in the DESCRIPTION 🫢


🧚 ARGUMENTS 🧚

  • gnutls_session_t session β€” bestie this is a gnutls_session_t type. that's it, that's the whole vibe.
  • unsigned int bits β€” and this one? this is the number of bits ⭐

πŸ‘‘ DESCRIPTION πŸ‘‘

so here's the tea β˜• β€” this function sets the number of bits, for use in a Diffie-Hellman key exchange. it's used both in DH ephemeral and DH anonymous cipher suites, which is lowkey iconic of it. what it actually does is set the minimum size of the prime that's gonna be used for the handshake.

on the client side it sets the minimum accepted number of bits. so if a server sends a prime with fewer bits than that? boom, GNUTLS_E_DH_PRIME_UNACCEPTABLE gets returned by the handshake. not me getting rejected by a handshake 😭

heads up: this function will warn via the audit log for values that are believed to be weak. so if you're out here choosing tiny numbers, the audit log is gonna side-eye you and say something 🫣

and on the server side? the function has no effect. literally nothing. it's giving decorative. πŸ’€

now the big one, and I need you to actually read this part bestie:

since 3.1.7 this function is deprecated. the minimum number of bits is set by the priority string level instead. also β€” and this is important β€” this function must be called after gnutls_priority_set_direct(), or the value you set may be overridden by the selected priority options. periodt.

😀 REPORTING BUGS 😀

found a bug? don't suffer in silence, tell the people:


Copyright Β© 2001-2023 Free Software Foundation, Inc., and others.

copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. slay, honestly 🫢


πŸ’œ SEE ALSO πŸ’œ

the full documentation for gnutls is maintained as a Texinfo manual. if the /usr/share/doc/gnutls/ directory does not contain the HTML form, visit:

https://www.gnutls.org/manual/


and that's the whole page, bestie, we ate and left no crumbs ✨ this was gnutls version 3.8.13 doing the absolute most for gnutls_dh_set_prime_bits(3) β€” mwah, bye πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from