Skip to content

Commit 3e9bd97

Browse files
committed
Update to LibreSSL 3.0.2 version
1 parent 91d31d5 commit 3e9bd97

File tree

434 files changed

+15946
-3307
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

434 files changed

+15946
-3307
lines changed

CMakeLists.txt

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ if(WIN32)
107107
add_definitions(-D_CRT_DEPRECATED_NO_WARNINGS)
108108
add_definitions(-D_REENTRANT -D_POSIX_THREAD_SAFE_FUNCTIONS)
109109
add_definitions(-DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0600)
110-
add_definitions(-DCPPFLAGS -DOPENSSL_NO_SPEED -DNO_SYSLOG -DNO_CRYPT)
110+
add_definitions(-DCPPFLAGS -DNO_SYSLOG -DNO_CRYPT)
111111
set(PLATFORM_LIBS ${PLATFORM_LIBS} ws2_32)
112112
endif()
113113

@@ -289,10 +289,7 @@ if(ENABLE_ASM)
289289
endif()
290290
elseif(APPLE AND "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
291291
set(HOST_ASM_MACOSX_X86_64 true)
292-
elseif(MSVC AND "${CMAKE_GENERATOR}" MATCHES "Win64" AND FALSE)
293-
# XXX Disabled for now, CMake's MASM support seems to either never
294-
# build supply ASM or build it with the C compiler in a mode where it
295-
# does not parse correctly. It might be easier to get NASM support working.
292+
elseif(MSVC AND "${CMAKE_GENERATOR}" MATCHES "Win64")
296293
set(HOST_ASM_MASM_X86_64 true)
297294
ENABLE_LANGUAGE(ASM_MASM)
298295
elseif(CMAKE_SYSTEM_NAME MATCHES "MINGW" AND "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
@@ -346,7 +343,9 @@ if(NOT MSVC)
346343
set(exec_prefix \${prefix})
347344
set(libdir \${exec_prefix}/${CMAKE_INSTALL_LIBDIR})
348345
set(includedir \${prefix}/include)
349-
string(REGEX REPLACE ";" " -l" PLATFORM_LDADD ";${PLATFORM_LIBS}")
346+
if(PLATFORM_LIBS)
347+
string(REGEX REPLACE ";" " -l" PLATFORM_LDADD ";${PLATFORM_LIBS}")
348+
endif()
350349
file(STRINGS "VERSION" VERSION LIMIT_COUNT 1)
351350
file(GLOB OPENSSL_PKGCONFIGS "*.pc.in")
352351
foreach(file ${OPENSSL_PKGCONFIGS})
@@ -358,10 +357,12 @@ if(NOT MSVC)
358357
DESTINATION ${CMAKE_INSTALL_LIBDIR})
359358
endif()
360359

361-
configure_file(
362-
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
363-
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
364-
IMMEDIATE @ONLY)
360+
if(NOT TARGET uninstall)
361+
configure_file(
362+
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
363+
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
364+
IMMEDIATE @ONLY)
365365

366-
add_custom_target(uninstall
367-
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
366+
add_custom_target(uninstall
367+
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
368+
endif()

ChangeLog

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,61 @@ history is also available from Git.
2828

2929
LibreSSL Portable Release Notes:
3030

31+
3.0.2 - Stable release
32+
33+
* Use a valid curve when constructing an EC_KEY that looks like X25519.
34+
The recent EC group cofactor change results in stricter validation,
35+
which causes the EC_GROUP_set_generator() call to fail.
36+
Issue reported and fix tested by rsadowski@
37+
38+
* Fixed a padding oracle in PKCS7_dataDecode and CMS_decrypt_set1_pkey.
39+
(Note that the CMS code is currently disabled)
40+
Port of Edlinger's Fix for CVE-2019-1563 from OpenSSL 1.1.1 (old license)
41+
42+
* Avoid a path traversal bug in s_server on Windows when run with the -WWW
43+
or -HTTP options, due to incomplete path check logic.
44+
Issue reported and fix tested by Jobert Abma
45+
46+
3.0.1 - Development release
47+
48+
* Ported Billy Brumley's fix for CVE-2019-1547 in OpenSSL 1.1.1. If a NULL
49+
or zero cofactor is passed to EC_GROUP_set_generator(), try to compute
50+
it using Hasse's bound. This works as long as the cofactor is small
51+
enough.
52+
53+
* Fixed a memory leak in error paths for eckey_type2param().
54+
55+
* Initial work on supporting Cryptographic Message Syntax (CMS) in
56+
libcrypto (not enabled).
57+
58+
* Various manual page improvements and additions.
59+
60+
* Added a CMake check for an existing uninstall target, facilitating
61+
embedding LibreSSL in larger CMake projects, from Matthew Albrecht.
62+
63+
3.0.0 - Development release
64+
65+
* Completed the port of RSA_METHOD accessors from the OpenSSL 1.1 API.
66+
67+
* Documented undescribed options and removed unfunctional options
68+
description in openssl(1) manual.
69+
70+
* A plethora of small fixes due to regular oss-fuzz testing.
71+
72+
* Various side channels in DSA and ECDSA were addressed. These are some of
73+
the many issues found in an extensive systematic analysis of bignum usage
74+
by Samuel Weiser, David Schrammel et al.
75+
76+
* Enabled openssl(1) speed subcommand on Windows platform.
77+
78+
* Enabled performance optimizations when building with Visual Studio on Windows.
79+
80+
* Fixed incorrect carry operation in 512 addition for Streebog.
81+
82+
* Fixed -modulus option with openssl(1) dsa subcommand.
83+
84+
* Fixed PVK format output issue with openssl(1) dsa and rsa subcommand.
85+
3186
2.9.2 - Bug fixes
3287

3388
* Fixed portable builds with older versions of MacOS,

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
2.9.2.1
1+
3.0.2.0
22

apps/nc/netcat.c

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: netcat.c,v 1.203 2019/02/26 17:32:47 jsing Exp $ */
1+
/* $OpenBSD: netcat.c,v 1.206 2019/08/08 16:49:35 mestre Exp $ */
22
/*
33
* Copyright (c) 2001 Eric Jackson <[email protected]>
44
* Copyright (c) 2015 Bob Beck. All rights reserved.
@@ -393,6 +393,7 @@ main(int argc, char *argv[])
393393
err(1, "unveil");
394394
}
395395
} else {
396+
/* no filesystem visibility */
396397
if (unveil("/", "") == -1)
397398
err(1, "unveil");
398399
}
@@ -578,7 +579,7 @@ main(int argc, char *argv[])
578579
close(s);
579580
s = local_listen(host, uport, hints);
580581
}
581-
if (s < 0)
582+
if (s == -1)
582583
err(1, NULL);
583584
if (uflag && kflag) {
584585
/*
@@ -600,11 +601,11 @@ main(int argc, char *argv[])
600601
len = sizeof(z);
601602
rv = recvfrom(s, buf, sizeof(buf), MSG_PEEK,
602603
(struct sockaddr *)&z, &len);
603-
if (rv < 0)
604+
if (rv == -1)
604605
err(1, "recvfrom");
605606

606607
rv = connect(s, (struct sockaddr *)&z, len);
607-
if (rv < 0)
608+
if (rv == -1)
608609
err(1, "connect");
609610

610611
if (vflag)
@@ -638,7 +639,7 @@ main(int argc, char *argv[])
638639
tls_free(tls_cctx);
639640
}
640641
if (family == AF_UNIX && uflag) {
641-
if (connect(s, NULL, 0) < 0)
642+
if (connect(s, NULL, 0) == -1)
642643
err(1, "connect");
643644
}
644645

@@ -749,7 +750,7 @@ unix_bind(char *path, int flags)
749750

750751
/* Create unix domain socket. */
751752
if ((s = socket(AF_UNIX, flags | (uflag ? SOCK_DGRAM : SOCK_STREAM),
752-
0)) < 0)
753+
0)) == -1)
753754
return -1;
754755

