(oops) Apologies all, that last header-cleanup commit was from the wrong
[openssl.git] / crypto / cryptlib.c
index 830ccc9816fed171af843429023e35e9fd9481cf..b180aebce92fc9af0333cf6186d6180c2d7d1a8a 100644 (file)
@@ -1,6 +1,6 @@
 /* crypto/cryptlib.c */
 /* ====================================================================
- * Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.
+ * Copyright (c) 1998-2003 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
  * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
  */
 
-#include <stdio.h>
-#include <string.h>
 #include "cryptlib.h"
-#include <openssl/crypto.h>
 #include <openssl/safestack.h>
 
 #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN16)
@@ -166,7 +163,10 @@ static const char* lock_names[CRYPTO_NUM_LOCKS] =
        "ec",
        "ecdh",
        "bn",
-#if CRYPTO_NUM_LOCKS != 36
+       "ec_pre_comp",
+       "store",
+       "comp",
+#if CRYPTO_NUM_LOCKS != 39
 # error "Inconsistency between crypto.h and cryptlib.c"
 #endif
        };
@@ -472,17 +472,17 @@ void CRYPTO_lock(int mode, int type, const char *file, int line)
 #endif
        if (type < 0)
                {
-               struct CRYPTO_dynlock_value *pointer
-                       = CRYPTO_get_dynlock_value(type);
+               if (dynlock_lock_callback != NULL)
+                       {
+                       struct CRYPTO_dynlock_value *pointer
+                               = CRYPTO_get_dynlock_value(type);
 
-               OPENSSL_assert(pointer != NULL);
+                       OPENSSL_assert(pointer != NULL);
 
-               if (dynlock_lock_callback)
-                       {
                        dynlock_lock_callback(mode, pointer, file, line);
-                       }
 
-               CRYPTO_destroy_dynlockid(type);
+                       CRYPTO_destroy_dynlockid(type);
+                       }
                }
        else
                if (locking_callback != NULL)