X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fcrypto.h;h=ff09bc5fb44fa1e4fde58b0bc9c617b18e38077d;hp=4fa540527e9b4d4253f50d42fdeab88da977e28b;hb=0eab41fb78cf4d7c76e563fd677ab6c32fc28bb0;hpb=5ce278a77bd7d23bcf965cfa37afb7b937c1a17d diff --git a/crypto/crypto.h b/crypto/crypto.h index 4fa540527e..ff09bc5fb4 100644 --- a/crypto/crypto.h +++ b/crypto/crypto.h @@ -219,7 +219,9 @@ typedef struct openssl_item_st #define CRYPTO_LOCK_EC_PRE_COMP 36 #define CRYPTO_LOCK_STORE 37 #define CRYPTO_LOCK_COMP 38 -#define CRYPTO_NUM_LOCKS 39 +#define CRYPTO_LOCK_FIPS 39 +#define CRYPTO_LOCK_FIPS2 40 +#define CRYPTO_NUM_LOCKS 41 #define CRYPTO_LOCK 1 #define CRYPTO_UNLOCK 2 @@ -301,17 +303,6 @@ typedef struct crypto_ex_data_func_st DECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS) -/* This structure is exposed to allow it to be used without dynamic allocation, - * however it exists to encapsulate the different ways of representing "thread - * ID"s (given that applications provide the thread implementation via - * callbacks). So treat this type as opaque if you don't want your code to fall - * apart when someone decides to extend this in some way. */ -typedef struct crypto_threadid - { - unsigned long ulong; - void *ptr; - } CRYPTO_THREADID; - /* Per class, we have a STACK of CRYPTO_EX_DATA_FUNCS for each CRYPTO_EX_DATA * entry. */ @@ -375,6 +366,7 @@ int CRYPTO_is_mem_check_on(void); #define is_MemCheck_on() CRYPTO_is_mem_check_on() #define OPENSSL_malloc(num) CRYPTO_malloc((int)num,__FILE__,__LINE__) +#define OPENSSL_strdup(str) CRYPTO_strdup((str),__FILE__,__LINE__) #define OPENSSL_realloc(addr,num) \ CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__) #define OPENSSL_realloc_clean(addr,old_num,num) \ @@ -432,23 +424,24 @@ void CRYPTO_set_add_lock_callback(int (*func)(int *num,int mount,int type, const char *file, int line)); int (*CRYPTO_get_add_lock_callback(void))(int *num,int mount,int type, const char *file,int line); -/* Implement "thread ID" via callback, choose the prototype that matches your - * thread implementation. */ -void CRYPTO_set_id_callback(unsigned long (*func)(void)); -void CRYPTO_set_idptr_callback(void *(*func)(void)); -/* Records the thread ID of the currently executing thread */ -void CRYPTO_THREADID_set(CRYPTO_THREADID *id); -/* Compares two thread IDs. If the underlying notion of thread ID is linear, - * this returns -1, 0, or +1 to imply strict-ordering (as other ***_cmp() - * functions do). Otherwise, zero means equal, non-zero means not equal. */ -int CRYPTO_THREADID_cmp(const CRYPTO_THREADID *id1, const CRYPTO_THREADID *id2); -/* When you need "a number", eg. for hashing, use this. */ + +/* Don't use this structure directly. */ +typedef struct crypto_threadid_st + { + void *ptr; + unsigned long val; + } CRYPTO_THREADID; +/* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */ +void CRYPTO_THREADID_set_numeric(CRYPTO_THREADID *id, unsigned long val); +void CRYPTO_THREADID_set_pointer(CRYPTO_THREADID *id, void *ptr); +int CRYPTO_THREADID_set_callback(void (*threadid_func)(CRYPTO_THREADID *)); +void (*CRYPTO_THREADID_get_callback(void))(CRYPTO_THREADID *); +void CRYPTO_THREADID_current(CRYPTO_THREADID *id); +int CRYPTO_THREADID_cmp(const CRYPTO_THREADID *a, const CRYPTO_THREADID *b); +void CRYPTO_THREADID_cpy(CRYPTO_THREADID *dest, const CRYPTO_THREADID *src); unsigned long CRYPTO_THREADID_hash(const CRYPTO_THREADID *id); -/* Copy a threadid */ -void CRYPTO_THREADID_cpy(CRYPTO_THREADID *dst, const CRYPTO_THREADID *src); #ifndef OPENSSL_NO_DEPRECATED -/* Deprecated interfaces - these presume you know exactly what's going on under - * the covers. Better to migrate to the CRYPTO_THREADID_***() form. */ +void CRYPTO_set_id_callback(unsigned long (*func)(void)); unsigned long (*CRYPTO_get_id_callback(void))(void); unsigned long CRYPTO_thread_id(void); #endif @@ -497,6 +490,7 @@ void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int), void *CRYPTO_malloc_locked(int num, const char *file, int line); void CRYPTO_free_locked(void *); void *CRYPTO_malloc(int num, const char *file, int line); +char *CRYPTO_strdup(const char *str, const char *file, int line); void CRYPTO_free(void *); void *CRYPTO_realloc(void *addr,int num, const char *file, int line); void *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file,