Skip to content

Commit

Permalink
Merge branch 'openssl:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
iProgramMC authored May 8, 2024
2 parents 58e7bf8 + f6ce48f commit 13cb7a0
Show file tree
Hide file tree
Showing 36 changed files with 800 additions and 303 deletions.
1 change: 1 addition & 0 deletions .github/workflows/run-checker-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
no-ts,
enable-weak-ssl-ciphers,
enable-zlib,
enable-pie,
]
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
run: nmake test VERBOSE_FAILURE=yes TESTS=-test_fuzz* HARNESS_JOBS=4
- name: install
# Run on 64 bit only as 32 bit is slow enough already
if: $${{ matrix.platform.arch == 'win64' }}
if: ${{ matrix.platform.arch == 'win64' }}
run: |
mkdir _dest
nmake install DESTDIR=_dest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
/include/openssl/ui.h
/include/openssl/x509.h
/include/openssl/x509v3.h
/include/openssl/x509_acert.h
/include/openssl/x509_vfy.h
/include/openssl/core_names.h
/include/internal/param_names.h
Expand Down
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ OpenSSL 3.4

*Damian Hobson-Garcia*

* Added support to build Position Independent Executables (PIE). Configuration
option `enable-pie` configures the cflag '-fPIE' and ldflag '-pie' to
support Address Space Layout Randomization (ASLR) in the openssl executable,
removes reliance on external toolchain configurations.

*Craig Lorentzen*

OpenSSL 3.3
-----------

Expand Down
16 changes: 16 additions & 0 deletions Configurations/00-base-templates.conf
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,22 @@ my %targets=(
AR => "ar",
ARFLAGS => "qc",
CC => "cc",
bin_cflags =>
sub {
my @flags = ();
if (!defined($disabled{pie})) {
push(@flags, "-fPIE");
}
return join(" ", @flags);
},
bin_lflags =>
sub {
my @flags = ();
if (!defined($disabled{pie})) {
push(@flags, "-pie");
}
return join(" ", @flags);
},
lflags =>
sub {
my @libs = ();
Expand Down
9 changes: 8 additions & 1 deletion Configurations/10-main.conf
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,14 @@ my %targets = (
asm_arch => 'aarch64',
perlasm_scheme => "linux64",
},

"linux-arm64ilp32-clang" => { # clang config abi by --target
inherit_from => [ "linux-generic32" ],
CC => "clang",
CXX => "clang++",
bn_ops => "SIXTY_FOUR_BIT RC4_CHAR",
asm_arch => 'aarch64',
perlasm_scheme => "linux64",
},
"linux-mips32" => {
# Configure script adds minimally required -march for assembly
# support, if no -march was specified at command line.
Expand Down
6 changes: 6 additions & 0 deletions Configure
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ my @disablables = (
"ocsp",
"padlockeng",
"pic",
"pie",
"pinshared",
"poly1305",
"posix-io",
Expand Down Expand Up @@ -584,6 +585,7 @@ our %disabled = ( # "what" => "comment"
"external-tests" => "default",
"fuzz-afl" => "default",
"fuzz-libfuzzer" => "default",
"pie" => "default",
"ktls" => "default",
"md2" => "default",
"msan" => "default",
Expand Down Expand Up @@ -943,6 +945,10 @@ while (@argvcopy)
{
delete $disabled{"brotli"};
}
elsif ($1 eq "pie")
{
delete $disabled{"pie"};
}
elsif ($1 eq "zstd-dynamic")
{
delete $disabled{"zstd"};
Expand Down
4 changes: 4 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,10 @@ As synonym for `no-padlockeng`. Deprecated and should not be used.

Don't build with support for Position Independent Code.

### enable-pie

Build with support for Position Independent Execution.

### no-pinshared

Don't pin the shared libraries.
Expand Down
75 changes: 0 additions & 75 deletions crypto/asn1/a_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,78 +591,3 @@ int ASN1_TIME_compare(const ASN1_TIME *a, const ASN1_TIME *b)
return -1;
return 0;
}

/*
* tweak for Windows
*/
#ifdef WIN32
# define timezone _timezone
#endif

#if defined(__FreeBSD__) || defined(__wasi__)
# define USE_TIMEGM
#endif

time_t ossl_asn1_string_to_time_t(const char *asn1_string)
{
ASN1_TIME *timestamp_asn1 = NULL;
struct tm *timestamp_tm = NULL;
#if defined(__DJGPP__)
char *tz = NULL;
#elif !defined(USE_TIMEGM)
time_t timestamp_local;
#endif
time_t timestamp_utc;

timestamp_asn1 = ASN1_TIME_new();
if (!ASN1_TIME_set_string(timestamp_asn1, asn1_string))
{
ASN1_TIME_free(timestamp_asn1);
return -1;
}

timestamp_tm = OPENSSL_malloc(sizeof(*timestamp_tm));
if (timestamp_tm == NULL) {
ASN1_TIME_free(timestamp_asn1);
return -1;
}
if (!(ASN1_TIME_to_tm(timestamp_asn1, timestamp_tm))) {
OPENSSL_free(timestamp_tm);
ASN1_TIME_free(timestamp_asn1);
return -1;
}
ASN1_TIME_free(timestamp_asn1);

#if defined(__DJGPP__)
/*
* This is NOT thread-safe. Do not use this method for platforms other
* than djgpp.
*/
tz = getenv("TZ");
if (tz != NULL) {
tz = OPENSSL_strdup(tz);
if (tz == NULL) {
OPENSSL_free(timestamp_tm);
return -1;
}
}
setenv("TZ", "UTC", 1);

timestamp_utc = mktime(timestamp_tm);

if (tz != NULL) {
setenv("TZ", tz, 1);
OPENSSL_free(tz);
} else {
unsetenv("TZ");
}
#elif defined(USE_TIMEGM)
timestamp_utc = timegm(timestamp_tm);
#else
timestamp_local = mktime(timestamp_tm);
timestamp_utc = timestamp_local - timezone;
#endif
OPENSSL_free(timestamp_tm);

return timestamp_utc;
}
Loading

0 comments on commit 13cb7a0

Please sign in to comment.