mirror of
https://github.com/openssl/openssl.git
synced 2025-01-30 14:01:55 +08:00
- Remo Inverardi noticed that ENGINEs don't have an "up_ref" function in the
normal 'structural' case (ENGINE_init() satisfies this in the less normal 'functional' case). This change provides such a function. - Correct some "read" locks that should actually be "write" locks. - make update.
This commit is contained in:
parent
28c8a911bd
commit
314c667050
@ -110,6 +110,29 @@ eng_cnf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
|
||||
eng_cnf.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
|
||||
eng_cnf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
|
||||
eng_cnf.o: ../../include/openssl/ui.h ../cryptlib.h eng_cnf.c
|
||||
eng_cryptodev.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
|
||||
eng_cryptodev.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
|
||||
eng_cryptodev.o: ../../include/openssl/bn.h ../../include/openssl/cast.h
|
||||
eng_cryptodev.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
|
||||
eng_cryptodev.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
|
||||
eng_cryptodev.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
|
||||
eng_cryptodev.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
|
||||
eng_cryptodev.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
|
||||
eng_cryptodev.o: ../../include/openssl/err.h ../../include/openssl/evp.h
|
||||
eng_cryptodev.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
|
||||
eng_cryptodev.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
|
||||
eng_cryptodev.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
|
||||
eng_cryptodev.o: ../../include/openssl/obj_mac.h
|
||||
eng_cryptodev.o: ../../include/openssl/objects.h
|
||||
eng_cryptodev.o: ../../include/openssl/opensslconf.h
|
||||
eng_cryptodev.o: ../../include/openssl/opensslv.h
|
||||
eng_cryptodev.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
|
||||
eng_cryptodev.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
|
||||
eng_cryptodev.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
|
||||
eng_cryptodev.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
|
||||
eng_cryptodev.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
|
||||
eng_cryptodev.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
|
||||
eng_cryptodev.o: ../../include/openssl/ui_compat.h eng_cryptodev.c
|
||||
eng_ctrl.o: ../../e_os.h ../../include/openssl/asn1.h
|
||||
eng_ctrl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
eng_ctrl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* crypto/engine/eng_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
|
||||
@ -96,6 +96,7 @@ static ERR_STRING_DATA ENGINE_str_functs[]=
|
||||
{ERR_PACK(0,ENGINE_F_ENGINE_SET_NAME,0), "ENGINE_set_name"},
|
||||
{ERR_PACK(0,ENGINE_F_ENGINE_TABLE_REGISTER,0), "ENGINE_TABLE_REGISTER"},
|
||||
{ERR_PACK(0,ENGINE_F_ENGINE_UNLOAD_KEY,0), "ENGINE_UNLOAD_KEY"},
|
||||
{ERR_PACK(0,ENGINE_F_ENGINE_UP_REF,0), "ENGINE_up_ref"},
|
||||
{ERR_PACK(0,ENGINE_F_INT_CTRL_HELPER,0), "INT_CTRL_HELPER"},
|
||||
{ERR_PACK(0,ENGINE_F_INT_ENGINE_CONFIGURE,0), "INT_ENGINE_CONFIGURE"},
|
||||
{ERR_PACK(0,ENGINE_F_LOG_MESSAGE,0), "LOG_MESSAGE"},
|
||||
|
@ -196,14 +196,14 @@ ENGINE *ENGINE_get_first(void)
|
||||
{
|
||||
ENGINE *ret;
|
||||
|
||||
CRYPTO_r_lock(CRYPTO_LOCK_ENGINE);
|
||||
CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
|
||||
ret = engine_list_head;
|
||||
if(ret)
|
||||
{
|
||||
ret->struct_ref++;
|
||||
engine_ref_debug(ret, 0, 1)
|
||||
}
|
||||
CRYPTO_r_unlock(CRYPTO_LOCK_ENGINE);
|
||||
CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -211,14 +211,14 @@ ENGINE *ENGINE_get_last(void)
|
||||
{
|
||||
ENGINE *ret;
|
||||
|
||||
CRYPTO_r_lock(CRYPTO_LOCK_ENGINE);
|
||||
CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
|
||||
ret = engine_list_tail;
|
||||
if(ret)
|
||||
{
|
||||
ret->struct_ref++;
|
||||
engine_ref_debug(ret, 0, 1)
|
||||
}
|
||||
CRYPTO_r_unlock(CRYPTO_LOCK_ENGINE);
|
||||
CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -232,7 +232,7 @@ ENGINE *ENGINE_get_next(ENGINE *e)
|
||||
ERR_R_PASSED_NULL_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
CRYPTO_r_lock(CRYPTO_LOCK_ENGINE);
|
||||
CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
|
||||
ret = e->next;
|
||||
if(ret)
|
||||
{
|
||||
@ -240,7 +240,7 @@ ENGINE *ENGINE_get_next(ENGINE *e)
|
||||
ret->struct_ref++;
|
||||
engine_ref_debug(ret, 0, 1)
|
||||
}
|
||||
CRYPTO_r_unlock(CRYPTO_LOCK_ENGINE);
|
||||
CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
|
||||
/* Release the structural reference to the previous ENGINE */
|
||||
ENGINE_free(e);
|
||||
return ret;
|
||||
@ -255,7 +255,7 @@ ENGINE *ENGINE_get_prev(ENGINE *e)
|
||||
ERR_R_PASSED_NULL_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
CRYPTO_r_lock(CRYPTO_LOCK_ENGINE);
|
||||
CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
|
||||
ret = e->prev;
|
||||
if(ret)
|
||||
{
|
||||
@ -263,7 +263,7 @@ ENGINE *ENGINE_get_prev(ENGINE *e)
|
||||
ret->struct_ref++;
|
||||
engine_ref_debug(ret, 0, 1)
|
||||
}
|
||||
CRYPTO_r_unlock(CRYPTO_LOCK_ENGINE);
|
||||
CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
|
||||
/* Release the structural reference to the previous ENGINE */
|
||||
ENGINE_free(e);
|
||||
return ret;
|
||||
@ -358,7 +358,7 @@ ENGINE *ENGINE_by_id(const char *id)
|
||||
ERR_R_PASSED_NULL_PARAMETER);
|
||||
return NULL;
|
||||
}
|
||||
CRYPTO_r_lock(CRYPTO_LOCK_ENGINE);
|
||||
CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
|
||||
iterator = engine_list_head;
|
||||
while(iterator && (strcmp(id, iterator->id) != 0))
|
||||
iterator = iterator->next;
|
||||
@ -384,7 +384,7 @@ ENGINE *ENGINE_by_id(const char *id)
|
||||
engine_ref_debug(iterator, 0, 1)
|
||||
}
|
||||
}
|
||||
CRYPTO_r_unlock(CRYPTO_LOCK_ENGINE);
|
||||
CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
|
||||
#if 0
|
||||
if(iterator == NULL)
|
||||
{
|
||||
@ -416,3 +416,14 @@ notfound:
|
||||
/* EEK! Experimental code ends */
|
||||
#endif
|
||||
}
|
||||
|
||||
int ENGINE_up_ref(ENGINE *e)
|
||||
{
|
||||
if (e == NULL)
|
||||
{
|
||||
ENGINEerr(ENGINE_F_ENGINE_UP_REF,ERR_R_PASSED_NULL_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
CRYPTO_add(&e->struct_ref,1,CRYPTO_LOCK_ENGINE);
|
||||
return 1;
|
||||
}
|
||||
|
@ -433,6 +433,7 @@ int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg,
|
||||
* compatibility! */
|
||||
ENGINE *ENGINE_new(void);
|
||||
int ENGINE_free(ENGINE *e);
|
||||
int ENGINE_up_ref(ENGINE *e);
|
||||
int ENGINE_set_id(ENGINE *e, const char *id);
|
||||
int ENGINE_set_name(ENGINE *e, const char *name);
|
||||
int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth);
|
||||
@ -697,6 +698,7 @@ void ERR_load_ENGINE_strings(void);
|
||||
#define ENGINE_F_ENGINE_SET_NAME 130
|
||||
#define ENGINE_F_ENGINE_TABLE_REGISTER 184
|
||||
#define ENGINE_F_ENGINE_UNLOAD_KEY 152
|
||||
#define ENGINE_F_ENGINE_UP_REF 190
|
||||
#define ENGINE_F_INT_CTRL_HELPER 172
|
||||
#define ENGINE_F_INT_ENGINE_CONFIGURE 188
|
||||
#define ENGINE_F_LOG_MESSAGE 141
|
||||
|
@ -3020,3 +3020,4 @@ PKCS12_add_key 3452 EXIST::FUNCTION:
|
||||
PKCS12_add_cert 3453 EXIST::FUNCTION:
|
||||
ASN1_item_ndef_i2d 3454 EXIST::FUNCTION:
|
||||
i2d_PKCS7_NDEF 3455 EXIST::FUNCTION:
|
||||
ENGINE_up_ref 3456 EXIST::FUNCTION:
|
||||
|
Loading…
Reference in New Issue
Block a user