Skip to content

Commit dc9d645

Browse files
sam-githubBethGriggs
authored andcommitted
deps: upgrade openssl sources to 1.0.2s
PR-URL: #28230 Reviewed-By: Beth Griggs <[email protected]>
1 parent 3ee076f commit dc9d645

Some content is hidden

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

107 files changed

+569
-38796
lines changed

deps/openssl/openssl/CHANGES

+17
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,23 @@
77
https://github.com/openssl/openssl/commits/ and pick the appropriate
88
release branch.
99

10+
Changes between 1.0.2r and 1.0.2s [28 May 2019]
11+
12+
*) Change the default RSA, DSA and DH size to 2048 bit instead of 1024.
13+
This changes the size when using the genpkey app when no size is given. It
14+
fixes an omission in earlier changes that changed all RSA, DSA and DH
15+
generation apps to use 2048 bits by default.
16+
[Kurt Roeckx]
17+
18+
*) Add FIPS support for Android Arm 64-bit
19+
20+
Support for Android Arm 64-bit was added to the OpenSSL FIPS Object
21+
Module in Version 2.0.10. For some reason, the corresponding target
22+
'android64-aarch64' was missing OpenSSL 1.0.2, whence it could not be
23+
built with FIPS support on Android Arm 64-bit. This omission has been
24+
fixed.
25+
[Matthias St. Pierre]
26+
1027
Changes between 1.0.2q and 1.0.2r [26 Feb 2019]
1128

1229
*) 0-byte record padding oracle

deps/openssl/openssl/Configure

+1
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ my %table=(
475475
"android-x86","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:".eval{my $asm=${x86_elf_asm};$asm=~s/:elf/:android/;$asm}.":dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
476476
"android-armv7","gcc:-march=armv7-a -mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
477477
"android-mips","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${mips32_asm}:o32:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
478+
"android64-aarch64","gcc:-mandroid -fPIC -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -Wall::-D_REENTRANT::-pie%-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${aarch64_asm}:linux64:dlfcn:linux-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
478479

479480
#### *BSD [do see comment about ${BSDthreads} above!]
480481
"BSD-generic32","gcc:-O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",

deps/openssl/openssl/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
## Makefile for OpenSSL
55
##
66

7-
VERSION=1.0.2r
7+
VERSION=1.0.2s
88
MAJOR=1
99
MINOR=0.2
1010
SHLIB_VERSION_NUMBER=1.0.0
@@ -70,7 +70,7 @@ AR= ar $(ARFLAGS) r
7070
RANLIB= /usr/bin/ranlib
7171
RC= windres
7272
NM= nm
73-
PERL= /usr/bin/perl
73+
PERL= /usr/local/bin/perl
7474
TAR= tar
7575
TARFLAGS= --no-recursion
7676
MAKEDEPPROG= gcc

deps/openssl/openssl/README

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

2-
OpenSSL 1.0.2r 26 Feb 2019
2+
OpenSSL 1.0.2s 28 May 2019
33

4-
Copyright (c) 1998-2018 The OpenSSL Project
4+
Copyright (c) 1998-2019 The OpenSSL Project
55
Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
66
All rights reserved.
77

deps/openssl/openssl/apps/CA.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/perl
1+
#!/usr/local/bin/perl
22
#
33
# CA - wrapper around ca to make it easier to use ... basically ca requires
44
# some setup stuff to be done before you can use it and this makes

deps/openssl/openssl/apps/app_rand.c

+1-10
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,7 @@ int app_RAND_load_file(const char *file, BIO *bio_e, int dont_warn)
124124
char buffer[200];
125125

126126
#ifdef OPENSSL_SYS_WINDOWS
127-
/*
128-
* allocate 2 to dont_warn not to use RAND_screen() via
129-
* -no_rand_screen option in s_client
130-
*/
131-
if (dont_warn != 2) {
132-
BIO_printf(bio_e, "Loading 'screen' into random state -");
133-
BIO_flush(bio_e);
134-
RAND_screen();
135-
BIO_printf(bio_e, " done\n");
136-
}
127+
RAND_screen();
137128
#endif
138129

139130
if (file == NULL)

deps/openssl/openssl/apps/s_client.c

+8-23
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,6 @@ typedef unsigned int u_int;
180180
# include <fcntl.h>
181181
#endif
182182

183-
/* Use Windows API with STD_INPUT_HANDLE when checking for input?
184-
Don't look at OPENSSL_SYS_MSDOS for this, since it is always defined if
185-
OPENSSL_SYS_WINDOWS is defined */
186-
#if defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_WINCE) && defined(STD_INPUT_HANDLE)
187-
#define OPENSSL_USE_STD_INPUT_HANDLE
188-
#endif
189-
190183
#undef PROG
191184
#define PROG s_client_main
192185

@@ -236,7 +229,6 @@ static BIO *bio_c_msg = NULL;
236229
static int c_quiet = 0;
237230
static int c_ign_eof = 0;
238231
static int c_brief = 0;
239-
static int c_no_rand_screen = 0;
240232

241233
#ifndef OPENSSL_NO_PSK
242234
/* Default PSK identity and key */
@@ -452,10 +444,6 @@ static void sc_usage(void)
452444
" -keymatexport label - Export keying material using label\n");
453445
BIO_printf(bio_err,
454446
" -keymatexportlen len - Export len bytes of keying material (default 20)\n");
455-
#ifdef OPENSSL_SYS_WINDOWS
456-
BIO_printf(bio_err,
457-
" -no_rand_screen - Do not use RAND_screen() to initialize random state\n");
458-
#endif
459447
}
460448

