---
name: "SSL_CTX_set_tmp_ecdh"
section: "3ssl"
platform: "linux"
package: "openssl"
version: "3.6.5-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/SSL_CTX_set_tmp_ecdh"
---

# SSL\_CTX\_set\_tmp\_ecdh(3ssl)

handle ECDH keys for ephemeral key exchange

## NAME

SSL\_CTX\_set\_tmp\_ecdh, SSL\_set\_tmp\_ecdh, SSL\_CTX\_set\_ecdh\_auto, SSL\_set\_ecdh\_auto - handle ECDH keys for ephemeral key exchange

## SYNOPSIS

```
 #include <openssl/ssl.h>
 long SSL_CTX_set_tmp_ecdh(SSL_CTX *ctx, const EC_KEY *ecdh);
 long SSL_set_tmp_ecdh(SSL *ssl, const EC_KEY *ecdh);
 long SSL_CTX_set_ecdh_auto(SSL_CTX *ctx, int state);
 long SSL_set_ecdh_auto(SSL *ssl, int state);
```

## DESCRIPTION

**SSL\_CTX\_set\_tmp\_ecdh()** sets ECDH parameters to be used to be **ecdh**. The key is inherited by all **ssl** objects created from **ctx**. This macro is deprecated in favor of **SSL\_CTX\_set1\_groups**(3).

**SSL\_set\_tmp\_ecdh()** sets the parameters only for **ssl**. This macro is deprecated in favor of **SSL\_set1\_groups**(3).

**SSL\_CTX\_set\_ecdh\_auto()** and **SSL\_set\_ecdh\_auto()** are deprecated and have no effect.

## RETURN VALUES

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

## SEE ALSO

[**ssl**(7)](/ssl/7.md), **SSL\_CTX\_set1\_curves**(3), **SSL\_CTX\_set\_cipher\_list**(3), **SSL\_CTX\_set\_options**(3), **SSL\_CTX\_set\_tmp\_dh\_callback**(3), **openssl-ciphers**(1), **openssl-ecparam**(1)

## COPYRIGHT

Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License").  You may not use this file except in compliance with the License.  You can obtain a copy in the file LICENSE in the source distribution or at \<https://www.openssl.org/source/license.html\>.
