components/openssl/openssl-1.0.1/patches/15-pkcs11_engine-0.9.8a.patch
branchs11-update
changeset 4006 c737cefdce54
parent 2930 4177d9c0b142
equal deleted inserted replaced
4005:4bcc81bdda4e 4006:c737cefdce54
       
     1 #
       
     2 # This patch file adds the Solaris's pkcs11 engine.
       
     3 # This is Solaris-specific (developed in house): not suitable for upstream.
       
     4 #
     1 --- /tmp/Configure	Fri Feb 11 14:40:39 2011
     5 --- /tmp/Configure	Fri Feb 11 14:40:39 2011
     2 +++ openssl-1.0.0d/Configure	Fri Feb 11 14:41:36 2011
     6 +++ openssl-1.0.0d/Configure	Fri Feb 11 14:41:36 2011
     3 @@ -10,7 +10,7 @@
     7 @@ -10,7 +10,7 @@
     4  
     8  
     5  # see INSTALL for instructions.
     9  # see INSTALL for instructions.
    27 +my $pk11_libname="";
    31 +my $pk11_libname="";
    28 +
    32 +
    29  my $prefix="";
    33  my $prefix="";
    30  my $libdir="";
    34  my $libdir="";
    31  my $openssldir="";
    35  my $openssldir="";
    32 @@ -876,6 +879,10 @@
    36 @@ -882,6 +888,10 @@
    33 				$_ =~ s/%([0-9a-f]{1,2})/chr(hex($1))/gei;
    37 				$_ =~ s/%([0-9a-f]{1,2})/chr(hex($1))/gei;
    34 				$flags.=$_." ";
    38 				$flags.=$_." ";
    35 				}
    39 				}
    36 +			elsif (/^--pk11-libname=(.*)$/)
    40 +			elsif (/^--pk11-libname=(.*)$/)
    37 +				{
    41 +				{
    38 +				$pk11_libname=$1;
    42 +				$pk11_libname=$1;
    39 +				}
    43 +				}
    40 			elsif (/^--prefix=(.*)$/)
    44 			elsif (/^--prefix=(.*)$/)
    41 				{
    45 				{
    42 				$prefix=$1;
    46 				$prefix=$1;
    43 @@ -1043,6 +1054,13 @@
    47 @@ -1049,6 +1059,13 @@
    44  	exit 0;
    48  	exit 0;
    45  }
    49  }
    46  
    50  
    47 +if (! $pk11_libname)
    51 +if (! $pk11_libname)
    48 +        {
    52 +        {
    52 +        }
    56 +        }
    53 +
    57 +
    54  if ($target =~ m/^CygWin32(-.*)$/) {
    58  if ($target =~ m/^CygWin32(-.*)$/) {
    55  	$target = "Cygwin".$1;
    59  	$target = "Cygwin".$1;
    56  }
    60  }
    57 @@ -1209,6 +1226,8 @@
    61 @@ -1215,6 +1232,8 @@
    58  if ($flags ne "")	{ $cflags="$flags$cflags"; }
    62  if ($flags ne "")	{ $cflags="$flags$cflags"; }
    59  else			{ $no_user_cflags=1;       }
    63  else			{ $no_user_cflags=1;       }
    60  
    64  
    61 +$cflags="-DPK11_LIB_LOCATION=\"$pk11_libname\" $cflags";
    65 +$cflags="-DPK11_LIB_LOCATION=\"$pk11_libname\" $cflags";
    62 +
    66 +
    63  # Kerberos settings.  The flavor must be provided from outside, either through
    67  # Kerberos settings.  The flavor must be provided from outside, either through
    64  # the script "config" or manually.
    68  # the script "config" or manually.
    65  if (!$no_krb5)
    69  if (!$no_krb5)
    66 @@ -1598,6 +1617,7 @@
    70 @@ -1604,6 +1623,7 @@
    67  	s/^VERSION=.*/VERSION=$version/;
    71  	s/^VERSION=.*/VERSION=$version/;
    68  	s/^MAJOR=.*/MAJOR=$major/;
    72  	s/^MAJOR=.*/MAJOR=$major/;
    69  	s/^MINOR=.*/MINOR=$minor/;
    73  	s/^MINOR=.*/MINOR=$minor/;
    70 +	s/^PK11_LIB_LOCATION=.*/PK11_LIB_LOCATION=$pk11_libname/;
    74 +	s/^PK11_LIB_LOCATION=.*/PK11_LIB_LOCATION=$pk11_libname/;
    71  	s/^SHLIB_VERSION_NUMBER=.*/SHLIB_VERSION_NUMBER=$shlib_version_number/;
    75  	s/^SHLIB_VERSION_NUMBER=.*/SHLIB_VERSION_NUMBER=$shlib_version_number/;
    81 +PK11_LIB_LOCATION=
    85 +PK11_LIB_LOCATION=
    82 +
    86 +
    83  # Do not edit this manually. Use Configure --openssldir=DIR do change this!
    87  # Do not edit this manually. Use Configure --openssldir=DIR do change this!
    84  OPENSSLDIR=/usr/local/ssl
    88  OPENSSLDIR=/usr/local/ssl
    85  
    89  
    86 --- openssl-1.0.1f/engines/Makefile.~1~	Thu Jan 30 10:42:05 2014
    90 --- /tmp/Makefile	Mon Feb 14 14:59:22 2011
    87 +++ openssl-1.0.1f/engines/Makefile	Thu Jan 30 10:45:27 2014
    91 +++ openssl-1.0.0d/engines/Makefile	Mon Feb 14 15:00:35 2011
    88 @@ -26,7 +26,8 @@
    92 @@ -26,7 +26,8 @@
    89  APPS=
    93  APPS=
    90  
    94  
    91  LIB=$(TOP)/libcrypto.a
    95  LIB=$(TOP)/libcrypto.a
    92 -LIBNAMES= 4758cca aep atalla cswift gmp chil nuron sureware ubsec padlock capi
    96 -LIBNAMES= 4758cca aep atalla cswift gmp chil nuron sureware ubsec padlock capi
   132 -				LIBDEPS='-L.. -lcrypto $(EX_LIBS)' \
   136 -				LIBDEPS='-L.. -lcrypto $(EX_LIBS)' \
   133 +				LIBDEPS='-L.. -lcrypto -lcryptoutil $(EX_LIBS)' \
   137 +				LIBDEPS='-L.. -lcrypto -lcryptoutil $(EX_LIBS)' \
   134  				link_o.$(SHLIB_TARGET); \
   138  				link_o.$(SHLIB_TARGET); \
   135  		done; \
   139  		done; \
   136  	else \
   140  	else \
   137 --- openssl-1.0.1f/crypto/engine/eng_all.c.~1~	Thu Jan 30 10:55:48 2014
   141 --- crypto/engine/eng_all.c Thu Sep  5 12:59:50 2013
   138 +++ openssl-1.0.1f/crypto/engine/eng_all.c	Thu Jan 30 10:57:29 2014
   142 +++ openssl-1.0.1e/crypto/engine/eng_all.c Thu Sep  5 12:59:50 2013
   139 @@ -59,6 +59,16 @@
   143 @@ -60,6 +60,16 @@
   140  #include "cryptlib.h"
   144  #include "cryptlib.h"
   141  #include "eng_int.h"
   145  #include "eng_int.h"
   142  
   146 
   143 +/*
   147 +/*
   144 + * pkcs11 engine no longer is a built-in engine, and ENGINE_load_pk11() needs to be
   148 + * pkcs11 engine no longer is a built-in engine, and ENGINE_load_pk11() needs to be
   145 + * defined in libcrypto.so for ssh. Instead of load pkcs11 engine, it loads dynamic
   149 + * defined in libcrypto.so for ssh.  Instead of load pkcs11 engine, it load dynamic
   146 + * engines.
   150 + * engines.
   147 + */
   151 + */
   148 +void ENGINE_load_pk11(void)
   152 +void ENGINE_load_pk11(void)
   149 +	{
   153 +	{
   150 +	ENGINE_load_dynamic();
   154 +	ENGINE_load_dynamic();
   151 +	}
   155 +	}
   152 +
   156 +
   153  void ENGINE_load_builtin_engines(void)
   157  void ENGINE_load_builtin_engines(void)
   154  	{
   158  {
   155  	/* Some ENGINEs need this */
   159      /* Some ENGINEs need this */
   156 --- openssl-1.0.1f/crypto/dso/dso_lib.c.~1~	Thu Jan 30 11:04:41 2014
   160 --- crypto/dso/dso_lib.c Thu Sep  5 12:59:50 2013
   157 +++ openssl-1.0.1f/crypto/dso/dso_lib.c	Thu Jan 30 11:29:40 2014
   161 +++ openssl-1.0.1e/crypto/dso/dso_lib.c Thu Sep  5 12:59:50 2013
   158 @@ -426,6 +426,26 @@
   162 @@ -396,6 +396,24 @@
   159  		DSOerr(DSO_F_DSO_CONVERT_FILENAME,DSO_R_NO_FILENAME);
   163          DSOerr(DSO_F_DSO_CONVERT_FILENAME, DSO_R_NO_FILENAME);
   160  		return(NULL);
   164          return (NULL);
   161  		}
   165      }
   162 +/*
   166 +    /*
   163 + * For pkcs11 engine, use libpk11.so (instead of libpkcs11.so) to
   167 +     * For pkcs11 engine, use libpk11.so (instead of libpkcs11.so) to
   164 + * avoid the name collision with PKCS#11 library.
   168 +     * avoid the name collision with PKCS#11 library.
   165 + */
   169 +     */
   166 +	if (strcmp(filename, "pkcs11") == 0)
   170 +    if (strcmp(filename, "pkcs11") == 0) {
   167 +		{
   171 +#ifdef  _LP64
   168 +#ifdef _LP64
   172 +        static const char fullpath[] = "/lib/openssl/engines/64/libpk11.so";
   169 +		static const char fullpath[] = "/lib/openssl/engines/64/libpk11.so";
       
   170 +#else
   173 +#else
   171 +		static const char fullpath[] = "/lib/openssl/engines/libpk11.so";
   174 +        static const char fullpath[] = "/lib/openssl/engines/libpk11.so";
   172 +#endif
   175 +#endif
   173 +		result = OPENSSL_malloc(strlen(fullpath) + 1);
   176 +        result = OPENSSL_malloc(strlen(fullpath) + 1);
   174 +		if (result == NULL)
   177 +        if(result == NULL) {
   175 +			{
   178 +            DSOerr(DSO_F_DSO_CONVERT_FILENAME, ERR_R_MALLOC_FAILURE);
   176 +			DSOerr(DSO_F_DSO_CONVERT_FILENAME, ERR_R_MALLOC_FAILURE);
   179 +            return(NULL);
   177 +			return(NULL);
   180 +        }
   178 +			}
   181 +        BUF_strlcpy(result, fullpath, strlen(fullpath) + 1);
   179 +		BUF_strlcpy(result, fullpath, sizeof(fullpath));
   182 +        return (result);
   180 +		return(result);
   183 +    }
   181 +		}
   184      if ((dso->flags & DSO_FLAG_NO_NAME_TRANSLATION) == 0) {
   182  	if((dso->flags & DSO_FLAG_NO_NAME_TRANSLATION) == 0)
   185          if (dso->name_converter != NULL)
   183  		{
   186              result = dso->name_converter(dso, filename);
   184  		if(dso->name_converter != NULL)
       
   185 --- /tmp/engine.h       Fri Feb 11 14:46:24 2011
   187 --- /tmp/engine.h       Fri Feb 11 14:46:24 2011
   186 +++ openssl-1.0.0d/crypto/engine/engine.h       Fri Feb 11 14:47:32 2011
   188 +++ openssl-1.0.0d/crypto/engine/engine.h       Fri Feb 11 14:47:32 2011
   187 @@ -351,6 +351,7 @@
   189 @@ -413,6 +413,7 @@
   188  #endif
   190  #  endif
   189  #endif
   191  # endif
   190  void ENGINE_load_cryptodev(void);
   192  void ENGINE_load_cryptodev(void);
   191 +void ENGINE_load_pk11(void);
   193 +void ENGINE_load_pk11(void);
   192  void ENGINE_load_rsax(void);
   194  void ENGINE_load_rsax(void);
   193  void ENGINE_load_rdrand(void);
   195  void ENGINE_load_rdrand(void);
   194  void ENGINE_load_builtin_engines(void);
   196  void ENGINE_load_builtin_engines(void);