SSL_SET_TMP_ECDH(3)
π SSL_SET_TMP_ECDH(3) π
okay so bestie, buckle up β this is the SSL_SET_TMP_ECDH(3) page from the library functions manual, and it's lowkey a history lesson in how we used to pick curves. it lives in libssl / libcrypto, and it's all about ECDH ephemeral key exchange β¨
πΈ NAME πΈ
SSL_set_tmp_ecdh, SSL_CTX_set_tmp_ecdh, SSL_set_ecdh_auto, SSL_CTX_set_ecdh_auto, SSL_set_tmp_ecdh_callback, SSL_CTX_set_tmp_ecdh_callback β pick a curve for ECDH ephemeral key exchange π
π SYNOPSIS π
library βlibsslβ libcrypto #include <openssl/ssl.h>
long
SSL_set_tmp_ecdh(SSL *ssl, EC_KEY *ecdh);
long
SSL_CTX_set_tmp_ecdh(SSL_CTX *ctx, EC_KEY *ecdh);
long
SSL_set_ecdh_auto(SSL *ssl, int state);
long
SSL_CTX_set_ecdh_auto(SSL_CTX *ctx, int state);
void
SSL_set_tmp_ecdh_callback(SSL *ssl,
EC_KEY *(*ecdh)(SSL *ssl, int is_export, int keylength));
void
SSL_CTX_set_tmp_ecdh_callback(SSL_CTX *ctx,
EC_KEY *(*ecdh)(SSL *ssl, int is_export, int keylength));
π¦ DESCRIPTION π¦
okay so the main character energy here is: in LibreSSL, automatic EC curve selection and generation is always enabled. like, it's just on. periodt. and apps cannot manually hand over EC keys for use with ECDH key exchange β that door is closed, bestie πͺ
the only thing SSL_set_tmp_ecdh() still does is this: the curve of the ecdh key you pass in becomes the only curve enabled for that ssl connection. that's it. so it's equivalent to calling SSL_set1_groups_list(3) with that same single curve name. same vibe, different function name π«Ά
SSL_CTX_set_tmp_ecdh() does the exact same thing, but for all the connections that will be created from ctx in the future. future-proofing-ish, but not really π
and now the deprecated girlies:
SSL_set_ecdh_auto()SSL_CTX_set_ecdh_auto()SSL_set_tmp_ecdh_callback()SSL_CTX_set_tmp_ecdh_callback()
these four are deprecated and have no effect. they're giving retired icon β they show up, they wave, they do nothing π
β RETURN VALUES β
SSL_set_tmp_ecdh()andSSL_CTX_set_tmp_ecdh()return1on success or0on failure.SSL_set_ecdh_auto(),SSL_CTX_set_ecdh_auto(),SSL_set_tmp_ecdh_callback(), andSSL_CTX_set_tmp_ecdh_callback()always return1. always. no cap. they literally cannot fail because they literally do nothing π
π SEE ALSO π
ssl(3), SSL_CTX_set1_groups(3), SSL_CTX_set_cipher_list(3), SSL_CTX_set_options(3), SSL_CTX_set_tmp_dh_callback(3), SSL_new(3) β go read these next, iykyk π
π HISTORY π
SSL_set_tmp_ecdh(),SSL_CTX_set_tmp_ecdh(),SSL_set_tmp_ecdh_callback(), andSSL_CTX_set_tmp_ecdh_callback()first appeared in OpenSSL0.9.8and have been available since OpenBSD4.5.SSL_CTX_set_ecdh_auto()andSSL_set_ecdh_auto()first appeared in OpenSSL1.0.2and have been available since OpenBSD5.7.
alright bestie, that's the whole page, every last crumb of it π mwah π this Debian edition is dated June 8, 2025, and it's the SSL_SET_TMP_ECDH(3) page β go forth and let the library pick your curves for you, because honestly it's gonna anyway πΈπ
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms