Copy flags in ASN1_STRING_dup()
[oweals/openssl.git] / crypto / cryptlib.c
index 920ff184e2907e422f2928b56972205ea1e6f1d7..d70a570dcee1f72f42943ada2ea6c03989aabd3d 100644 (file)
@@ -59,7 +59,7 @@
 #include <stdio.h>
 #include <string.h>
 #include "cryptlib.h"
-#include "crypto.h"
+#include <openssl/crypto.h>
 #include "date.h"
 
 #if defined(WIN32) || defined(WIN16)
@@ -84,30 +84,28 @@ static const char* lock_names[CRYPTO_NUM_LOCKS] =
        "ssl_ctx",
        "ssl_cert",
        "ssl_session",
+       "ssl_sess_cert",
        "ssl",
        "rand",
        "debug_malloc",
        "BIO",
-       "bio_gethostbyname",
+       "gethostbyname",
+       "getservbyname",
+       "readdir",
        "RSA_blinding",
+#if CRYPTO_NUM_LOCKS != 24
+# error "Inconsistency between crypto.h and cryptlib.c"
+#endif
        };
 
 static STACK *app_locks=NULL;
 
-#ifndef NOPROTO
 static void (MS_FAR *locking_callback)(int mode,int type,
        const char *file,int line)=NULL;
 static int (MS_FAR *add_lock_callback)(int *pointer,int amount,
        int type,const char *file,int line)=NULL;
 static unsigned long (MS_FAR *id_callback)(void)=NULL;
-#else
-static void (MS_FAR *locking_callback)()=NULL;
-static int (MS_FAR *add_lock_callback)()=NULL;
-static unsigned long (MS_FAR *id_callback)()=NULL;
-#endif
-
-int CRYPTO_get_new_lockid(name)
-char *name;
+int CRYPTO_get_new_lockid(char *name)
        {
        char *str;
        int i;
@@ -135,6 +133,11 @@ char *name;
        return(i);
        }
 
+int CRYPTO_num_locks(void)
+       {
+       return CRYPTO_NUM_LOCKS;
+       }
+
 void (*CRYPTO_get_locking_callback(void))(int mode,int type,const char *file,
                int line)
        {
@@ -159,18 +162,17 @@ void CRYPTO_set_add_lock_callback(int (*func)(int *num,int mount,int type,
        add_lock_callback=func;
        }
 
-unsigned long (*CRYPTO_get_id_callback(P_V))(P_V)
+unsigned long (*CRYPTO_get_id_callback(void))(void)
        {
        return(id_callback);
        }
 
-void CRYPTO_set_id_callback(func)
-unsigned long (*func)(P_V);
+void CRYPTO_set_id_callback(unsigned long (*func)(void))
        {
        id_callback=func;
        }
 
-unsigned long CRYPTO_thread_id()
+unsigned long CRYPTO_thread_id(void)
        {
        unsigned long ret=0;
 
@@ -191,11 +193,7 @@ unsigned long CRYPTO_thread_id()
        return(ret);
        }
 
-void CRYPTO_lock(mode,type,file,line)
-int mode;
-int type;
-const char *file;
-int line;
+void CRYPTO_lock(int mode, int type, const char *file, int line)
        {
 #ifdef LOCK_DEBUG
                {
@@ -224,12 +222,8 @@ int line;
                locking_callback(mode,type,file,line);
        }
 
-int CRYPTO_add_lock(pointer,amount,type,file,line)
-int *pointer;
-int amount;
-int type;
-const char *file;
-int line;
+int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,
+            int line)
        {
        int ret;
 
@@ -267,8 +261,7 @@ int line;
        return(ret);
        }
 
-const char *CRYPTO_get_lock_name(type)
-int type;
+const char *CRYPTO_get_lock_name(int type)
        {
        if (type < 0)
                return("ERROR");
@@ -286,10 +279,8 @@ int type;
 /* All we really need to do is remove the 'error' state when a thread
  * detaches */
 
-BOOL WINAPI DLLEntryPoint(hinstDLL,fdwReason,lpvReserved)
-HINSTANCE hinstDLL;
-DWORD fdwReason;
-LPVOID lpvReserved;
+BOOL WINAPI DLLEntryPoint(HINSTANCE hinstDLL, DWORD fdwReason,
+            LPVOID lpvReserved)
        {
        switch(fdwReason)
                {