If an application supports static locks, it MUST support dynamic locks as

well to be able to use the CHIL engine.
PR: 281
This commit is contained in:
Richard Levitte 2002-12-05 00:57:41 +00:00
parent c4a150c242
commit 322f190a18
3 changed files with 19 additions and 9 deletions

View File

@ -431,6 +431,7 @@ void ERR_load_ENGINE_strings(void);
#define ENGINE_R_INTERNAL_LIST_ERROR 110
#define ENGINE_R_INVALID_PADDING 137
#define ENGINE_R_KEY_TOO_LARGE 138
#define ENGINE_R_LOCKING_MISSING 143
#define ENGINE_R_MISSING_KEY_COMPONENTS 111
#define ENGINE_R_MOD_EXP_CRT_FAILED 134
#define ENGINE_R_MOD_EXP_FAILED 131

View File

@ -1,6 +1,6 @@
/* crypto/engine/engine_err.c */
/* ====================================================================
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
* Copyright (c) 1999-2002 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -205,6 +205,7 @@ static ERR_STRING_DATA ENGINE_str_reasons[]=
{ENGINE_R_INTERNAL_LIST_ERROR ,"internal list error"},
{ENGINE_R_INVALID_PADDING ,"invalid padding"},
{ENGINE_R_KEY_TOO_LARGE ,"key too large"},
{ENGINE_R_LOCKING_MISSING ,"locking missing"},
{ENGINE_R_MISSING_KEY_COMPONENTS ,"missing key components"},
{ENGINE_R_MOD_EXP_CRT_FAILED ,"mod exp crt failed"},
{ENGINE_R_MOD_EXP_FAILED ,"mod exp failed"},

View File

@ -435,15 +435,23 @@ static int hwcrhk_init()
/* Check if the application decided to support dynamic locks,
and if it does, use them. */
if (disable_mutex_callbacks == 0 &&
CRYPTO_get_dynlock_create_callback() != NULL &&
CRYPTO_get_dynlock_lock_callback() != NULL &&
CRYPTO_get_dynlock_destroy_callback() != NULL)
if (disable_mutex_callbacks == 0)
{
hwcrhk_globals.mutex_init = hwcrhk_mutex_init;
hwcrhk_globals.mutex_acquire = hwcrhk_mutex_lock;
hwcrhk_globals.mutex_release = hwcrhk_mutex_unlock;
hwcrhk_globals.mutex_destroy = hwcrhk_mutex_destroy;
if (CRYPTO_get_dynlock_create_callback() != NULL &&
CRYPTO_get_dynlock_lock_callback() != NULL &&
CRYPTO_get_dynlock_destroy_callback() != NULL)
{
hwcrhk_globals.mutex_init = hwcrhk_mutex_init;
hwcrhk_globals.mutex_acquire = hwcrhk_mutex_lock;
hwcrhk_globals.mutex_release = hwcrhk_mutex_unlock;
hwcrhk_globals.mutex_destroy = hwcrhk_mutex_destroy;
}
else if (CRYPTO_get_locking_callback() != NULL)
{
ENGINEerr(ENGINE_F_HWCRHK_INIT,ENGINE_R_LOCKING_MISSING);
ERR_add_error_data(1,"You HAVE to add dynamic locking callbacks via CRYPTO_set_dynlock_{create,lock,destroy}_callback()");
goto err;
}
}
/* Try and get a context - if not, we may have a DSO but no