---
name: "libressl-SSL_set_tmp_ecdh"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-SSL_set_tmp_ecdh"
---

# libressl-SSL\_set\_tmp\_ecdh(3)

select a curve for 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** – select a curve for ECDH ephemeral key exchange

## SYNOPSIS

SSL Library (libssl, -lssl) 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

Automatic EC curve selection and generation is always enabled in LibreSSL, and applications cannot manually provide EC keys for use with ECDH key exchange.

The only remaining effect of **SSL\_set\_tmp\_ecdh**() is that the curve of the given *ecdh* key becomes the only curve enabled for the *ssl* connection, so it is equivalent to calling SSL\_set1\_groups\_list(3) with the same single curve name.

**SSL\_CTX\_set\_tmp\_ecdh**() has the same effect on all connections that will be created from *ctx* in the future.

The functions **SSL\_set\_ecdh\_auto**(), **SSL\_CTX\_set\_ecdh\_auto**(), **SSL\_set\_tmp\_ecdh\_callback**(), and **SSL\_CTX\_set\_tmp\_ecdh\_callback**() are deprecated and have no effect.

## RETURN VALUES

**SSL\_set\_tmp\_ecdh**() and **SSL\_CTX\_set\_tmp\_ecdh**() return 1 on success or 0 on failure.

**SSL\_set\_ecdh\_auto**(), **SSL\_CTX\_set\_ecdh\_auto**(), **SSL\_set\_tmp\_ecdh\_callback**(), and **SSL\_CTX\_set\_tmp\_ecdh\_callback**() always return 1.

## SEE ALSO

[ssl(3)](/ssl/3.md), 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)

## HISTORY

**SSL\_set\_tmp\_ecdh**(), **SSL\_CTX\_set\_tmp\_ecdh**(), **SSL\_set\_tmp\_ecdh\_callback**(), and **SSL\_CTX\_set\_tmp\_ecdh\_callback**() first appeared in OpenSSL 0.9.8 and have been available since OpenBSD 4.5.

**SSL\_CTX\_set\_ecdh\_auto**() and **SSL\_set\_ecdh\_auto**() first appeared in OpenSSL 1.0.2 and have been available since OpenBSD 5.7.
