Skip to content

Commit d976fed

Browse files
test openssl
1 parent 3dd74af commit d976fed

3 files changed

Lines changed: 49 additions & 32 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -393,33 +393,9 @@ jobs:
393393

394394
- name: Build depends (macOS)
395395
if: matrix.name == 'x86_64-macos'
396-
shell: bash
396+
397397
run: |
398-
set -e
399-
echo "▶ Setting global compiler override…"
400-
401-
mkdir -p fakebin
402-
403-
# cc wrapper used by native_cdrkit / cmake
404-
cat <<'EOF' > fakebin/cc
405-
#!/bin/bash
406-
exec /usr/bin/clang "$@"
407-
EOF
408-
409-
# clang wrapper for things like openssl's util/domd calling 'clang'
410-
cat <<'EOF' > fakebin/clang
411-
#!/bin/bash
412-
exec /usr/bin/clang "$@"
413-
EOF
414-
415-
chmod +x fakebin/cc fakebin/clang
416-
417-
export PATH="$(pwd)/fakebin:$PATH"
418-
419-
echo "▶ Building depends with forced compiler override…"
420-
CC=cc \
421-
CXX=clang++ \
422-
CC_FOR_BUILD=cc \
398+
423399
make $MAKEJOBS -C depends HOST=${{ matrix.host }}
424400
425401
- name: CCache

depends/packages/openssl.mk

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package=openssl
2-
$(package)_version=1.0.2t
3-
$(package)_download_path=http://slackware.cs.utah.edu/pub/openssl-ftp/source/old/1.0.2/
4-
$(package)_file_name=$(package)-$($(package)_version).tar.gz
5-
$(package)_sha256_hash=14cb464efe7ac6b54799b34456bd69558a749a4931ecfd9cf9f71d7881cac7bc
2+
$(package)_version=1.0.2
3+
$(package)_version_suffix=u
4+
$(package)_download_path=https://www.openssl.org/source/old/$($(package)_version)
5+
$(package)_file_name=$(package)-$($(package)_version)$($(package)_version_suffix).tar.gz
6+
$(package)_sha256_hash=ecd0c6ffb493dd06707d38b14bb4d8c2288bb7033735606569d8f90f89669d16
7+
$(package)_patches=secure_getenv.patch
68

79
define $(package)_set_vars
810
$(package)_config_env=AR="$($(package)_ar)" RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)"
@@ -58,12 +60,14 @@ $(package)_config_opts_i686_mingw32=mingw
5860
endef
5961

6062
define $(package)_preprocess_cmds
63+
patch -p1 < $($(package)_patch_dir)/secure_getenv.patch && \
6164
sed -i.old "/define DATE/d" util/mkbuildinf.pl && \
6265
sed -i.old "s|engines apps test|engines|" Makefile.org
6366
endef
6467

6568
define $(package)_config_cmds
66-
./Configure $($(package)_config_opts) && $(MAKE) depend
69+
./Configure $($(package)_config_opts) && \
70+
make depend
6771
endef
6872

6973
define $(package)_build_cmds
@@ -76,4 +80,4 @@ endef
7680

7781
define $(package)_postprocess_cmds
7882
rm -rf share bin etc
79-
endef
83+
endef
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Solves export of glibc 2.17 secure_getenv because we support down to 2.11
2+
3+
Patches openssl 1.0.2's usage of secure_getenv from glibc 2.17 to instead
4+
always use the fallback OPENSSL_issetugid(), which essentially does the
5+
same thing on linux, with the only difference that the glibc version makes
6+
decisions on startup, whereas the openssl version does the same check each
7+
time the environment is read.
8+
9+
glibc check: https://sourceware.org/git/?p=glibc.git;a=blob;f=elf/enbl-secure.c;h=9e47526bd3e444e1a19a8ea9fd310b6f47c4db52;hb=HEAD
10+
glibc implementation: https://sourceware.org/git/?p=glibc.git;a=blob;f=stdlib/secure-getenv.c;h=a394eebcf794c1279d66e5bcb71d4b15725e6e5a;hb=HEAD
11+
12+
openssl check: https://github.com/openssl/openssl/blob/OpenSSL_1_0_2u/crypto/uid.c
13+
14+
This patch can be removed when glibc 2.17 is the minimum version supported
15+
16+
Author: Patrick Lodder <patricklodder@users.noreply.github.com>
17+
18+
diff -dur a/crypto/getenv.c b/crypto/getenv.c
19+
--- a/crypto/getenv.c 2019-12-20 13:02:41.000000000 +0000
20+
+++ b/crypto/getenv.c 2021-09-20 03:02:04.125747397 +0000
21+
@@ -16,16 +16,7 @@
22+
23+
char *ossl_safe_getenv(const char *name)
24+
{
25+
-#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
26+
-# if __GLIBC_PREREQ(2, 17)
27+
-# define SECURE_GETENV
28+
- return secure_getenv(name);
29+
-# endif
30+
-#endif
31+
-
32+
-#ifndef SECURE_GETENV
33+
if (OPENSSL_issetugid())
34+
return NULL;
35+
return getenv(name);
36+
-#endif
37+
}

0 commit comments

Comments
 (0)