openssl: Cleanup some old, untested patches

This commit is contained in:
William A. Kennington III 2015-05-29 16:08:27 -07:00
parent 7b1336d2f1
commit afa5859716
6 changed files with 1 additions and 170 deletions

View File

@ -1,34 +0,0 @@
This patch, to be applied after `cert-file.patch', fixes compilation
on GNU/Hurd where `PATH_MAX' is not defined.
diff -ubB --show-c-function openssl-1.0.0e/crypto/x509/x509_def.c.orig openssl-1.0.0e/crypto/x509/x509_def.c
--- openssl-1.0.0e/crypto/x509/x509_def.c.orig 2012-01-06 00:08:48.000000000 +0100
+++ openssl-1.0.0e/crypto/x509/x509_def.c 2012-01-06 00:11:29.000000000 +0100
@@ -58,6 +58,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <limits.h>
#include <unistd.h>
#include <sys/types.h>
@@ -76,14 +77,16 @@ const char *X509_get_default_cert_dir(vo
const char *X509_get_default_cert_file(void)
{
- static char buf[PATH_MAX] = X509_CERT_FILE;
+ static char *buf;
static int init = 0;
if (!init) {
init = 1;
char * s = getenv("OPENSSL_X509_CERT_FILE");
if (s && getuid() == geteuid()) {
- strncpy(buf, s, sizeof(buf));
- buf[sizeof(buf) - 1] = 0;
+ buf = strdup(s);
+ }
+ if (!s) {
+ buf = strdup(X509_CERT_FILE);
}
}
return buf;

View File

@ -1,39 +0,0 @@
diff -ru openssl-1.0.1m-orig/crypto/x509/x509_def.c openssl-1.0.1m/crypto/x509/x509_def.c
--- openssl-1.0.1m-orig/crypto/x509/x509_def.c 2015-03-19 14:19:00.000000000 +0100
+++ openssl-1.0.1m/crypto/x509/x509_def.c 2015-03-19 15:50:44.676683616 +0100
@@ -57,6 +57,10 @@
*/
#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <unistd.h>
+#include <sys/types.h>
#include "cryptlib.h"
#include <openssl/crypto.h>
#include <openssl/x509.h>
@@ -78,7 +82,23 @@
const char *X509_get_default_cert_file(void)
{
- return (X509_CERT_FILE);
+ static char buf[PATH_MAX] = X509_CERT_FILE;
+ static int init = 0;
+ if (!init) {
+ init = 1;
+ char * s = getenv("OPENSSL_X509_CERT_FILE");
+ if (s) {
+#ifndef OPENSSL_SYS_WINDOWS
+ if (getuid() == geteuid()) {
+#endif
+ strncpy(buf, s, sizeof(buf));
+ buf[sizeof(buf) - 1] = 0;
+#ifndef OPENSSL_SYS_WINDOWS
+ }
+#endif
+ }
+ }
+ return buf;
}
const char *X509_get_default_cert_dir_env(void)

View File

@ -10,30 +10,7 @@ let
patchesCross = isCross: let
isDarwin = stdenv.isDarwin || (isCross && stdenv.cross.libc == "libSystem");
in
[ # Allow the location of the X509 certificate file (the CA
# bundle) to be set through the environment variable
# OPENSSL_X509_CERT_FILE. This is necessary because the
# default location ($out/ssl/cert.pem) doesn't exist, and
# hardcoding something like /etc/ssl/cert.pem is impure and
# cannot be overriden per-process. For security, the
# environment variable is ignored for setuid binaries.
# FIXME: drop this patch; it really isn't necessary, because
# OpenSSL already supports a SSL_CERT_FILE variable.
./cert-file.patch
]
++ stdenv.lib.optionals (isCross && opensslCrossSystem == "hurd-x86")
[ ./cert-file-path-max.patch # merge with `cert-file.patch' eventually
./gnu.patch # submitted upstream
]
++ stdenv.lib.optionals (stdenv.system == "x86_64-kfreebsd-gnu")
[ ./gnu.patch
./kfreebsd-gnu.patch
]
++ stdenv.lib.optional isDarwin ./darwin-arch.patch;
in stdenv.lib.optional isDarwin ./darwin-arch.patch;
extraPatches = stdenv.lib.optional stdenv.isCygwin ./1.0.1-cygwin64.patch;
in

View File

@ -1,25 +0,0 @@
Patch to fix compilation on GNU/Hurd and GNU/kFreeBSD.
--- openssl-1.0.0e/Configure 2012-01-06 00:39:49.000000000 +0100
+++ openssl-1.0.0e/Configure 2012-01-06 00:39:51.000000000 +0100
@@ -563,7 +563,7 @@ my %table=(
"newsos4-gcc","gcc:-O -DB_ENDIAN::(unknown):NEWS4:-lmld -liberty:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::",
##### GNU Hurd
-"hurd-x86", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC",
+"hurd-x86", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
##### OS/2 EMX
"OS2-EMX", "gcc::::::::",
--- openssl-1.0.0e/crypto/dso/dso_dlfcn.c 2012-01-06 00:05:47.000000000 +0100
+++ openssl-1.0.0e/crypto/dso/dso_dlfcn.c 2012-01-06 00:21:05.000000000 +0100
@@ -60,7 +60,7 @@
that handle _GNU_SOURCE and other similar macros. Defining it later
is simply too late, because those headers are protected from re-
inclusion. */
-#ifdef __linux
+#if defined __linux || defined __GNU__ || defined __GLIBC__
# ifndef _GNU_SOURCE
# define _GNU_SOURCE /* make sure dladdr is declared */
# endif

View File

@ -1,12 +0,0 @@
diff -Naur openssl-1.0.0d-orig/Configure openssl-1.0.0d/Configure
--- openssl-1.0.0d-orig/Configure 2010-11-30 17:19:26.000000000 -0500
+++ openssl-1.0.0d/Configure 2011-11-16 13:52:57.614416683 -0500
@@ -563,7 +563,7 @@
"newsos4-gcc","gcc:-O -DB_ENDIAN::(unknown):NEWS4:-lmld -liberty:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::",
##### GNU Hurd
-"hurd-x86", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC",
+"hurd-x86","gcc:-DL_ENDIAN -DTERMIOS -O3 -Wa,--noexecstack -g -mtune=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
##### OS/2 EMX
"OS2-EMX", "gcc::::::::",

View File

@ -1,36 +0,0 @@
Allow compilation on GNU/kFreeBSD. Ideally, there'd be a single way to process
all glibc-based system, but the build system is soooo broken.
--- openssl-1.0.0i/config
+++ openssl-1.0.0i/config
@@ -170,6 +170,10 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${
echo "${MACHINE}-whatever-linux1"; exit 0
;;
+ GNU/kFreeBSD*)
+ echo "kfreebsd-gnu"; exit 0;
+ ;;
+
GNU*)
echo "hurd-x86"; exit 0;
;;
@@ -810,6 +814,7 @@ case "$GUESSOS" in
beos-*) OUT="$GUESSOS" ;;
x86pc-*-qnx6) OUT="QNX6-i386" ;;
*-*-qnx6) OUT="QNX6" ;;
+ kfreebsd-gnu) OUT="kfreebsd-gnu";;
*) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;;
esac
--- openssl-1.0.0i/Configure
+++ openssl-1.0.0i/Configure
@@ -565,6 +565,9 @@ my %table=(
##### GNU Hurd
"hurd-x86", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC",
+##### GNU/kFreeBSD on x86_64, copied from "linux-x86_64"
+"kfreebsd-gnu", "gcc:-m64 -DL_ENDIAN -DTERMIOS -O3 -Wall -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
+
##### OS/2 EMX
"OS2-EMX", "gcc::::::::",