461449
#ifndef OPENSSL_NO_TLSEXT
@@ -1149,10 +1137,6 @@ int MAIN(int argc, char **argv)
11491137
keymatexportlen = atoi(*(++argv));
11501138
if (keymatexportlen == 0)
11511139
goto bad;
1152-
#ifdef OPENSSL_SYS_WINDOWS
1153-
} else if (strcmp(*argv, "-no_rand_screen") == 0) {
1154-
c_no_rand_screen = 1;
1155-
#endif
11561140
} else {
11571141
BIO_printf(bio_err, "unknown option %s\n", *argv);
11581142
badop = 1;
@@ -1269,7 +1253,7 @@ int MAIN(int argc, char **argv)
12691253
if (!load_excert(&exc, bio_err))
12701254
goto end;
12711255
1272-
if (!app_RAND_load_file(NULL, bio_err, ++c_no_rand_screen) && inrand == NULL
1256+
if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL
12731257
&& !RAND_status()) {
12741258
BIO_printf(bio_err,
12751259
"warning, not much extra random data, consider using the -rand option\n");
@@ -1809,16 +1793,17 @@ int MAIN(int argc, char **argv)
18091793
tv.tv_usec = 0;
18101794
i = select(width, (void *)&readfds, (void *)&writefds,
18111795
NULL, &tv);
1812-
#if defined(OPENSSL_USE_STD_INPUT_HANDLE)
1796+
# if defined(OPENSSL_SYS_WINCE) || defined(OPENSSL_SYS_MSDOS)
1797+
if (!i && (!_kbhit() || !read_tty))
1798+
continue;
1799+
# else
18131800
if (!i && (!((_kbhit())
18141801
|| (WAIT_OBJECT_0 ==
18151802
WaitForSingleObject(GetStdHandle
18161803
(STD_INPUT_HANDLE),
18171804
0)))
18181805
|| !read_tty))
18191806
continue;
1820-
#else
1821-
if(!i && (!_kbhit() || !read_tty) ) continue;
18221807
# endif
18231808
} else
18241809
i = select(width, (void *)&readfds, (void *)&writefds,
@@ -2020,12 +2005,12 @@ int MAIN(int argc, char **argv)
20202005
}
20212006
}
20222007
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS)
2023-
#if defined(OPENSSL_USE_STD_INPUT_HANDLE)
2008+
# if defined(OPENSSL_SYS_WINCE) || defined(OPENSSL_SYS_MSDOS)
2009+
else if (_kbhit())
2010+
# else
20242011
else if ((_kbhit())
20252012
|| (WAIT_OBJECT_0 ==
20262013
WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0)))
2027-
#else
2028-
else if (_kbhit())
20292014
# endif
20302015
#elif defined (OPENSSL_SYS_NETWARE)
20312016
else if (_kbhit())

deps/openssl/openssl/config

+1
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,7 @@ case "$GUESSOS" in
871871
*-*-qnx6) OUT="QNX6" ;;
872872
x86-*-android|i?86-*-android) OUT="android-x86" ;;
873873
armv[7-9]*-*-android) OUT="android-armv7" ;;
874+
aarch64-*-android) OUT="android64-aarch64" ;;
874875
*) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;;
875876
esac
876877

