Skip to content

Commit

Permalink
Merge commit '047ff6428714afed823815e53c26ffc3e9bf8cd3' into new-upst…
Browse files Browse the repository at this point in the history
…ream-merge-20210823
  • Loading branch information
samuel40791765 committed Aug 23, 2021
2 parents 52a75e6 + 047ff64 commit 0eb50ba
Show file tree
Hide file tree
Showing 128 changed files with 1,833 additions and 1,116 deletions.
6 changes: 4 additions & 2 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ most recent stable version of each tool.
`CMAKE_ASM_NASM_COMPILER`.

* C and C++ compilers with C++11 support are required. On Windows, MSVC 14
(Visual Studio 2015) or later with Platform SDK 8.1 or later are supported.
Recent versions of GCC (4.8+) and Clang should work on non-Windows
(Visual Studio 2015) or later with Platform SDK 8.1 or later are supported,
but newer versions are recommended. We will drop support for Visual Studio
2015 in March 2022, five years after the release of Visual Studio 2017.
Recent versions of GCC (6.1+) and Clang should work on non-Windows
platforms, and maybe on Windows too.

* On x86_64 Linux, the tests have an optional
Expand Down
19 changes: 9 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,7 @@ endif()

function(go_executable dest package)
set(godeps "${CMAKE_SOURCE_DIR}/util/godeps.go")
if(${CMAKE_VERSION} VERSION_LESS "3.7" OR
NOT "${CMAKE_GENERATOR}" STREQUAL "Ninja")
if(CMAKE_VERSION VERSION_LESS "3.7" OR NOT CMAKE_GENERATOR STREQUAL "Ninja")
# The DEPFILE parameter to add_custom_command is new as of CMake 3.7 and
# only works with Ninja. Query the sources at configure time. Additionally,
# everything depends on go.mod. That affects what external packages to use.
Expand Down Expand Up @@ -568,7 +567,7 @@ endfunction()
# builds.
if(NOT OPENSSL_NO_ASM AND CMAKE_OSX_ARCHITECTURES)
list(LENGTH CMAKE_OSX_ARCHITECTURES NUM_ARCHES)
if(NOT ${NUM_ARCHES} EQUAL 1)
if(NOT NUM_ARCHES EQUAL 1)
message(FATAL_ERROR "Universal binaries not supported.")
endif()
list(GET CMAKE_OSX_ARCHITECTURES 0 CMAKE_SYSTEM_PROCESSOR)
Expand All @@ -585,7 +584,7 @@ endif()
if(OPENSSL_NO_ASM)
add_definitions(-DOPENSSL_NO_ASM)
set(ARCH "generic")
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|amd64|AMD64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64")
# If ARCH is originally detected as 64-bit, perform an additional check
# to determine whether to build as 32-bit or 64-bit. This happens in some
# cases such as when building in Docker, where the host-level architecture is 64-bit
Expand All @@ -595,16 +594,16 @@ elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|amd64|AMD64")
else()
set(ARCH "x86")
endif()
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86|i386|i686")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86|i386|i686")
set(ARCH "x86")
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm64.*|ARM64|aarch64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm64.*|ARM64|aarch64")
set(ARCH "aarch64")
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^arm*")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm*")
set(ARCH "arm")
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "mips")
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "mips")
# Just to avoid the “unknown processor” error.
set(ARCH "generic")
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "ppc64le")
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64le")
set(ARCH "ppc64le")
else()
message(FATAL_ERROR "Unknown processor:" ${CMAKE_SYSTEM_PROCESSOR})
Expand All @@ -615,7 +614,7 @@ if (ARCH STREQUAL "aarch64" AND CMAKE_BUILD_TYPE_LOWER MATCHES "rel")
add_definitions(-DOPENSSL_AARCH64_P256)
endif()

if(ANDROID AND NOT ANDROID_NDK_REVISION AND ${ARCH} STREQUAL "arm")
if(ANDROID AND NOT ANDROID_NDK_REVISION AND ARCH STREQUAL "arm")
# The third-party Android-NDK CMake files somehow fail to set the -march flag
# for assembly files. Without this flag, the compiler believes that it's
# building for ARMv5.
Expand Down
27 changes: 14 additions & 13 deletions crypto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ include_directories(../include)