755756
memset(&s_un, 0, sizeof(struct sockaddr_un));
@@ -762,7 +763,7 @@ unix_bind(char *path, int flags)
762763
return -1;
763764
}
764765

765-
if (bind(s, (struct sockaddr *)&s_un, sizeof(s_un)) < 0) {
766+
if (bind(s, (struct sockaddr *)&s_un, sizeof(s_un)) == -1) {
766767
save_errno = errno;
767768
close(s);
768769
errno = save_errno;
@@ -872,10 +873,10 @@ unix_connect(char *path)
872873
int s, save_errno;
873874

874875
if (uflag) {
875-
if ((s = unix_bind(unix_dg_tmp_socket, SOCK_CLOEXEC)) < 0)
876+
if ((s = unix_bind(unix_dg_tmp_socket, SOCK_CLOEXEC)) == -1)
876877
return -1;
877878
} else {
878-
if ((s = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0)) < 0)
879+
if ((s = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0)) == -1)
879880
return -1;
880881
}
881882

@@ -888,7 +889,7 @@ unix_connect(char *path)
888889
errno = ENAMETOOLONG;
889890
return -1;
890891
}
891-
if (connect(s, (struct sockaddr *)&s_un, sizeof(s_un)) < 0) {
892+
if (connect(s, (struct sockaddr *)&s_un, sizeof(s_un)) == -1) {
892893
save_errno = errno;
893894
close(s);
894895
errno = save_errno;
@@ -907,9 +908,9 @@ unix_listen(char *path)
907908
{
908909
int s;
909910

910-
if ((s = unix_bind(path, 0)) < 0)
911+
if ((s = unix_bind(path, 0)) == -1)
911912
return -1;
912-
if (listen(s, 5) < 0) {
913+
if (listen(s, 5) == -1) {
913914
close(s);
914915
return -1;
915916
}
@@ -939,7 +940,7 @@ remote_connect(const char *host, const char *port, struct addrinfo hints)
939940

940941
for (res = res0; res; res = res->ai_next) {
941942
if ((s = socket(res->ai_family, res->ai_socktype |
942-
SOCK_NONBLOCK, res->ai_protocol)) < 0)
943+
SOCK_NONBLOCK, res->ai_protocol)) == -1)
943944
continue;
944945

945946
/* Bind to a local port or source address if specified. */
@@ -959,7 +960,7 @@ remote_connect(const char *host, const char *port, struct addrinfo hints)
959960
errx(1, "getaddrinfo: %s", gai_strerror(error));
960961

961962
if (bind(s, (struct sockaddr *)ares->ai_addr,
962-
ares->ai_addrlen) < 0)
963+
ares->ai_addrlen) == -1)
963964
err(1, "bind failed");
964965
freeaddrinfo(ares);
965966
}
@@ -1041,7 +1042,7 @@ local_listen(const char *host, const char *port, struct addrinfo hints)
10411042

