components/openssl/openssl-1.0.1/patches/29_fork_safe.patch
branchs11u2-sru
changeset 4016 7f9e1e7611b8
parent 3017 da8a40fb54dd
child 4461 68eb2fdf9b3a
equal deleted inserted replaced
4013:29dc96079508 4016:7f9e1e7611b8
     1 #
     1 #
     2 # This file adds the code to setup internal mutexes and callback function.
     2 # This file adds the code to setup internal mutexes and callback function.
     3 # 	PSARC/2014/077
     3 #	PSARC/2014/077
     4 # This change was implemented in-house.  The issue was brought up to
     4 # This change was implemented in-house.  The issue was brought up to
     5 # the upstream engineers, but there was no commitment.
     5 # the upstream engineers, but there was no commitment.
     6 #
     6 #
     7 --- openssl-1.0.1f/crypto/cryptlib.c.~1~	Fri Feb  7 10:41:36 2014
     7 --- openssl-1.0.1f/crypto/cryptlib.c.~1~	Fri Feb  7 10:41:36 2014
     8 +++ openssl-1.0.1f/crypto/cryptlib.c	Thu Feb  6 16:03:58 2014
     8 +++ openssl-1.0.1f/crypto/cryptlib.c	Thu Feb  6 16:03:58 2014
    11  #include "cryptlib.h"
    11  #include "cryptlib.h"
    12  #include <openssl/safestack.h>
    12  #include <openssl/safestack.h>
    13 +#include <pthread.h>
    13 +#include <pthread.h>
    14  
    14  
    15  #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN16)
    15  #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN16)
    16  static double SSLeay_MSVC5_hack=0.0; /* and for VC1.5 */
    16  static double SSLeay_MSVC5_hack = 0.0; /* and for VC1.5 */
    17 @@ -181,6 +182,7 @@
    17 @@ -184,6 +185,8 @@
    18     numbers.  */
    18   */
    19  static STACK_OF(CRYPTO_dynlock) *dyn_locks=NULL;
    19  static STACK_OF(CRYPTO_dynlock) *dyn_locks = NULL;
    20  
    20  
    21 +static pthread_mutex_t *solaris_openssl_locks;
    21 +static pthread_mutex_t *solaris_openssl_locks;
    22  
    22 +
    23  static void (MS_FAR *locking_callback)(int mode,int type,
    23  static void (MS_FAR *locking_callback) (int mode, int type,
    24  	const char *file,int line)=0;
    24                                          const char *file, int line) = 0;
    25 @@ -406,6 +409,79 @@
    25  static int (MS_FAR *add_lock_callback) (int *pointer, int amount,
    26  	return(add_lock_callback);
    26 @@ -402,6 +405,79 @@
    27  	}
    27      return (add_lock_callback);
       
    28  }
    28 
    29 
    29 +/*
    30 +/*
    30 + * This is the locking callback function which all applications will be
    31 + * This is the locking callback function which all applications will be
    31 + * using when CRYPTO_lock() is called.
    32 + * using when CRYPTO_lock() is called.
    32 + */ 
    33 + */ 
    95 +		{
    96 +		{
    96 +		pthread_mutex_init(&solaris_openssl_locks[i], NULL);
    97 +		pthread_mutex_init(&solaris_openssl_locks[i], NULL);
    97 +		}
    98 +		}
    98 +	locking_callback = solaris_locking_callback;
    99 +	locking_callback = solaris_locking_callback;
    99 +
   100 +
   100 +	}
   101 +}
   101 +
   102 +
   102  void CRYPTO_set_locking_callback(void (*func)(int mode,int type,
   103  void CRYPTO_set_locking_callback(void (*func) (int mode, int type,
   103  					      const char *file,int line))
   104                                                 const char *file, int line))
   104  	{
   105  {
   105 @@ -413,7 +478,11 @@
   106 @@ -410,7 +486,11 @@
   106  	 * are started.
   107       * started.
   107  	 */
   108       */
   108  	OPENSSL_init();
   109      OPENSSL_init();
   109 -	locking_callback=func;
   110 -    locking_callback = func;
   110 +
   111 +
   111 +	/*
   112 +	/*
   112 +	 * we now setup our own locking callback and mutexes, and disallow
   113 +	 * we now setup our own locking callback and mutexes, and disallow
   113 +	 * setting of another locking callback.
   114 +	 * setting of another locking callback.
   114 +	 */
   115 +	 */
   115  	}
   116  }
   116  
   117  
   117  void CRYPTO_set_add_lock_callback(int (*func)(int *num,int mount,int type,
   118  void CRYPTO_set_add_lock_callback(int (*func) (int *num, int mount, int type,
   118 --- openssl-1.0.1f/crypto/cryptlib.h.~1~	Fri Feb  7 10:41:42 2014
   119 --- openssl-1.0.1f/crypto/cryptlib.h.~1~	Fri Feb  7 10:41:42 2014
   119 +++ openssl-1.0.1f/crypto/cryptlib.h	Thu Feb  6 16:04:16 2014
   120 +++ openssl-1.0.1f/crypto/cryptlib.h	Thu Feb  6 16:04:16 2014
   120 @@ -104,6 +104,8 @@
   121 @@ -104,6 +104,8 @@
   121  void *OPENSSL_stderr(void);
   122  void *OPENSSL_stderr(void);
   122  extern int OPENSSL_NONPIC_relocated;
   123  extern int OPENSSL_NONPIC_relocated;