if(NOT OPENSSL_NO_ASM)
if(UNIX)
if(${ARCH} STREQUAL "aarch64")
if(ARCH STREQUAL "aarch64")
# The "armx" Perl scripts look for "64" in the style argument
# in order to decide whether to generate 32- or 64-bit asm.
if(APPLE)
set(PERLASM_STYLE ios64)
else()
set(PERLASM_STYLE linux64)
endif()
elseif(${ARCH} STREQUAL "arm")
elseif(ARCH STREQUAL "arm")
if(APPLE)
set(PERLASM_STYLE ios32)
else()
set(PERLASM_STYLE linux32)
endif()
elseif(${ARCH} STREQUAL "ppc64le")
elseif(ARCH STREQUAL "ppc64le")
set(PERLASM_STYLE linux64le)
else()
if(${ARCH} STREQUAL "x86")
if(ARCH STREQUAL "x86")
set(PERLASM_FLAGS "-fPIC -DOPENSSL_IA32_SSE2")
endif()
if(APPLE)
Expand Down Expand Up @@ -47,12 +47,12 @@ if(NOT OPENSSL_NO_ASM)
endforeach()
endif()
else()
if(${ARCH} STREQUAL "aarch64")
if(ARCH STREQUAL "aarch64")
set(PERLASM_STYLE win64)
set(ASM_EXT S)
enable_language(ASM)
else()
if(${ARCH} STREQUAL "x86_64")
if(ARCH STREQUAL "x86_64")
set(PERLASM_STYLE nasm)
else()
set(PERLASM_STYLE win32n)
Expand All @@ -70,7 +70,7 @@ endif()
if(PERL_EXECUTABLE)
function(perlasm dest src)
get_filename_component(dir ${dest} DIRECTORY)
if ("${dir}" STREQUAL "")
if (dir STREQUAL "")
set(dir ".")
endif()

Expand Down Expand Up @@ -139,7 +139,7 @@ if(FIPS_DELOCATE OR FIPS_SHARED)
)
endif()

if(${ARCH} STREQUAL "arm")
if(ARCH STREQUAL "arm")
set(
CRYPTO_ARCH_SOURCES

Expand All @@ -150,7 +150,7 @@ if(${ARCH} STREQUAL "arm")
)
endif()

if(${ARCH} STREQUAL "aarch64")
if(ARCH STREQUAL "aarch64")
set(
CRYPTO_ARCH_SOURCES

Expand All @@ -160,15 +160,15 @@ if(${ARCH} STREQUAL "aarch64")
)
endif()

if(${ARCH} STREQUAL "ppc64le")
if(ARCH STREQUAL "ppc64le")
set(
CRYPTO_ARCH_SOURCES

test/trampoline-ppc.${ASM_EXT}
)
endif()

if(${ARCH} STREQUAL "x86")
if(ARCH STREQUAL "x86")
set(
CRYPTO_ARCH_SOURCES

Expand All @@ -177,7 +177,7 @@ if(${ARCH} STREQUAL "x86")
)
endif()

if(${ARCH} STREQUAL "x86_64")
if(ARCH STREQUAL "x86_64")
set(
CRYPTO_ARCH_SOURCES

Expand Down Expand Up @@ -239,6 +239,7 @@ add_library(
asn1/a_object.c
asn1/a_octet.c
asn1/a_print.c
asn1/a_strex.c
asn1/a_strnid.c
asn1/a_time.c
asn1/a_type.c
Expand Down Expand Up @@ -379,13 +380,13 @@ add_library(
trust_token/voprf.c
x509/a_digest.c
x509/a_sign.c
x509/a_strex.c
x509/a_verify.c
x509/algorithm.c
x509/asn1_gen.c
x509/by_dir.c
x509/by_file.c
x509/i2d_pr.c
x509/name_print.c
x509/rsa_pss.c
x509/t_crl.c
x509/t_req.c
Expand Down
2 changes: 0 additions & 2 deletions crypto/asn1/a_d2i_fp.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x)
return ret;
}

#ifndef OPENSSL_NO_FP_API
void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x)
{
BIO *b = BIO_new_fp(in, BIO_NOCLOSE);
Expand All @@ -90,4 +89,3 @@ void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x)
BIO_free(b);
return ret;
}
#endif
5 changes: 5 additions & 0 deletions crypto/asn1/a_gentm.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,11 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,
goto err;
}

if (ts->tm_year < 0 - 1900 || ts->tm_year > 9999 - 1900) {
OPENSSL_PUT_ERROR(ASN1, ASN1_R_ILLEGAL_TIME_VALUE);
goto err;
}

p = (char *)tmps->data;
if ((p == NULL) || ((size_t)tmps->length < len)) {
p = OPENSSL_malloc(len);
Expand Down
5 changes: 4 additions & 1 deletion crypto/asn1/a_mbstr.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,14 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
encode_func = cbb_add_utf32_be;
size_estimate = 4 * nchar;
outform = MBSTRING_UNIV;
} else {
} else if (mask & B_ASN1_UTF8STRING) {
str_type = V_ASN1_UTF8STRING;
outform = MBSTRING_UTF8;
encode_func = cbb_add_utf8;
size_estimate = utf8_len;
} else {
OPENSSL_PUT_ERROR(ASN1, ASN1_R_ILLEGAL_CHARACTERS);
return -1;
}

if (!out)
Expand Down
Loading

0 comments on commit 0eb50ba

Please sign in to comment.