src/ssl_sock.c
int ssl_sock_load_dh_params(SSL_CTX *ctx, const char *file)
{
	int ret = -1;
	BIO *in;
	DH *dh = NULL;

	in = BIO_new(BIO_s_file());
	if (in == NULL)
		goto end;

	if (BIO_read_filename(in, file) <= 0)
		goto end;

	dh = PEM_read_bio_DHparams(in, NULL, ctx->default_passwd_callback, ctx->default_passwd_callback_userdata);
	if (dh) {
		SSL_CTX_set_tmp_dh(ctx, dh);
		ret = 1;
		goto end;
	}

	ret = 0; /* DH params not found */

	/* Clear openssl global errors stack */
	ERR_clear_error();
end:
	if (dh)
		DH_free(dh);

	if (in)
	BIO_free(in);

	return ret;
}
/* Loads Diffie-Hellman parameter from a file. Returns 1 if loaded, else -1
   if an error occured, and 0 if parameter not found. */
Loads Diffie-Hellman parameter from a file. Returns 1 if loaded, else -1
if an error occured, and 0 if parameter not found.
Loads Diffie - Hellman parameter from a file . Returns 1 if loaded else - 1 if an error occured and 0 if parameter not found .
int ssl_sock_load_dh_params(SSL_CTX *ctx, const char *file)
{
	int ret = -1;
	BIO *in;
	DH *dh = NULL;
	in = BIO_new(BIO_s_file());
	if (in == NULL)
		goto end;
	if (BIO_read_filename(in, file) <= 0)
		goto end;
	dh = PEM_read_bio_DHparams(in, NULL, ctx->default_passwd_callback, ctx->default_passwd_callback_userdata);
	if (dh) {
		SSL_CTX_set_tmp_dh(ctx, dh);
		ret = 1;
		goto end;
	}
	ret = 0; 
	ERR_clear_error();
end:
	if (dh)
		DH_free(dh);
	if (in)
	BIO_free(in);
	return ret;
}
int ssl_sock_load_dh_params ( SSL_CTX * ctx , const char * file ) { int ret = -1 ; BIO * in ; DH * dh = NULL ; in = BIO_new ( BIO_s_file ( ) ) ; if ( in == NULL ) goto end ; if ( BIO_read_filename ( in , file ) <= 0 ) goto end ; dh = PEM_read_bio_DHparams ( in , NULL , ctx -> default_passwd_callback , ctx -> default_passwd_callback_userdata ) ; if ( dh ) { SSL_CTX_set_tmp_dh ( ctx , dh ) ; ret = 1 ; goto end ; } ret = 0 ; ERR_clear_error ( ) ; end : if ( dh ) DH_free ( dh ) ; if ( in ) BIO_free ( in ) ; return ret ; }
Loads Diffie-Hellman parameter from a file.
Loads Diffie - Hellman parameter from a file .
/* DH params not found */ /* Clear openssl global errors stack */