/*
* Portions Copyright (C) 1999-2012, 2014-2017 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Portions Copyright (C) 1995-2000 by Network Associates, Inc.
*
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NETWORK ASSOCIATES DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE
* FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* Principal Author: Brian Wellington
*/
#ifdef OPENSSL
#include <config.h>
#include <isc/mutexblock.h>
#include "dst_internal.h"
#include "dst_openssl.h"
#ifdef USE_ENGINE
#endif
static int nlocks;
#endif
#ifdef USE_ENGINE
#endif
static int
if (num < 0)
return (-1);
}
static int
entropy_status(void) {
return (dst__entropy_status() > 32);
}
static int
if (num < 0)
return (-1);
}
static void
/*
* Do nothing. The only call to this provides no useful data anyway.
*/
}
#else
static int
/*
* Do nothing. The only call to this provides no useful data anyway.
*/
return (1);
}
#endif
#if OPENSSL_VERSION_NUMBER >= 0x10000000L && OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
static void
if ((mode & CRYPTO_LOCK) != 0)
else
}
#endif
static unsigned long
id_callback(void) {
return ((unsigned long)isc_thread_self());
}
#endif
#define FLARG
#define FILELINE
#else
#define FLARG_PASS
#endif
#else
#else
#define FLARG_PASS
#endif
#endif
static void *
#ifdef OPENSSL_LEAKS
void *ptr;
return (ptr);
#else
#endif
}
static void
}
static void *
#ifdef OPENSSL_LEAKS
void *rptr;
return (rptr);
#else
#endif
}
static void
{
}
#endif
#ifdef USE_ENGINE
#else
#endif
#ifdef DNS_CRYPTO_LEAKS
#endif
nlocks = CRYPTO_num_locks();
return (ISC_R_NOMEMORY);
if (result != ISC_R_SUCCESS)
goto cleanup_mutexalloc;
# else
# endif
#endif
goto cleanup_mutexinit;
}
#ifdef USE_ENGINE
#if !defined(CONF_MFLAGS_DEFAULT_SECTION)
#else
/*
* OPENSSL_config() can only be called a single time as of
* 1.0.2e so do the steps individually.
*/
#endif
e = ENGINE_by_id(engine);
if (e == NULL) {
goto cleanup_rm;
}
/* This will init the engine. */
if (!ENGINE_set_default(e, ENGINE_METHOD_ALL)) {
goto cleanup_rm;
}
}
re = ENGINE_new();
goto cleanup_rm;
}
} else
#else
#endif /* USE_ENGINE */
return (ISC_R_SUCCESS);
#ifdef USE_ENGINE
if (e != NULL)
ENGINE_free(e);
e = NULL;
#endif
#endif
return (result);
}
void
dst__openssl_destroy(void) {
}
#else
/*
*/
#if OPENSSL_VERSION_NUMBER >= 0x00907000L
RAND_cleanup();
#endif
}
#if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
#endif
OBJ_cleanup();
EVP_cleanup();
#if defined(USE_ENGINE)
if (e != NULL)
ENGINE_free(e);
e = NULL;
#endif
#endif
#if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
#endif
ERR_remove_state(0);
#endif
#ifdef DNS_CRYPTO_LEAKS
#endif
}
#endif
}
static isc_result_t
#if defined(HAVE_OPENSSL_ECDSA) && \
#endif
switch (reason) {
/*
* ERR_* errors are globally unique; others
* are unique per sublibrary
*/
case ERR_R_MALLOC_FAILURE:
break;
default:
#if defined(HAVE_OPENSSL_ECDSA) && \
if (lib == ERR_R_ECDSA_LIB &&
break;
}
#endif
break;
}
return (result);
}
return (result);
}
}
unsigned long err;
"%s failed (%s)", funcname,
if (result == ISC_R_NOMEMORY)
goto done;
for (;;) {
if (err == 0U)
goto done;
}
done:
return (result);
}
#if defined(USE_ENGINE)
ENGINE *
return (NULL);
if (e == NULL)
return (NULL);
return (e);
return (NULL);
}
#endif
#else /* OPENSSL */
#endif /* OPENSSL */
/*! \file */