deps/openssl/openssl/crypto/dh/dh_pmeth.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* 2006.
44
*/
55
/* ====================================================================
6-
* Copyright (c) 2006-2018 The OpenSSL Project. All rights reserved.
6+
* Copyright (c) 2006-2019 The OpenSSL Project. All rights reserved.
77
*
88
* Redistribution and use in source and binary forms, with or without
99
* modification, are permitted provided that the following conditions
@@ -101,7 +101,7 @@ static int pkey_dh_init(EVP_PKEY_CTX *ctx)
101101
dctx = OPENSSL_malloc(sizeof(DH_PKEY_CTX));
102102
if (!dctx)
103103
return 0;
104-
dctx->prime_len = 1024;
104+
dctx->prime_len = 2048;
105105
dctx->subprime_len = -1;
106106
dctx->generator = 2;
107107
dctx->use_dsa = 0;

deps/openssl/openssl/crypto/dsa/dsa_pmeth.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* 2006.
44
*/
55
/* ====================================================================
6-
* Copyright (c) 2006-2018 The OpenSSL Project. All rights reserved.
6+
* Copyright (c) 2006-2019 The OpenSSL Project. All rights reserved.
77
*
88
* Redistribution and use in source and binary forms, with or without
99
* modification, are permitted provided that the following conditions
@@ -69,8 +69,8 @@
6969

7070
typedef struct {
7171
/* Parameter gen parameters */
72-
int nbits; /* size of p in bits (default: 1024) */
73-
int qbits; /* size of q in bits (default: 160) */
72+
int nbits; /* size of p in bits (default: 2048) */
73+
int qbits; /* size of q in bits (default: 224) */
7474
const EVP_MD *pmd; /* MD for parameter generation */
7575
/* Keygen callback info */
7676
int gentmp[2];
@@ -84,8 +84,8 @@ static int pkey_dsa_init(EVP_PKEY_CTX *ctx)
8484
dctx = OPENSSL_malloc(sizeof(DSA_PKEY_CTX));
8585
if (!dctx)
8686
return 0;
87-
dctx->nbits = 1024;
88-
dctx->qbits = 160;
87+
dctx->nbits = 2048;
88+
dctx->qbits = 224;
8989
dctx->pmd = NULL;
9090
dctx->md = NULL;
9191

deps/openssl/openssl/crypto/ec/ec2_oct.c

+10-11
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
*/
1616
/* ====================================================================
17-
* Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved.
17+
* Copyright (c) 1998-2019 The OpenSSL Project. All rights reserved.
1818
*
1919
* Redistribution and use in source and binary forms, with or without
2020
* modification, are permitted provided that the following conditions
@@ -299,7 +299,7 @@ int ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point,
299299
BN_CTX *ctx)
300300
{
301301
point_conversion_form_t form;
302-
int y_bit;
302+
int y_bit, m;
303303
BN_CTX *new_ctx = NULL;
304304
BIGNUM *x, *y, *yxi;
305305
size_t field_len, enc_len;
@@ -332,7 +332,8 @@ int ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point,
332332
return EC_POINT_set_to_infinity(group, point);
333333
}
334334

335-
field_len = (EC_GROUP_get_degree(group) + 7) / 8;
335+
m = EC_GROUP_get_degree(group);
336+
field_len = (m + 7) / 8;
336337
enc_len =
337338
(form ==
338339
POINT_CONVERSION_COMPRESSED) ? 1 + field_len : 1 + 2 * field_len;
@@ -357,7 +358,7 @@ int ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point,
357358

358359
if (!BN_bin2bn(buf + 1, field_len, x))
359360
goto err;
360-
if (BN_ucmp(x, &group->field) >= 0) {
361+
if (BN_num_bits(x) > m) {
361362
ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
362363
goto err;
363364
}
@@ -369,7 +370,7 @@ int ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point,
369370
} else {
370371
if (!BN_bin2bn(buf + 1 + field_len, field_len, y))
371372
goto err;
372-
if (BN_ucmp(y, &group->field) >= 0) {
373+
if (BN_num_bits(y) > m) {
373374
ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
374375
goto err;
375376
}
@@ -382,16 +383,14 @@ int ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point,
382383
}
383384
}
384385

386+
/*
387+
* EC_POINT_set_affine_coordinates_GF2m is responsible for checking that
388+
* the point is on the curve.
389+
*/
385390
if (!EC_POINT_set_affine_coordinates_GF2m(group, point, x, y, ctx))
386391
goto err;
387392
}
388393

