OPENSSL_isservice is now defined on all platforms not just WIN32
[openssl.git] / crypto / crypto.h
index bb9b89c6a5e89f700693529d51ca0d72ae328252..5089c658826409687040c8d77fcae0b2711c6d28 100644 (file)
@@ -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
@@ -282,9 +284,10 @@ typedef struct bio_st BIO_dummy;
 
 struct crypto_ex_data_st
        {
-       STACK *sk;
+       STACK_OF(void) *sk;
        int dummy; /* gcc is screwing up this data structure :-( */
        };
+DECLARE_STACK_OF(void)
 
 /* This stuff is basically class callback functions
  * The current classes are SSL_CTX, SSL, SSL_SESSION, and a few more */
@@ -300,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
-       {
-       void *ptr;
-       unsigned long ulong;
-       } CRYPTO_THREADID;
-
 /* Per class, we have a STACK of CRYPTO_EX_DATA_FUNCS for each CRYPTO_EX_DATA
  * entry.
  */
@@ -374,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) \
@@ -431,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
@@ -496,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,
@@ -548,8 +543,9 @@ void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb);
 void OpenSSLDie(const char *file,int line,const char *assertion);
 #define OPENSSL_assert(e)       (void)((e) ? 0 : (OpenSSLDie(__FILE__, __LINE__, #e),1))
 
-unsigned long *OPENSSL_ia32cap_loc(void);
-#define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc()))
+unsigned int *OPENSSL_ia32cap_loc(void);
+#define OPENSSL_ia32cap ((OPENSSL_ia32cap_loc())[0])
+int OPENSSL_isservice(void);
 
 /* BEGIN ERROR CODES */
 /* The following lines are auto generated by the script mkerr.pl. Any changes