10421043
for (res = res0; res; res = res->ai_next) {
10431044
if ((s = socket(res->ai_family, res->ai_socktype,
1044-
res->ai_protocol)) < 0)
1045+
res->ai_protocol)) == -1)
10451046
continue;
10461047

10471048
#ifdef SO_REUSEPORT
@@ -1063,7 +1064,7 @@ local_listen(const char *host, const char *port, struct addrinfo hints)
10631064
}
10641065

10651066
if (!uflag && s != -1) {
1066-
if (listen(s, 1) < 0)
1067+
if (listen(s, 1) == -1)
10671068
err(1, "listen");
10681069
}
10691070
if (vflag && s != -1) {
@@ -1473,12 +1474,12 @@ build_ports(char *p)
14731474
for (x = 0; x <= hi - lo; x++) {
14741475
cp = arc4random_uniform(x + 1);
14751476
portlist[x] = portlist[cp];
1476-
if (asprintf(&portlist[cp], "%d", x + lo) < 0)
1477+
if (asprintf(&portlist[cp], "%d", x + lo) == -1)
14771478
err(1, "asprintf");
14781479
}
14791480
} else { /* Load ports sequentially. */
14801481
for (cp = lo; cp <= hi; cp++) {
1481-
if (asprintf(&portlist[x], "%d", cp) < 0)
1482+
if (asprintf(&portlist[x], "%d", cp) == -1)
14821483
err(1, "asprintf");
14831484
x++;
14841485
}

apps/nc/socks.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: socks.c,v 1.27 2019/01/10 12:44:54 mestre Exp $ */
1+
/* $OpenBSD: socks.c,v 1.29 2019/07/29 15:19:03 benno Exp $ */
22

33
/*
44
* Copyright (c) 1999 Niklas Hallqvist. All rights reserved.
@@ -334,7 +334,7 @@ socks_connect(const char *host, const char *port,
334334
"CONNECT %s:%d HTTP/1.0\r\n",
335335
host, ntohs(serverport));
336336
}
337-
if (r == -1 || (size_t)r >= sizeof(buf))
337+
if (r < 0 || (size_t)r >= sizeof(buf))
338338
errx(1, "hostname too long");
339339
r = strlen(buf);
340340

@@ -357,7 +357,7 @@ socks_connect(const char *host, const char *port,
357357
errx(1, "Proxy username/password too long");
358358
r = snprintf(buf, sizeof(buf), "Proxy-Authorization: "
359359
"Basic %s\r\n", resp);
360-
if (r == -1 || (size_t)r >= sizeof(buf))
360+
if (r < 0 || (size_t)r >= sizeof(buf))
361361
errx(1, "Proxy auth response too long");
362362
r = strlen(buf);
363363
if ((cnt = atomicio(vwrite, proxyfd, buf, r)) != r)
@@ -373,7 +373,8 @@ socks_connect(const char *host, const char *port,
373373
/* Read status reply */
374374
proxy_read_line(proxyfd, buf, sizeof(buf));
375375
if (proxyuser != NULL &&
376-
strncmp(buf, "HTTP/1.0 407 ", 12) == 0) {
376+
(strncmp(buf, "HTTP/1.0 407 ", 12) == 0 ||
377+
strncmp(buf, "HTTP/1.1 407 ", 12) == 0)) {
377378
if (authretry > 1) {
378379
fprintf(stderr, "Proxy authentication "
379380
"failed\n");

apps/ocspcheck/http.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Id: http.c,v 1.11 2018/11/29 14:25:07 tedu Exp $ */
1+
/* $Id: http.c,v 1.12 2019/06/28 13:32:49 deraadt Exp $ */
22
/*
33
* Copyright (c) 2016 Kristaps Dzonsons <[email protected]>
44
*
@@ -72,7 +72,7 @@ dosysread(char *buf, size_t sz, const struct http *http)
7272
ssize_t rc;
7373

7474
rc = read(http->fd, buf, sz);
75-
if (rc < 0)
75+
if (rc == -1)
7676
warn("%s: read", http->src.ip);
7777
return rc;
7878
}
@@ -83,7 +83,7 @@ dosyswrite(const void *buf, size_t sz, const struct http *http)
8383
ssize_t rc;
8484

8585
rc = write(http->fd, buf, sz);
86-
if (rc < 0)
86+
if (rc == -1)
8787
warn("%s: write", http->src.ip);
8888
return rc;
8989
}
@@ -97,7 +97,7 @@ dotlsread(char *buf, size_t sz, const struct http *http)
9797
rc = tls_read(http->ctx, buf, sz);
9898
} while (rc == TLS_WANT_POLLIN || rc == TLS_WANT_POLLOUT);
9999

100-
if (rc < 0)
100+
if (rc == -1)
101101
warnx("%s: tls_read: %s", http->src.ip,
102102
tls_error(http->ctx));
103103
return rc;
@@ -112,7 +112,7 @@ dotlswrite(const void *buf, size_t sz, const struct http *http)
112112
rc = tls_write(http->ctx, buf, sz);
113113
} while (rc == TLS_WANT_POLLIN || rc == TLS_WANT_POLLOUT);
114114

115-
if (rc < 0)
115+
if (rc == -1)
116116
warnx("%s: tls_write: %s", http->src.ip,
117117
tls_error(http->ctx));
118118
return rc;

apps/ocspcheck/ocspcheck.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: ocspcheck.c,v 1.24 2017/12/01 14:42:23 visa Exp $ */
1+
/* $OpenBSD: ocspcheck.c,v 1.25 2019/05/15 13:44:18 bcook Exp $ */
22

33
/*
44
* Copyright (c) 2017 Bob Beck <[email protected]>
@@ -670,7 +670,9 @@ main(int argc, char **argv)
670670
* write out the DER format response to the staplefd
671671
*/
672672
if (staplefd >= 0) {
673-
(void) ftruncate(staplefd, 0);
673+
while (ftruncate(staplefd, 0) < 0)
674+
if (errno != EINTR && errno != EAGAIN)
675+
err(1, "Write of OCSP response failed");
674676
w = 0;
675677
written = 0;
676678
while (written < instaplesz) {

0 commit comments

Comments
 (0)