mirror of https://github.com/openssl/openssl
Compare commits
6 Commits
3d0ac2565d
...
eaad871bae
Author | SHA1 | Date |
---|---|---|
cntrump | eaad871bae | |
shridhar kalavagunta | 57bb112c07 | |
Huiyue Xu | 69bd5e4fff | |
Florian Greinacher | 0fff6a2cf4 | |
cntrump | 712bf2b38f | |
luckify | 6239a24ce0 |
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
#### Apple universal libraries for macOS, iOS, tvOS, watchOS, visionOS
|
||||
#
|
||||
# automatically determine toolchain location using xcrun
|
||||
#
|
||||
# armv7 is deprecated for devices
|
||||
# i386 is deprecated for simulators
|
||||
#
|
||||
|
||||
sub xcrun_get_sysroot_path {
|
||||
my $sdk_path = qx{ xcrun --sdk $_[0] --show-sdk-path };
|
||||
chomp($sdk_path);
|
||||
|
||||
return $sdk_path;
|
||||
}
|
||||
|
||||
sub xcrun_get_bin_path {
|
||||
my $bin_path = qx{ xcrun --find $_[0] };
|
||||
chomp($bin_path);
|
||||
|
||||
return $bin_path;
|
||||
}
|
||||
|
||||
my %targets = (
|
||||
"apple-xcrun-common" => {
|
||||
inherit_from => [ "BASE_unix" ],
|
||||
template => 1,
|
||||
LD => xcrun_get_bin_path("ld"),
|
||||
AR => xcrun_get_bin_path("ar"),
|
||||
CC => xcrun_get_bin_path("clang"),
|
||||
CFLAGS => picker(debug => "-g -O0",
|
||||
release => "-O3"),
|
||||
cflags => add("-fno-common -DHAVE_FORK=0"),
|
||||
cppflags => threads("-D_REENTRANT"),
|
||||
lflags => add("-Wl,-search_paths_first"),
|
||||
bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
|
||||
thread_scheme => "pthreads",
|
||||
dso_scheme => "dlfcn",
|
||||
ranlib => xcrun_get_bin_path("ranlib") . " -c",
|
||||
shared_target => "darwin-shared",
|
||||
shared_cflag => "-fPIC",
|
||||
shared_extension => ".\$(SHLIB_VERSION_NUMBER).dylib",
|
||||
disable => [ "async", "dso", "engine", "hw" ],
|
||||
},
|
||||
"apple-noasm-xcrun-common" => {
|
||||
inherit_from => [ "apple-xcrun-common" ],
|
||||
disable => add("asm"),
|
||||
},
|
||||
"apple-universal-libraries-common" => {
|
||||
inherit_from => [ "apple-noasm-xcrun-common" ],
|
||||
disable => add("tests", "apps"),
|
||||
},
|
||||
"apple-universal-static-libraries-common" => {
|
||||
inherit_from => [ "apple-universal-libraries-common" ],
|
||||
disable => add("shared"),
|
||||
},
|
||||
"apple-universal-macosx" => {
|
||||
inherit_from => [ "apple-universal-static-libraries-common" ],
|
||||
sys_id => "MACOSX",
|
||||
cflags => add("-target apple-macosx10.9 -arch x86_64 -arch arm64 -isysroot \"" . xcrun_get_sysroot_path("macosx") . "\""),
|
||||
},
|
||||
"apple-universal-maccatalyst" => {
|
||||
inherit_from => [ "apple-universal-static-libraries-common" ],
|
||||
sys_id => "MacCatalyst",
|
||||
cflags => add("-target apple-ios13.1-macabi -arch x86_64 -arch arm64 -isysroot \"" . xcrun_get_sysroot_path("macosx") . "\""),
|
||||
},
|
||||
"apple-universal-ios" => {
|
||||
inherit_from => [ "apple-universal-static-libraries-common" ],
|
||||
sys_id => "iOS",
|
||||
cflags => add("-target apple-ios11.0 -arch arm64 -isysroot \"" . xcrun_get_sysroot_path("iphoneos") . "\""),
|
||||
},
|
||||
"apple-universal-iossim" => {
|
||||
inherit_from => [ "apple-universal-static-libraries-common" ],
|
||||
sys_id => "iOS",
|
||||
cflags => add("-target apple-ios11.0-simulator -arch x86_64 -arch arm64 -isysroot \"" . xcrun_get_sysroot_path("iphonesimulator") . "\""),
|
||||
},
|
||||
"apple-universal-tvos" => {
|
||||
inherit_from => [ "apple-universal-static-libraries-common" ],
|
||||
sys_id => "tvOS",
|
||||
cflags => add("-target apple-tvos9.0 -arch arm64 -isysroot \"" . xcrun_get_sysroot_path("appletvos") . "\""),
|
||||
},
|
||||
"apple-universal-tvossim" => {
|
||||
inherit_from => [ "apple-universal-static-libraries-common" ],
|
||||
sys_id => "tvOS",
|
||||
cflags => add("-target apple-tvos9.0-simulator -arch x86_64 -arch arm64 -isysroot \"" . xcrun_get_sysroot_path("appletvsimulator") . "\""),
|
||||
},
|
||||
"apple-universal-watchos" => {
|
||||
inherit_from => [ "apple-universal-static-libraries-common" ],
|
||||
sys_id => "watchOS",
|
||||
cflags => add("-target apple-watchos9.0 -arch arm64_32 -isysroot \"" . xcrun_get_sysroot_path("watchos") . "\""),
|
||||
},
|
||||
"apple-universal-watchossim" => {
|
||||
inherit_from => [ "apple-universal-static-libraries-common" ],
|
||||
sys_id => "watchOS",
|
||||
cflags => add("-target apple-watchos9.0-simulator -arch x86_64 -arch arm64 -isysroot \"" . xcrun_get_sysroot_path("watchsimulator") . "\""),
|
||||
},
|
||||
"apple-universal-visionos" => {
|
||||
inherit_from => [ "apple-universal-static-libraries-common" ],
|
||||
sys_id => "xrOS",
|
||||
cflags => add("-target apple-xros1.0 -arch arm64 -isysroot \"" . xcrun_get_sysroot_path("xros") . "\""),
|
||||
},
|
||||
"apple-universal-visionossim" => {
|
||||
inherit_from => [ "apple-universal-static-libraries-common" ],
|
||||
sys_id => "xrOS",
|
||||
cflags => add("-target apple-xros1.0-simulator -arch x86_64 -arch arm64 -isysroot \"" . xcrun_get_sysroot_path("xrsimulator") . "\""),
|
||||
},
|
||||
);
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -147,7 +147,6 @@ EVP_PKEY *ossl_d2i_PrivateKey_legacy(int keytype, EVP_PKEY **a,
|
|||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
X509_ALGOR *ossl_X509_ALGOR_from_nid(int nid, int ptype, void *pval);
|
||||
|
||||
time_t ossl_asn1_string_to_time_t(const char *asn1_string);
|
||||
void ossl_asn1_string_set_bits_left(ASN1_STRING *str, unsigned int num);
|
||||
|
||||
#endif /* ndef OSSL_CRYPTO_ASN1_H */
|
||||
|
|
|
@ -434,10 +434,10 @@ static int convert_asn1_to_time_t(int idx)
|
|||
{
|
||||
time_t testdateutc;
|
||||
|
||||
testdateutc = ossl_asn1_string_to_time_t(asn1_to_utc[idx].input);
|
||||
testdateutc = test_asn1_string_to_time_t(asn1_to_utc[idx].input);
|
||||
|
||||
if (!TEST_time_t_eq(testdateutc, asn1_to_utc[idx].expected)) {
|
||||
TEST_info("ossl_asn1_string_to_time_t (%s) failed: expected %lli, got %lli\n",
|
||||
TEST_info("test_asn1_string_to_time_t (%s) failed: expected %lli, got %lli\n",
|
||||
asn1_to_utc[idx].input,
|
||||
(long long int)asn1_to_utc[idx].expected,
|
||||
(long long int)testdateutc);
|
||||
|
|
|
@ -26,7 +26,7 @@ IF[{- !$disabled{tests} -}]
|
|||
testutil/format_output.c testutil/load.c testutil/fake_random.c \
|
||||
testutil/test_cleanup.c testutil/main.c testutil/testutil_init.c \
|
||||
testutil/options.c testutil/test_options.c testutil/provider.c \
|
||||
testutil/apps_shims.c testutil/random.c $LIBAPPSSRC
|
||||
testutil/apps_shims.c testutil/random.c testutil/helper.c $LIBAPPSSRC
|
||||
INCLUDE[libtestutil.a]=../include ../apps/include ..
|
||||
DEPEND[libtestutil.a]=../libcrypto
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ static int test_do_updatedb(void)
|
|||
}
|
||||
|
||||
testdate = test_get_argument(2);
|
||||
testdateutc = ossl_asn1_string_to_time_t(testdate);
|
||||
testdateutc = test_asn1_string_to_time_t(testdate);
|
||||
if (TEST_time_t_lt(testdateutc, 0)) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -648,5 +648,5 @@ X509 *load_cert_pem(const char *file, OSSL_LIB_CTX *libctx);
|
|||
X509 *load_cert_der(const unsigned char *bytes, int len);
|
||||
STACK_OF(X509) *load_certs_pem(const char *file);
|
||||
X509_REQ *load_csr_der(const char *file, OSSL_LIB_CTX *libctx);
|
||||
|
||||
time_t test_asn1_string_to_time_t(const char *asn1_string);
|
||||
#endif /* OSSL_TESTUTIL_H */
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <openssl/asn1t.h>
|
||||
#include "../testutil.h"
|
||||
|
||||
/*
|
||||
* tweak for Windows
|
||||
*/
|
||||
#ifdef WIN32
|
||||
# define timezone _timezone
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__wasi__)
|
||||
# define USE_TIMEGM
|
||||
#endif
|
||||
|
||||
time_t test_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(timestamp_asn1 == NULL)
|
||||
return -1;
|
||||
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…
Reference in New Issue