Sortix cross-nightly manual
This manual documents Sortix cross-nightly. You can instead view this document in the latest official manual.
NAME
SSL_CTX_set_tmp_dh_callback, SSL_CTX_set_tmp_dh, SSL_set_tmp_dh_callback, SSL_set_tmp_dh — handle DH keys for ephemeral key exchangeSYNOPSIS
#include <openssl/ssl.h>SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx, DH *(*tmp_dh_callback)(SSL *ssl, int is_export, int keylength));
SSL_CTX_set_tmp_dh(SSL_CTX *ctx, DH *dh);
SSL_set_tmp_dh_callback(SSL *ssl, DH *(*tmp_dh_callback)(SSL *ssl, int is_export, int keylength);
SSL_set_tmp_dh(SSL *ssl, DH *dh);
DESCRIPTION
SSL_CTX_set_tmp_dh_callback() sets the callback function for ctx to be used when a DH parameters are required to tmp_dh_callback. The callback is inherited by all ssl objects created from ctx.RETURN VALUES
SSL_CTX_set_tmp_dh() and SSL_set_tmp_dh() do return 1 on success and 0 on failure. Check the error queue to find out the reason of failure.EXAMPLES
Set up DH parameters with a key length of 2048 bits. Error handling is partly left out.openssl dhparam -out dh_param_2048.pem 2048
SSL_CTX ctx = SSL_CTX_new(); ... /* Set up ephemeral DH parameters. */ DH *dh_2048 = NULL; FILE *paramfile; paramfile = fopen("dh_param_2048.pem", "r"); if (paramfile) { dh_2048 = PEM_read_DHparams(paramfile, NULL, NULL, NULL); fclose(paramfile); } else { /* Error. */ } if (dh_2048 == NULL) { /* Error. */ } if (SSL_CTX_set_tmp_dh(ctx, dh_2048) != 1) { /* Error. */ }