389-
/* test required by X9.62 */
390-
if (EC_POINT_is_on_curve(group, point, ctx) <= 0) {
391-
ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_POINT_IS_NOT_ON_CURVE);
392-
goto err;
393-
}
394-
395394
ret = 1;
396395

397396
err:

deps/openssl/openssl/crypto/ec/ec_lib.c

+19-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Originally written by Bodo Moeller for the OpenSSL project.
44
*/
55
/* ====================================================================
6-
* Copyright (c) 1998-2018 The OpenSSL Project. All rights reserved.
6+
* Copyright (c) 1998-2019 The OpenSSL Project. All rights reserved.
77
*
88
* Redistribution and use in source and binary forms, with or without
99
* modification, are permitted provided that the following conditions
@@ -872,7 +872,15 @@ int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group,
872872
EC_R_INCOMPATIBLE_OBJECTS);
873873
return 0;
874874
}
875-
return group->meth->point_set_affine_coordinates(group, point, x, y, ctx);
875+
if (!group->meth->point_set_affine_coordinates(group, point, x, y, ctx))
876+
return 0;
877+
878+
if (EC_POINT_is_on_curve(group, point, ctx) <= 0) {
879+
ECerr(EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP,
880+
EC_R_POINT_IS_NOT_ON_CURVE);
881+
return 0;
882+
}
883+
return 1;
876884
}
877885

878886
#ifndef OPENSSL_NO_EC2M
@@ -890,7 +898,15 @@ int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group,
890898
EC_R_INCOMPATIBLE_OBJECTS);
891899
return 0;
892900
}
893-
return group->meth->point_set_affine_coordinates(group, point, x, y, ctx);
901+
if (!group->meth->point_set_affine_coordinates(group, point, x, y, ctx))
902+
return 0;
903+
904+
if (EC_POINT_is_on_curve(group, point, ctx) <= 0) {
905+
ECerr(EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M,
906+
EC_R_POINT_IS_NOT_ON_CURVE);
907+
return 0;
908+
}
909+
return 1;
894910
}
895911
#endif
896912

deps/openssl/openssl/crypto/ec/ec_mult.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Originally written by Bodo Moeller and Nils Larsch for the OpenSSL project.
44
*/
55
/* ====================================================================
6-
* Copyright (c) 1998-2018 The OpenSSL Project. All rights reserved.
6+
* Copyright (c) 1998-2019 The OpenSSL Project. All rights reserved.
77
*
88
* Redistribution and use in source and binary forms, with or without
99
* modification, are permitted provided that the following conditions
@@ -519,7 +519,7 @@ static int ec_mul_consttime(const EC_GROUP *group, EC_POINT *r,
519519
ret = 1;
520520

521521
err:
522-
EC_POINT_free(s);
522+
EC_POINT_clear_free(s);
523523
BN_CTX_end(ctx);
524524
BN_CTX_free(new_ctx);
525525

deps/openssl/openssl/crypto/ec/ecp_nistp521.c

+8-3
Original file line numberDiff line numberDiff line change
@@ -356,10 +356,15 @@ static void felem_diff64(felem out, const felem in)
356356
static void felem_diff_128_64(largefelem out, const felem in)
357357
{
358358
/*
359-
* In order to prevent underflow, we add 0 mod p before subtracting.
359+
* In order to prevent underflow, we add 64p mod p (which is equivalent
360+
* to 0 mod p) before subtracting. p is 2^521 - 1, i.e. in binary a 521
361+
* digit number with all bits set to 1. See "The representation of field
362+
* elements" comment above for a description of how limbs are used to
363+
* represent a number. 64p is represented with 8 limbs containing a number
364+
* with 58 bits set and one limb with a number with 57 bits set.
360365
*/
361-
static const limb two63m6 = (((limb) 1) << 62) - (((limb) 1) << 5);
362-
static const limb two63m5 = (((limb) 1) << 62) - (((limb) 1) << 4);
366+
static const limb two63m6 = (((limb) 1) << 63) - (((limb) 1) << 6);
367+
static const limb two63m5 = (((limb) 1) << 63) - (((limb) 1) << 5);
363368

364369
out[0] += two63m6 - in[0];
365370
out[1] += two63m5 - in[1];

0 commit comments

Comments
 (0)