Source
/* variable for passing information from callback functions if PSK was found among host PSKs or autoregistration PSK */
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
/* for OpenSSL 1.0.1/1.0.2 (before 1.1.0) */
/* mutexes for multi-threaded OpenSSL (see "man 3ssl threads" and example in crypto/threads/mttest.c) */
typedef zbx_mutex_t tls_mutex_t;
int tls_mutex_create(tls_mutex_t *mutex, char **error)
{
return zbx_mutex_create(mutex, NULL, &error);
}
void tls_mutex_destroy(tls_mutex_t *mutex)
{
zbx_mutex_destroy(mutex);
}
void tls_mutex_lock(tls_mutex_t mutex)
{
zbx_mutex_lock(mutex);
}
void tls_mutex_unlock(tls_mutex_t mutex)
{
zbx_mutex_unlock(mutex);
}
typedef pthread_mutex_t * tls_mutex_t;
int tls_mutex_create(tls_mutex_t *mutex, char **error)
{
*mutex = (pthread_mutex_t *)zbx_malloc(NULL, sizeof(pthread_mutex_t));
if (0 != pthread_mutex_init(*mutex, NULL))
{
*error = zbx_dsprintf(*error, "cannot create mutex: %s", zbx_strerror(errno));