Browse Source

deps: upgrade openssl sources to 1.0.2l

This replaces all sources of openssl-1.0.2l.tar.gz into
deps/openssl/openssl

Fixes: https://github.com/nodejs/node/issues/13161
PR-URL: https://github.com/nodejs/node/pull/13233
Reviewed-By: Shigeki Ohtsu <ohtsu@ohtsu.org>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
v6
Daniel Bevenius 8 years ago
committed by Shigeki Ohtsu
parent
commit
bd4a53493b
  1. 6
      deps/openssl/openssl/CHANGES
  2. 19
      deps/openssl/openssl/Configure
  3. 4
      deps/openssl/openssl/LICENSE
  4. 10
      deps/openssl/openssl/Makefile
  5. 10
      deps/openssl/openssl/Makefile.bak
  6. 8
      deps/openssl/openssl/Makefile.org
  7. 4
      deps/openssl/openssl/NEWS
  8. 2
      deps/openssl/openssl/README
  9. 11
      deps/openssl/openssl/apps/app_rand.c
  10. 19
      deps/openssl/openssl/apps/ca.c
  11. 24
      deps/openssl/openssl/apps/dhparam.c
  12. 33
      deps/openssl/openssl/apps/enc.c
  13. 9
      deps/openssl/openssl/apps/engine.c
  14. 4
      deps/openssl/openssl/apps/pkeyutl.c
  15. 3
      deps/openssl/openssl/apps/prime.c
  16. 2
      deps/openssl/openssl/apps/progs.h
  17. 30
      deps/openssl/openssl/apps/progs.pl
  18. 6
      deps/openssl/openssl/apps/req.c
  19. 32
      deps/openssl/openssl/apps/s_client.c
  20. 1
      deps/openssl/openssl/apps/s_server.c
  21. 4
      deps/openssl/openssl/apps/srp.c
  22. 8
      deps/openssl/openssl/appveyor.yml
  23. 9
      deps/openssl/openssl/config
  24. 2
      deps/openssl/openssl/crypto/aes/Makefile
  25. 1
      deps/openssl/openssl/crypto/aes/asm/aesni-sha1-x86_64.pl
  26. 1
      deps/openssl/openssl/crypto/aes/asm/aesni-sha256-x86_64.pl
  27. 2
      deps/openssl/openssl/crypto/aes/asm/bsaes-armv7.pl
  28. 7
      deps/openssl/openssl/crypto/asn1/a_bitstr.c
  29. 8
      deps/openssl/openssl/crypto/asn1/a_digest.c
  30. 2
      deps/openssl/openssl/crypto/asn1/a_gentm.c
  31. 3
      deps/openssl/openssl/crypto/asn1/a_strnid.c
  32. 26
      deps/openssl/openssl/crypto/asn1/a_time.c
  33. 2
      deps/openssl/openssl/crypto/asn1/a_utctm.c
  34. 2
      deps/openssl/openssl/crypto/asn1/f_enum.c
  35. 2
      deps/openssl/openssl/crypto/asn1/f_int.c
  36. 1
      deps/openssl/openssl/crypto/asn1/tasn_dec.c
  37. 11
      deps/openssl/openssl/crypto/asn1/tasn_new.c
  38. 38
      deps/openssl/openssl/crypto/asn1/x_long.c
  39. 35
      deps/openssl/openssl/crypto/asn1/x_name.c
  40. 2
      deps/openssl/openssl/crypto/bio/b_print.c
  41. 3
      deps/openssl/openssl/crypto/bio/bio_cb.c
  42. 20
      deps/openssl/openssl/crypto/bio/bss_file.c
  43. 2
      deps/openssl/openssl/crypto/bn/Makefile
  44. 29
      deps/openssl/openssl/crypto/bn/asm/sparcv9-mont.pl
  45. 24
      deps/openssl/openssl/crypto/bn/bn_prime.c
  46. 514
      deps/openssl/openssl/crypto/bn/bn_prime.h
  47. 28
      deps/openssl/openssl/crypto/bn/bn_prime.pl
  48. 2
      deps/openssl/openssl/crypto/bn/bn_print.c
  49. 25
      deps/openssl/openssl/crypto/comp/c_rle.c
  50. 1
      deps/openssl/openssl/crypto/conf/conf.h
  51. 16
      deps/openssl/openssl/crypto/conf/conf_def.c
  52. 2
      deps/openssl/openssl/crypto/conf/conf_err.c
  53. 2
      deps/openssl/openssl/crypto/des/Makefile
  54. 2
      deps/openssl/openssl/crypto/des/set_key.c
  55. 29
      deps/openssl/openssl/crypto/dh/dh.h
  56. 4
      deps/openssl/openssl/crypto/ec/ec_ameth.c
  57. 11
      deps/openssl/openssl/crypto/ec/ec_asn1.c
  58. 12
      deps/openssl/openssl/crypto/ec/ec_mult.c
  59. 2
      deps/openssl/openssl/crypto/ec/eck_prn.c
  60. 5
      deps/openssl/openssl/crypto/engine/eng_cryptodev.c
  61. 1
      deps/openssl/openssl/crypto/err/err.c
  62. 1
      deps/openssl/openssl/crypto/err/err.h
  63. 9
      deps/openssl/openssl/crypto/evp/e_aes.c
  64. 2
      deps/openssl/openssl/crypto/evp/e_aes_cbc_hmac_sha1.c
  65. 6
      deps/openssl/openssl/crypto/evp/e_aes_cbc_hmac_sha256.c
  66. 2
      deps/openssl/openssl/crypto/evp/e_des3.c
  67. 9
      deps/openssl/openssl/crypto/evp/evp_enc.c
  68. 2
      deps/openssl/openssl/crypto/evp/pmeth_lib.c
  69. 41
      deps/openssl/openssl/crypto/ex_data.c
  70. 11
      deps/openssl/openssl/crypto/hmac/hm_pmeth.c
  71. 28
      deps/openssl/openssl/crypto/include/internal/bn_conf.h
  72. 16
      deps/openssl/openssl/crypto/include/internal/dso_conf.h
  73. 2
      deps/openssl/openssl/crypto/md5/Makefile
  74. 4
      deps/openssl/openssl/crypto/mem.c
  75. 2
      deps/openssl/openssl/crypto/modes/Makefile
  76. 3
      deps/openssl/openssl/crypto/o_dir.c
  77. 7
      deps/openssl/openssl/crypto/o_time.c
  78. 266
      deps/openssl/openssl/crypto/opensslconf.h
  79. 6
      deps/openssl/openssl/crypto/opensslv.h
  80. 4
      deps/openssl/openssl/crypto/perlasm/x86_64-xlate.pl
  81. 14
      deps/openssl/openssl/crypto/perlasm/x86masm.pl
  82. 5
      deps/openssl/openssl/crypto/pkcs12/p12_mutl.c
  83. 24
      deps/openssl/openssl/crypto/ppccap.c
  84. 72
      deps/openssl/openssl/crypto/rand/md_rand.c
  85. 2
      deps/openssl/openssl/crypto/rc4/Makefile
  86. 9
      deps/openssl/openssl/crypto/rsa/rsa_pmeth.c
  87. 13
      deps/openssl/openssl/crypto/rsa/rsa_pss.c
  88. 2
      deps/openssl/openssl/crypto/sha/Makefile
  89. 7
      deps/openssl/openssl/crypto/srp/srp_vfy.c
  90. 32
      deps/openssl/openssl/crypto/txt_db/txt_db.c
  91. 1
      deps/openssl/openssl/crypto/ui/ui_lib.c
  92. 41
      deps/openssl/openssl/crypto/x509/x509_lu.c
  93. 32
      deps/openssl/openssl/crypto/x509v3/v3_alt.c
  94. 14
      deps/openssl/openssl/crypto/x509v3/v3_cpols.c
  95. 37
      deps/openssl/openssl/crypto/x509v3/v3_info.c
  96. 1
      deps/openssl/openssl/crypto/x509v3/v3_purp.c
  97. 19
      deps/openssl/openssl/crypto/x86_64cpuid.pl
  98. 38
      deps/openssl/openssl/crypto/x86cpuid.pl
  99. 0
      deps/openssl/openssl/doc-nits
  100. 3
      deps/openssl/openssl/doc/apps/ciphers.pod

6
deps/openssl/openssl/CHANGES

@ -2,6 +2,12 @@
OpenSSL CHANGES OpenSSL CHANGES
_______________ _______________
Changes between 1.0.2k and 1.0.2l [25 May 2017]
*) Have 'config' recognise 64-bit mingw and choose 'mingw64' as the target
platform rather than 'mingw'.
[Richard Levitte]
Changes between 1.0.2j and 1.0.2k [26 Jan 2017] Changes between 1.0.2j and 1.0.2k [26 Jan 2017]
*) Truncated packet could crash via OOB read *) Truncated packet could crash via OOB read

19
deps/openssl/openssl/Configure

@ -109,7 +109,7 @@ my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [experimenta
# Minimum warning options... any contributions to OpenSSL should at least get # Minimum warning options... any contributions to OpenSSL should at least get
# past these. # past these.
my $gcc_devteam_warn = "-Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wshadow -Wformat -Werror -DCRYPTO_MDEBUG_ALL -DCRYPTO_MDEBUG_ABORT -DREF_CHECK -DOPENSSL_NO_DEPRECATED"; my $gcc_devteam_warn = "-Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wshadow -Wformat -Wundef -Werror -DCRYPTO_MDEBUG_ALL -DCRYPTO_MDEBUG_ABORT -DREF_CHECK -DOPENSSL_NO_DEPRECATED";
# TODO(openssl-team): fix problems and investigate if (at least) the following # TODO(openssl-team): fix problems and investigate if (at least) the following
# warnings can also be enabled: # warnings can also be enabled:
@ -2041,12 +2041,13 @@ EOF
close(OUT); close(OUT);
} else { } else {
my $make_command = "$make PERL=\'$perl\'"; my $make_command = "$make PERL=\'$perl\'";
my $make_targets = ""; my @make_targets = ();
$make_targets .= " links" if $symlink; push @make_targets, "links" if $symlink;
$make_targets .= " depend" if $depflags ne $default_depflags && $make_depend; push @make_targets, "depend" if $depflags ne $default_depflags && $make_depend;
$make_targets .= " gentests" if $symlink; push @make_targets, "gentests" if $symlink;
(system $make_command.$make_targets) == 0 or exit $? foreach my $make_target (@make_targets) {
if $make_targets ne ""; (system "$make_command $make_target") == 0 or exit $?;
}
if ( $perl =~ m@^/@) { if ( $perl =~ m@^/@) {
&dofile("tools/c_rehash",$perl,'^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";', '^my \$prefix;$', 'my $prefix = "' . $prefix . '";'); &dofile("tools/c_rehash",$perl,'^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";', '^my \$prefix;$', 'my $prefix = "' . $prefix . '";');
&dofile("apps/CA.pl",$perl,'^#!/', '#!%s'); &dofile("apps/CA.pl",$perl,'^#!/', '#!%s');
@ -2056,8 +2057,8 @@ EOF
&dofile("apps/CA.pl",'/usr/local/bin/perl','^#!/', '#!%s'); &dofile("apps/CA.pl",'/usr/local/bin/perl','^#!/', '#!%s');
} }
if ($depflags ne $default_depflags && !$make_depend) { if ($depflags ne $default_depflags && !$make_depend) {
$warn_make_depend++; $warn_make_depend++;
} }
} }
# create the ms/version32.rc file if needed # create the ms/version32.rc file if needed

4
deps/openssl/openssl/LICENSE

@ -2,7 +2,7 @@
LICENSE ISSUES LICENSE ISSUES
============== ==============
The OpenSSL toolkit stays under a dual license, i.e. both the conditions of The OpenSSL toolkit stays under a double license, i.e. both the conditions of
the OpenSSL License and the original SSLeay license apply to the toolkit. the OpenSSL License and the original SSLeay license apply to the toolkit.
See below for the actual license texts. Actually both licenses are BSD-style See below for the actual license texts. Actually both licenses are BSD-style
Open Source licenses. In case of any license issues related to OpenSSL Open Source licenses. In case of any license issues related to OpenSSL
@ -12,7 +12,7 @@
--------------- ---------------
/* ==================================================================== /* ====================================================================
* Copyright (c) 1998-2016 The OpenSSL Project. All rights reserved. * Copyright (c) 1998-2017 The OpenSSL Project. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions

10
deps/openssl/openssl/Makefile

@ -4,7 +4,7 @@
## Makefile for OpenSSL ## Makefile for OpenSSL
## ##
VERSION=1.0.2k VERSION=1.0.2l
MAJOR=1 MAJOR=1
MINOR=0.2 MINOR=0.2
SHLIB_VERSION_NUMBER=1.0.0 SHLIB_VERSION_NUMBER=1.0.0
@ -426,6 +426,14 @@ clean: libclean
rm -fr $$i/*; \ rm -fr $$i/*; \
done done
distclean: clean
-$(RM) `find . -name .git -prune -o -type l -print`
$(RM) apps/CA.pl
$(RM) test/evptests.txt test/newkey.pem test/testkey.pem test/testreq.pem
$(RM) tools/c_rehash
$(RM) crypto/opensslconf.h
$(RM) Makefile Makefile.bak
makefile.one: files makefile.one: files
$(PERL) util/mk1mf.pl >makefile.one; \ $(PERL) util/mk1mf.pl >makefile.one; \
sh util/do_ms.sh sh util/do_ms.sh

10
deps/openssl/openssl/Makefile.bak

@ -4,7 +4,7 @@
## Makefile for OpenSSL ## Makefile for OpenSSL
## ##
VERSION=1.0.2k VERSION=1.0.2l
MAJOR=1 MAJOR=1
MINOR=0.2 MINOR=0.2
SHLIB_VERSION_NUMBER=1.0.0 SHLIB_VERSION_NUMBER=1.0.0
@ -426,6 +426,14 @@ clean: libclean
rm -fr $$i/*; \ rm -fr $$i/*; \
done done
distclean: clean
-$(RM) `find . -name .git -prune -o -type l -print`
$(RM) apps/CA.pl
$(RM) test/evptests.txt test/newkey.pem test/testkey.pem test/testreq.pem
$(RM) tools/c_rehash
$(RM) crypto/opensslconf.h
$(RM) Makefile Makefile.bak
makefile.one: files makefile.one: files
$(PERL) util/mk1mf.pl >makefile.one; \ $(PERL) util/mk1mf.pl >makefile.one; \
sh util/do_ms.sh sh util/do_ms.sh

8
deps/openssl/openssl/Makefile.org

@ -424,6 +424,14 @@ clean: libclean
rm -fr $$i/*; \ rm -fr $$i/*; \
done done
distclean: clean
-$(RM) `find . -name .git -prune -o -type l -print`
$(RM) apps/CA.pl
$(RM) test/evptests.txt test/newkey.pem test/testkey.pem test/testreq.pem
$(RM) tools/c_rehash
$(RM) crypto/opensslconf.h
$(RM) Makefile Makefile.bak
makefile.one: files makefile.one: files
$(PERL) util/mk1mf.pl >makefile.one; \ $(PERL) util/mk1mf.pl >makefile.one; \
sh util/do_ms.sh sh util/do_ms.sh

4
deps/openssl/openssl/NEWS

@ -5,6 +5,10 @@
This file gives a brief overview of the major changes between each OpenSSL This file gives a brief overview of the major changes between each OpenSSL
release. For more details please read the CHANGES file. release. For more details please read the CHANGES file.
Major changes between OpenSSL 1.0.2k and OpenSSL 1.0.2l [25 May 2017]
o config now recognises 64-bit mingw and chooses mingw64 instead of mingw
Major changes between OpenSSL 1.0.2j and OpenSSL 1.0.2k [26 Jan 2017] Major changes between OpenSSL 1.0.2j and OpenSSL 1.0.2k [26 Jan 2017]
o Truncated packet could crash via OOB read (CVE-2017-3731) o Truncated packet could crash via OOB read (CVE-2017-3731)

2
deps/openssl/openssl/README

@ -1,5 +1,5 @@
OpenSSL 1.0.2k 26 Jan 2017 OpenSSL 1.0.2l 25 May 2017
Copyright (c) 1998-2015 The OpenSSL Project Copyright (c) 1998-2015 The OpenSSL Project
Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson

11
deps/openssl/openssl/apps/app_rand.c

@ -124,16 +124,7 @@ int app_RAND_load_file(const char *file, BIO *bio_e, int dont_warn)
char buffer[200]; char buffer[200];
#ifdef OPENSSL_SYS_WINDOWS #ifdef OPENSSL_SYS_WINDOWS
/* RAND_screen();
* allocate 2 to dont_warn not to use RAND_screen() via
* -no_rand_screen option in s_client
*/
if (dont_warn != 2) {
BIO_printf(bio_e, "Loading 'screen' into random state -");
BIO_flush(bio_e);
RAND_screen();
BIO_printf(bio_e, " done\n");
}
#endif #endif
if (file == NULL) if (file == NULL)

19
deps/openssl/openssl/apps/ca.c

@ -2126,10 +2126,8 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
goto err; goto err;
} }
for (i = 0; i < DB_NUMBER; i++) { for (i = 0; i < DB_NUMBER; i++)
irow[i] = row[i]; irow[i] = row[i];
row[i] = NULL;
}
irow[DB_NUMBER] = NULL; irow[DB_NUMBER] = NULL;
if (!TXT_DB_insert(db->db, irow)) { if (!TXT_DB_insert(db->db, irow)) {
@ -2137,11 +2135,14 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
BIO_printf(bio_err, "TXT_DB error number %ld\n", db->db->error); BIO_printf(bio_err, "TXT_DB error number %ld\n", db->db->error);
goto err; goto err;
} }
irow = NULL;
ok = 1; ok = 1;
err: err:
for (i = 0; i < DB_NUMBER; i++) if (irow != NULL) {
if (row[i] != NULL) for (i = 0; i < DB_NUMBER; i++)
OPENSSL_free(row[i]); OPENSSL_free(row[i]);
OPENSSL_free(irow);
}
if (CAname != NULL) if (CAname != NULL)
X509_NAME_free(CAname); X509_NAME_free(CAname);
@ -2396,18 +2397,20 @@ static int do_revoke(X509 *x509, CA_DB *db, int type, char *value)
goto err; goto err;
} }
for (i = 0; i < DB_NUMBER; i++) { for (i = 0; i < DB_NUMBER; i++)
irow[i] = row[i]; irow[i] = row[i];
row[i] = NULL;
}
irow[DB_NUMBER] = NULL; irow[DB_NUMBER] = NULL;
if (!TXT_DB_insert(db->db, irow)) { if (!TXT_DB_insert(db->db, irow)) {
BIO_printf(bio_err, "failed to update database\n"); BIO_printf(bio_err, "failed to update database\n");
BIO_printf(bio_err, "TXT_DB error number %ld\n", db->db->error); BIO_printf(bio_err, "TXT_DB error number %ld\n", db->db->error);
OPENSSL_free(irow);
goto err; goto err;
} }
for (i = 0; i < DB_NUMBER; i++)
row[i] = NULL;
/* Revoke Certificate */ /* Revoke Certificate */
if (type == -1) if (type == -1)
ok = 1; ok = 1;

24
deps/openssl/openssl/apps/dhparam.c

@ -381,10 +381,19 @@ int MAIN(int argc, char **argv)
} else } else
# endif # endif
{ {
if (informat == FORMAT_ASN1) if (informat == FORMAT_ASN1) {
/*
* We have no PEM header to determine what type of DH params it
* is. We'll just try both.
*/
dh = d2i_DHparams_bio(in, NULL); dh = d2i_DHparams_bio(in, NULL);
else /* informat == FORMAT_PEM */ /* BIO_reset() returns 0 for success for file BIOs only!!! */
if (dh == NULL && BIO_reset(in) == 0)
dh = d2i_DHxparams_bio(in, NULL);
} else {
/* informat == FORMAT_PEM */
dh = PEM_read_bio_DHparams(in, NULL, NULL, NULL); dh = PEM_read_bio_DHparams(in, NULL, NULL, NULL);
}
if (dh == NULL) { if (dh == NULL) {
BIO_printf(bio_err, "unable to load DH parameters\n"); BIO_printf(bio_err, "unable to load DH parameters\n");
@ -484,10 +493,13 @@ int MAIN(int argc, char **argv)
} }
if (!noout) { if (!noout) {
if (outformat == FORMAT_ASN1) if (outformat == FORMAT_ASN1) {
i = i2d_DHparams_bio(out, dh); if (dh->q != NULL)
else if (outformat == FORMAT_PEM) { i = i2d_DHxparams_bio(out, dh);
if (dh->q) else
i = i2d_DHparams_bio(out, dh);
} else if (outformat == FORMAT_PEM) {
if (dh->q != NULL)
i = PEM_write_bio_DHxparams(out, dh); i = PEM_write_bio_DHxparams(out, dh);
else else
i = PEM_write_bio_DHparams(out, dh); i = PEM_write_bio_DHparams(out, dh);

33
deps/openssl/openssl/apps/enc.c

@ -81,20 +81,32 @@ int set_hex(char *in, unsigned char *out, int size);
#define BSIZE (8*1024) #define BSIZE (8*1024)
#define PROG enc_main #define PROG enc_main
static void show_ciphers(const OBJ_NAME *name, void *bio_) struct doall_enc_ciphers {
BIO *bio;
int n;
};
static void show_ciphers(const OBJ_NAME *name, void *arg)
{ {
BIO *bio = bio_; struct doall_enc_ciphers *dec = (struct doall_enc_ciphers *)arg;
static int n; const EVP_CIPHER *cipher;
if (!islower((unsigned char)*name->name)) if (!islower((unsigned char)*name->name))
return; return;
BIO_printf(bio, "-%-25s", name->name); /* Filter out ciphers that we cannot use */
if (++n == 3) { cipher = EVP_get_cipherbyname(name->name);
BIO_printf(bio, "\n"); if (cipher == NULL ||
n = 0; (EVP_CIPHER_flags(cipher) & EVP_CIPH_FLAG_AEAD_CIPHER) != 0 ||
EVP_CIPHER_mode(cipher) == EVP_CIPH_XTS_MODE)
return;
BIO_printf(dec->bio, "-%-25s", name->name);
if (++dec->n == 3) {
BIO_printf(dec->bio, "\n");
dec->n = 0;
} else } else
BIO_printf(bio, " "); BIO_printf(dec->bio, " ");
} }
int MAIN(int, char **); int MAIN(int, char **);
@ -130,6 +142,7 @@ int MAIN(int argc, char **argv)
ENGINE *e = NULL; ENGINE *e = NULL;
const EVP_MD *dgst = NULL; const EVP_MD *dgst = NULL;
int non_fips_allow = 0; int non_fips_allow = 0;
struct doall_enc_ciphers dec;
apps_startup(); apps_startup();
@ -311,8 +324,10 @@ int MAIN(int argc, char **argv)
#endif #endif
BIO_printf(bio_err, "Cipher Types\n"); BIO_printf(bio_err, "Cipher Types\n");
dec.n = 0;
dec.bio = bio_err;
OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_CIPHER_METH, OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_CIPHER_METH,
show_ciphers, bio_err); show_ciphers, &dec);
BIO_printf(bio_err, "\n"); BIO_printf(bio_err, "\n");
goto end; goto end;

9
deps/openssl/openssl/apps/engine.c

@ -108,13 +108,16 @@ static int append_buf(char **buf, const char *s, int *size, int step)
} }
if (strlen(*buf) + strlen(s) >= (unsigned int)*size) { if (strlen(*buf) + strlen(s) >= (unsigned int)*size) {
char *p = *buf;
*size += step; *size += step;
*buf = OPENSSL_realloc(*buf, *size); *buf = OPENSSL_realloc(*buf, *size);
if (*buf == NULL) {
OPENSSL_free(p);
return 0;
}
} }
if (*buf == NULL)
return 0;
if (**buf != '\0') if (**buf != '\0')
BUF_strlcat(*buf, ", ", *size); BUF_strlcat(*buf, ", ", *size);
BUF_strlcat(*buf, s, *size); BUF_strlcat(*buf, s, *size);

4
deps/openssl/openssl/apps/pkeyutl.c

@ -322,8 +322,10 @@ int MAIN(int argc, char **argv)
buf_in, (size_t)buf_inlen); buf_in, (size_t)buf_inlen);
if (rv == 0) if (rv == 0)
BIO_puts(out, "Signature Verification Failure\n"); BIO_puts(out, "Signature Verification Failure\n");
else if (rv == 1) else if (rv == 1) {
BIO_puts(out, "Signature Verified Successfully\n"); BIO_puts(out, "Signature Verified Successfully\n");
ret = 0;
}
if (rv >= 0) if (rv >= 0)
goto end; goto end;
} else { } else {

3
deps/openssl/openssl/apps/prime.c

@ -155,5 +155,8 @@ int MAIN(int argc, char **argv)
BIO_printf(bio_err, "options are\n"); BIO_printf(bio_err, "options are\n");
BIO_printf(bio_err, "%-14s hex\n", "-hex"); BIO_printf(bio_err, "%-14s hex\n", "-hex");
BIO_printf(bio_err, "%-14s number of checks\n", "-checks <n>"); BIO_printf(bio_err, "%-14s number of checks\n", "-checks <n>");
BIO_printf(bio_err, "%-14s generate prime\n", "-generate");
BIO_printf(bio_err, "%-14s number of bits\n", "-bits <n>");
BIO_printf(bio_err, "%-14s safe prime\n", "-safe");
return 1; return 1;
} }

2
deps/openssl/openssl/apps/progs.h

@ -58,7 +58,7 @@ extern int srp_main(int argc, char *argv[]);
typedef struct { typedef struct {
int type; int type;
const char *name; const char *name;
int (*func) (int argc, char *argv[]); int (*func)(int argc, char *argv[]);
} FUNCTION; } FUNCTION;
DECLARE_LHASH_OF(FUNCTION); DECLARE_LHASH_OF(FUNCTION);

30
deps/openssl/openssl/apps/progs.pl

@ -6,22 +6,22 @@ print "/* automatically generated by progs.pl for openssl.c */\n\n";
grep(s/^asn1pars$/asn1parse/,@ARGV); grep(s/^asn1pars$/asn1parse/,@ARGV);
foreach (@ARGV) foreach (@ARGV)
{ printf "extern int %s_main(int argc,char *argv[]);\n",$_; } { printf "extern int %s_main(int argc, char *argv[]);\n",$_; }
print <<'EOF'; print <<'EOF';
#define FUNC_TYPE_GENERAL 1 #define FUNC_TYPE_GENERAL 1
#define FUNC_TYPE_MD 2 #define FUNC_TYPE_MD 2
#define FUNC_TYPE_CIPHER 3 #define FUNC_TYPE_CIPHER 3
#define FUNC_TYPE_PKEY 4 #define FUNC_TYPE_PKEY 4
#define FUNC_TYPE_MD_ALG 5 #define FUNC_TYPE_MD_ALG 5
#define FUNC_TYPE_CIPHER_ALG 6 #define FUNC_TYPE_CIPHER_ALG 6
typedef struct { typedef struct {
int type; int type;
const char *name; const char *name;
int (*func)(int argc,char *argv[]); int (*func)(int argc, char *argv[]);
} FUNCTION; } FUNCTION;
DECLARE_LHASH_OF(FUNCTION); DECLARE_LHASH_OF(FUNCTION);
FUNCTION functions[] = { FUNCTION functions[] = {
@ -30,7 +30,7 @@ EOF
foreach (@ARGV) foreach (@ARGV)
{ {
push(@files,$_); push(@files,$_);
$str="\t{FUNC_TYPE_GENERAL,\"$_\",${_}_main},\n"; $str=" {FUNC_TYPE_GENERAL, \"$_\", ${_}_main},\n";
if (($_ =~ /^s_/) || ($_ =~ /^ciphers$/)) if (($_ =~ /^s_/) || ($_ =~ /^ciphers$/))
{ print "#if !defined(OPENSSL_NO_SOCK)\n${str}#endif\n"; } { print "#if !defined(OPENSSL_NO_SOCK)\n${str}#endif\n"; }
elsif ( ($_ =~ /^speed$/)) elsif ( ($_ =~ /^speed$/))
@ -60,7 +60,7 @@ foreach (@ARGV)
foreach ("md2","md4","md5","sha","sha1","mdc2","rmd160") foreach ("md2","md4","md5","sha","sha1","mdc2","rmd160")
{ {
push(@files,$_); push(@files,$_);
printf "#ifndef OPENSSL_NO_".uc($_)."\n\t{FUNC_TYPE_MD,\"".$_."\",dgst_main},\n#endif\n"; printf "#ifndef OPENSSL_NO_".uc($_)."\n {FUNC_TYPE_MD, \"".$_."\", dgst_main},\n#endif\n";
} }
foreach ( foreach (
@ -86,7 +86,7 @@ foreach (
{ {
push(@files,$_); push(@files,$_);
$t=sprintf("\t{FUNC_TYPE_CIPHER,\"%s\",enc_main},\n",$_); $t=sprintf(" {FUNC_TYPE_CIPHER, \"%s\", enc_main},\n",$_);
if ($_ =~ /des/) { $t="#ifndef OPENSSL_NO_DES\n${t}#endif\n"; } if ($_ =~ /des/) { $t="#ifndef OPENSSL_NO_DES\n${t}#endif\n"; }
elsif ($_ =~ /aes/) { $t="#ifndef OPENSSL_NO_AES\n${t}#endif\n"; } elsif ($_ =~ /aes/) { $t="#ifndef OPENSSL_NO_AES\n${t}#endif\n"; }
elsif ($_ =~ /camellia/) { $t="#ifndef OPENSSL_NO_CAMELLIA\n${t}#endif\n"; } elsif ($_ =~ /camellia/) { $t="#ifndef OPENSSL_NO_CAMELLIA\n${t}#endif\n"; }
@ -101,4 +101,4 @@ foreach (
print $t; print $t;
} }
print "\t{0,NULL,NULL}\n\t};\n"; print " {0, NULL, NULL}\n};\n";

6
deps/openssl/openssl/apps/req.c

@ -331,7 +331,6 @@ int MAIN(int argc, char **argv)
else if (strcmp(*argv, "-text") == 0) else if (strcmp(*argv, "-text") == 0)
text = 1; text = 1;
else if (strcmp(*argv, "-x509") == 0) { else if (strcmp(*argv, "-x509") == 0) {
newreq = 1;
x509 = 1; x509 = 1;
} else if (strcmp(*argv, "-asn1-kludge") == 0) } else if (strcmp(*argv, "-asn1-kludge") == 0)
kludge = 1; kludge = 1;
@ -447,6 +446,9 @@ int MAIN(int argc, char **argv)
goto end; goto end;
} }
if (x509 && infile == NULL)
newreq = 1;
ERR_load_crypto_strings(); ERR_load_crypto_strings();
if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) { if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
BIO_printf(bio_err, "Error getting passwords\n"); BIO_printf(bio_err, "Error getting passwords\n");
@ -753,7 +755,7 @@ int MAIN(int argc, char **argv)
} }
} }
if (newreq) { if (newreq || x509) {
if (pkey == NULL) { if (pkey == NULL) {
BIO_printf(bio_err, "you need to specify a private key\n"); BIO_printf(bio_err, "you need to specify a private key\n");
goto end; goto end;

32
deps/openssl/openssl/apps/s_client.c

@ -180,13 +180,6 @@ typedef unsigned int u_int;
# include <fcntl.h> # include <fcntl.h>
#endif #endif
/* Use Windows API with STD_INPUT_HANDLE when checking for input?
Don't look at OPENSSL_SYS_MSDOS for this, since it is always defined if
OPENSSL_SYS_WINDOWS is defined */
#if defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_WINCE) && defined(STD_INPUT_HANDLE)
#define OPENSSL_USE_STD_INPUT_HANDLE
#endif
#undef PROG #undef PROG
#define PROG s_client_main #define PROG s_client_main
@ -236,7 +229,6 @@ static BIO *bio_c_msg = NULL;
static int c_quiet = 0; static int c_quiet = 0;
static int c_ign_eof = 0; static int c_ign_eof = 0;
static int c_brief = 0; static int c_brief = 0;
static int c_no_rand_screen = 0;
#ifndef OPENSSL_NO_PSK #ifndef OPENSSL_NO_PSK
/* Default PSK identity and key */ /* Default PSK identity and key */
@ -452,10 +444,6 @@ static void sc_usage(void)
" -keymatexport label - Export keying material using label\n"); " -keymatexport label - Export keying material using label\n");
BIO_printf(bio_err, BIO_printf(bio_err,
" -keymatexportlen len - Export len bytes of keying material (default 20)\n"); " -keymatexportlen len - Export len bytes of keying material (default 20)\n");
#ifdef OPENSSL_SYS_WINDOWS
BIO_printf(bio_err,
" -no_rand_screen - Do not use RAND_screen() to initialize random state\n");
#endif
} }
#ifndef OPENSSL_NO_TLSEXT #ifndef OPENSSL_NO_TLSEXT
@ -1148,10 +1136,6 @@ int MAIN(int argc, char **argv)
keymatexportlen = atoi(*(++argv)); keymatexportlen = atoi(*(++argv));
if (keymatexportlen == 0) if (keymatexportlen == 0)
goto bad; goto bad;
#ifdef OPENSSL_SYS_WINDOWS
} else if (strcmp(*argv, "-no_rand_screen") == 0) {
c_no_rand_screen = 1;
#endif
} else { } else {
BIO_printf(bio_err, "unknown option %s\n", *argv); BIO_printf(bio_err, "unknown option %s\n", *argv);
badop = 1; badop = 1;
@ -1268,7 +1252,7 @@ int MAIN(int argc, char **argv)
if (!load_excert(&exc, bio_err)) if (!load_excert(&exc, bio_err))
goto end; goto end;
if (!app_RAND_load_file(NULL, bio_err, ++c_no_rand_screen) && inrand == NULL if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL
&& !RAND_status()) { && !RAND_status()) {
BIO_printf(bio_err, BIO_printf(bio_err,
"warning, not much extra random data, consider using the -rand option\n"); "warning, not much extra random data, consider using the -rand option\n");
@ -1806,7 +1790,10 @@ int MAIN(int argc, char **argv)
tv.tv_usec = 0; tv.tv_usec = 0;
i = select(width, (void *)&readfds, (void *)&writefds, i = select(width, (void *)&readfds, (void *)&writefds,
NULL, &tv); NULL, &tv);
#if defined(OPENSSL_USE_STD_INPUT_HANDLE) # if defined(OPENSSL_SYS_WINCE) || defined(OPENSSL_SYS_MSDOS)
if (!i && (!_kbhit() || !read_tty))
continue;
# else
if (!i && (!((_kbhit()) if (!i && (!((_kbhit())
|| (WAIT_OBJECT_0 == || (WAIT_OBJECT_0 ==
WaitForSingleObject(GetStdHandle WaitForSingleObject(GetStdHandle
@ -1814,8 +1801,6 @@ int MAIN(int argc, char **argv)
0))) 0)))
|| !read_tty)) || !read_tty))
continue; continue;
#else
if(!i && (!_kbhit() || !read_tty) ) continue;
# endif # endif
} else } else
i = select(width, (void *)&readfds, (void *)&writefds, i = select(width, (void *)&readfds, (void *)&writefds,
@ -2017,12 +2002,12 @@ int MAIN(int argc, char **argv)
} }
} }
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS)
#if defined(OPENSSL_USE_STD_INPUT_HANDLE) # if defined(OPENSSL_SYS_WINCE) || defined(OPENSSL_SYS_MSDOS)
else if (_kbhit())
# else
else if ((_kbhit()) else if ((_kbhit())
|| (WAIT_OBJECT_0 == || (WAIT_OBJECT_0 ==
WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0))) WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0)))
#else
else if (_kbhit())
# endif # endif
#elif defined (OPENSSL_SYS_NETWARE) #elif defined (OPENSSL_SYS_NETWARE)
else if (_kbhit()) else if (_kbhit())
@ -2147,6 +2132,7 @@ int MAIN(int argc, char **argv)
BIO_free(bio_c_msg); BIO_free(bio_c_msg);
bio_c_msg = NULL; bio_c_msg = NULL;
} }
SSL_COMP_free_compression_methods();
apps_shutdown(); apps_shutdown();
OPENSSL_EXIT(ret); OPENSSL_EXIT(ret);
} }

1
deps/openssl/openssl/apps/s_server.c

@ -2132,6 +2132,7 @@ int MAIN(int argc, char *argv[])
BIO_free(bio_s_msg); BIO_free(bio_s_msg);
bio_s_msg = NULL; bio_s_msg = NULL;
} }
SSL_COMP_free_compression_methods();
apps_shutdown(); apps_shutdown();
OPENSSL_EXIT(ret); OPENSSL_EXIT(ret);
} }

4
deps/openssl/openssl/apps/srp.c

@ -183,10 +183,8 @@ static int update_index(CA_DB *db, BIO *bio, char **row)
return 0; return 0;
} }
for (i = 0; i < DB_NUMBER; i++) { for (i = 0; i < DB_NUMBER; i++)
irow[i] = row[i]; irow[i] = row[i];
row[i] = NULL;
}
irow[DB_NUMBER] = NULL; irow[DB_NUMBER] = NULL;
if (!TXT_DB_insert(db->db, irow)) { if (!TXT_DB_insert(db->db, irow)) {

8
deps/openssl/openssl/appveyor.yml

@ -50,11 +50,3 @@ build_script:
test_script: test_script:
- nmake /f ms\%MAK% test - nmake /f ms\%MAK% test
notifications:
- provider: Email
to:
- openssl-commits@openssl.org
on_build_success: false
on_build_failure: true
on_build_status_changed: true

9
deps/openssl/openssl/config

@ -344,6 +344,15 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
echo "mips-sony-newsos4"; exit 0; echo "mips-sony-newsos4"; exit 0;
;; ;;
# The following combinations are supported
# MINGW64* on x86_64 => mingw64
# MINGW32* on x86_64 => mingw
# MINGW32* on i?86 => mingw
#
# MINGW64* on i?86 isn't expected to work...
MINGW64*:*:*:x86_64)
echo "${MACHINE}-whatever-mingw64"; exit 0;
;;
MINGW*) MINGW*)
echo "${MACHINE}-whatever-mingw"; exit 0; echo "${MACHINE}-whatever-mingw"; exit 0;
;; ;;

2
deps/openssl/openssl/crypto/aes/Makefile

@ -133,7 +133,7 @@ dclean:
mv -f Makefile.new $(MAKEFILE) mv -f Makefile.new $(MAKEFILE)
clean: clean:
rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff rm -f *.s *.S *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
# DO NOT DELETE THIS LINE -- make depend depends on it. # DO NOT DELETE THIS LINE -- make depend depends on it.

1
deps/openssl/openssl/crypto/aes/asm/aesni-sha1-x86_64.pl

@ -1702,6 +1702,7 @@ $code.=<<___;
mov 240($key),$rounds mov 240($key),$rounds
sub $in0,$out sub $in0,$out
movups ($key),$rndkey0 # $key[0] movups ($key),$rndkey0 # $key[0]
movups ($ivp),$iv # load IV
movups 16($key),$rndkey[0] # forward reference movups 16($key),$rndkey[0] # forward reference
lea 112($key),$key # size optimization lea 112($key),$key # size optimization

1
deps/openssl/openssl/crypto/aes/asm/aesni-sha256-x86_64.pl

@ -1299,6 +1299,7 @@ $code.=<<___;
mov 240($key),$rounds mov 240($key),$rounds
sub $in0,$out sub $in0,$out
movups ($key),$rndkey0 # $key[0] movups ($key),$rndkey0 # $key[0]
movups ($ivp),$iv # load IV
movups 16($key),$rndkey[0] # forward reference movups 16($key),$rndkey[0] # forward reference
lea 112($key),$key # size optimization lea 112($key),$key # size optimization

2
deps/openssl/openssl/crypto/aes/asm/bsaes-armv7.pl

@ -1333,7 +1333,7 @@ bsaes_cbc_encrypt:
vmov @XMM[4],@XMM[15] @ just in case ensure that IV vmov @XMM[4],@XMM[15] @ just in case ensure that IV
vmov @XMM[5],@XMM[0] @ and input are preserved vmov @XMM[5],@XMM[0] @ and input are preserved
bl AES_decrypt bl AES_decrypt
vld1.8 {@XMM[0]}, [$fp,:64] @ load result vld1.8 {@XMM[0]}, [$fp] @ load result
veor @XMM[0], @XMM[0], @XMM[4] @ ^= IV veor @XMM[0], @XMM[0], @XMM[4] @ ^= IV
vmov @XMM[15], @XMM[5] @ @XMM[5] holds input vmov @XMM[15], @XMM[5] @ @XMM[5] holds input
vst1.8 {@XMM[0]}, [$rounds] @ write output vst1.8 {@XMM[0]}, [$rounds] @ write output

7
deps/openssl/openssl/crypto/asn1/a_bitstr.c

@ -114,10 +114,11 @@ int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
*(p++) = (unsigned char)bits; *(p++) = (unsigned char)bits;
d = a->data; d = a->data;
memcpy(p, d, len); if (len > 0) {
p += len; memcpy(p, d, len);
if (len > 0) p += len;
p[-1] &= (0xff << bits); p[-1] &= (0xff << bits);
}
*pp = p; *pp = p;
return (ret); return (ret);
} }

8
deps/openssl/openssl/crypto/asn1/a_digest.c

@ -86,8 +86,10 @@ int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data,
p = str; p = str;
i2d(data, &p); i2d(data, &p);
if (!EVP_Digest(str, i, md, len, type, NULL)) if (!EVP_Digest(str, i, md, len, type, NULL)) {
OPENSSL_free(str);
return 0; return 0;
}
OPENSSL_free(str); OPENSSL_free(str);
return (1); return (1);
} }
@ -104,8 +106,10 @@ int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *asn,
if (!str) if (!str)
return (0); return (0);
if (!EVP_Digest(str, i, md, len, type, NULL)) if (!EVP_Digest(str, i, md, len, type, NULL)) {
OPENSSL_free(str);
return 0; return 0;
}
OPENSSL_free(str); OPENSSL_free(str);
return (1); return (1);
} }

2
deps/openssl/openssl/crypto/asn1/a_gentm.c

@ -202,7 +202,7 @@ int asn1_generalizedtime_to_tm(struct tm *tm, const ASN1_GENERALIZEDTIME *d)
if (a[o] == 'Z') if (a[o] == 'Z')
o++; o++;
else if ((a[o] == '+') || (a[o] == '-')) { else if ((a[o] == '+') || (a[o] == '-')) {
int offsign = a[o] == '-' ? -1 : 1, offset = 0; int offsign = a[o] == '-' ? 1 : -1, offset = 0;
o++; o++;
if (o + 4 > l) if (o + 4 > l)
goto err; goto err;

3
deps/openssl/openssl/crypto/asn1/a_strnid.c

@ -192,7 +192,8 @@ static const ASN1_STRING_TABLE tbl_standard[] = {
{NID_name, 1, ub_name, DIRSTRING_TYPE, 0}, {NID_name, 1, ub_name, DIRSTRING_TYPE, 0},
{NID_dnQualifier, -1, -1, B_ASN1_PRINTABLESTRING, STABLE_NO_MASK}, {NID_dnQualifier, -1, -1, B_ASN1_PRINTABLESTRING, STABLE_NO_MASK},
{NID_domainComponent, 1, -1, B_ASN1_IA5STRING, STABLE_NO_MASK}, {NID_domainComponent, 1, -1, B_ASN1_IA5STRING, STABLE_NO_MASK},
{NID_ms_csp_name, -1, -1, B_ASN1_BMPSTRING, STABLE_NO_MASK} {NID_ms_csp_name, -1, -1, B_ASN1_BMPSTRING, STABLE_NO_MASK},
{NID_jurisdictionCountryName, 2, 2, B_ASN1_PRINTABLESTRING, STABLE_NO_MASK}
}; };
static int sk_table_cmp(const ASN1_STRING_TABLE *const *a, static int sk_table_cmp(const ASN1_STRING_TABLE *const *a,

26
deps/openssl/openssl/crypto/asn1/a_time.c

@ -137,7 +137,7 @@ int ASN1_TIME_check(ASN1_TIME *t)
ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t,
ASN1_GENERALIZEDTIME **out) ASN1_GENERALIZEDTIME **out)
{ {
ASN1_GENERALIZEDTIME *ret; ASN1_GENERALIZEDTIME *ret = NULL;
char *str; char *str;
int newlen; int newlen;
@ -146,22 +146,21 @@ ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t,
if (!out || !*out) { if (!out || !*out) {
if (!(ret = ASN1_GENERALIZEDTIME_new())) if (!(ret = ASN1_GENERALIZEDTIME_new()))
return NULL; goto err;
if (out) } else {
*out = ret;
} else
ret = *out; ret = *out;
}
/* If already GeneralizedTime just copy across */ /* If already GeneralizedTime just copy across */
if (t->type == V_ASN1_GENERALIZEDTIME) { if (t->type == V_ASN1_GENERALIZEDTIME) {
if (!ASN1_STRING_set(ret, t->data, t->length)) if (!ASN1_STRING_set(ret, t->data, t->length))
return NULL; goto err;
return ret; goto done;
} }
/* grow the string */ /* grow the string */
if (!ASN1_STRING_set(ret, NULL, t->length + 2)) if (!ASN1_STRING_set(ret, NULL, t->length + 2))
return NULL; goto err;
/* ASN1_STRING_set() allocated 'len + 1' bytes. */ /* ASN1_STRING_set() allocated 'len + 1' bytes. */
newlen = t->length + 2 + 1; newlen = t->length + 2 + 1;
str = (char *)ret->data; str = (char *)ret->data;
@ -173,9 +172,18 @@ ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t,
BUF_strlcat(str, (char *)t->data, newlen); BUF_strlcat(str, (char *)t->data, newlen);
return ret; done:
if (out != NULL && *out == NULL)
*out = ret;
return ret;
err:
if (out == NULL || *out != ret)
ASN1_GENERALIZEDTIME_free(ret);
return NULL;
} }
int ASN1_TIME_set_string(ASN1_TIME *s, const char *str) int ASN1_TIME_set_string(ASN1_TIME *s, const char *str)
{ {
ASN1_TIME t; ASN1_TIME t;

2
deps/openssl/openssl/crypto/asn1/a_utctm.c

@ -172,7 +172,7 @@ int asn1_utctime_to_tm(struct tm *tm, const ASN1_UTCTIME *d)
if (a[o] == 'Z') if (a[o] == 'Z')
o++; o++;
else if ((a[o] == '+') || (a[o] == '-')) { else if ((a[o] == '+') || (a[o] == '-')) {
int offsign = a[o] == '-' ? -1 : 1, offset = 0; int offsign = a[o] == '-' ? 1 : -1, offset = 0;
o++; o++;
if (o + 4 > l) if (o + 4 > l)
goto err; goto err;

2
deps/openssl/openssl/crypto/asn1/f_enum.c

@ -138,7 +138,7 @@ int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size)
bufp = (unsigned char *)buf; bufp = (unsigned char *)buf;
if (first) { if (first) {
first = 0; first = 0;
if ((bufp[0] == '0') && (buf[1] == '0')) { if ((bufp[0] == '0') && (bufp[1] == '0')) {
bufp += 2; bufp += 2;
i -= 2; i -= 2;
} }

2
deps/openssl/openssl/crypto/asn1/f_int.c

@ -152,7 +152,7 @@ int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size)
bufp = (unsigned char *)buf; bufp = (unsigned char *)buf;
if (first) { if (first) {
first = 0; first = 0;
if ((bufp[0] == '0') && (buf[1] == '0')) { if ((bufp[0] == '0') && (bufp[1] == '0')) {
bufp += 2; bufp += 2;
i -= 2; i -= 2;
} }

1
deps/openssl/openssl/crypto/asn1/tasn_dec.c

@ -673,6 +673,7 @@ static int asn1_template_noexp_d2i(ASN1_VALUE **val,
} }
len -= p - q; len -= p - q;
if (!sk_ASN1_VALUE_push((STACK_OF(ASN1_VALUE) *)*val, skfield)) { if (!sk_ASN1_VALUE_push((STACK_OF(ASN1_VALUE) *)*val, skfield)) {
ASN1_item_ex_free(&skfield, ASN1_ITEM_ptr(tt->item));
ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, ERR_R_MALLOC_FAILURE); ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, ERR_R_MALLOC_FAILURE);
goto err; goto err;
} }

11
deps/openssl/openssl/crypto/asn1/tasn_new.c

@ -158,7 +158,7 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
} }
asn1_set_choice_selector(pval, -1, it); asn1_set_choice_selector(pval, -1, it);
if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL)) if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
goto auxerr; goto auxerr2;
break; break;
case ASN1_ITYPE_NDEF_SEQUENCE: case ASN1_ITYPE_NDEF_SEQUENCE:
@ -186,10 +186,10 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) { for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) {
pseqval = asn1_get_field_ptr(pval, tt); pseqval = asn1_get_field_ptr(pval, tt);
if (!ASN1_template_new(pseqval, tt)) if (!ASN1_template_new(pseqval, tt))
goto memerr; goto memerr2;
} }
if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL)) if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
goto auxerr; goto auxerr2;
break; break;
} }
#ifdef CRYPTO_MDEBUG #ifdef CRYPTO_MDEBUG
@ -198,6 +198,8 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
#endif #endif
return 1; return 1;
memerr2:
ASN1_item_ex_free(pval, it);
memerr: memerr:
ASN1err(ASN1_F_ASN1_ITEM_EX_COMBINE_NEW, ERR_R_MALLOC_FAILURE); ASN1err(ASN1_F_ASN1_ITEM_EX_COMBINE_NEW, ERR_R_MALLOC_FAILURE);
#ifdef CRYPTO_MDEBUG #ifdef CRYPTO_MDEBUG
@ -206,9 +208,10 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
#endif #endif
return 0; return 0;
auxerr2:
ASN1_item_ex_free(pval, it);
auxerr: auxerr:
ASN1err(ASN1_F_ASN1_ITEM_EX_COMBINE_NEW, ASN1_R_AUX_ERROR); ASN1err(ASN1_F_ASN1_ITEM_EX_COMBINE_NEW, ASN1_R_AUX_ERROR);
ASN1_item_ex_free(pval, it);
#ifdef CRYPTO_MDEBUG #ifdef CRYPTO_MDEBUG
if (it->sname) if (it->sname)
CRYPTO_pop_info(); CRYPTO_pop_info();

38
deps/openssl/openssl/crypto/asn1/x_long.c

@ -126,7 +126,7 @@ static int long_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype,
* set. * set.
*/ */
if (ltmp < 0) if (ltmp < 0)
utmp = -ltmp - 1; utmp = 0 - (unsigned long)ltmp - 1;
else else
utmp = ltmp; utmp = ltmp;
clen = BN_num_bits_word(utmp); clen = BN_num_bits_word(utmp);
@ -155,19 +155,41 @@ static int long_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype,
static int long_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, static int long_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
int utype, char *free_cont, const ASN1_ITEM *it) int utype, char *free_cont, const ASN1_ITEM *it)
{ {
int neg, i; int neg = -1, i;
long ltmp; long ltmp;
unsigned long utmp = 0; unsigned long utmp = 0;
char *cp = (char *)pval; char *cp = (char *)pval;
if (len) {
/*
* Check possible pad byte. Worst case, we're skipping past actual
* content, but since that's only with 0x00 and 0xff and we set neg
* accordingly, the result will be correct in the end anyway.
*/
switch (cont[0]) {
case 0xff:
cont++;
len--;
neg = 1;
break;
case 0:
cont++;
len--;
neg = 0;
break;
}
}
if (len > (int)sizeof(long)) { if (len > (int)sizeof(long)) {
ASN1err(ASN1_F_LONG_C2I, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG); ASN1err(ASN1_F_LONG_C2I, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG);
return 0; return 0;
} }
/* Is it negative? */ if (neg == -1) {
if (len && (cont[0] & 0x80)) /* Is it negative? */
neg = 1; if (len && (cont[0] & 0x80))
else neg = 1;
neg = 0; else
neg = 0;
}
utmp = 0; utmp = 0;
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
utmp <<= 8; utmp <<= 8;
@ -178,8 +200,8 @@ static int long_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
} }
ltmp = (long)utmp; ltmp = (long)utmp;
if (neg) { if (neg) {
ltmp++;
ltmp = -ltmp; ltmp = -ltmp;
ltmp--;
} }
if (ltmp == it->size) { if (ltmp == it->size) {
ASN1err(ASN1_F_LONG_C2I, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG); ASN1err(ASN1_F_LONG_C2I, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG);

35
deps/openssl/openssl/crypto/asn1/x_name.c

@ -178,6 +178,16 @@ static void x509_name_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
*pval = NULL; *pval = NULL;
} }
static void local_sk_X509_NAME_ENTRY_free(STACK_OF(X509_NAME_ENTRY) *ne)
{
sk_X509_NAME_ENTRY_free(ne);
}
static void local_sk_X509_NAME_ENTRY_pop_free(STACK_OF(X509_NAME_ENTRY) *ne)
{
sk_X509_NAME_ENTRY_pop_free(ne, X509_NAME_ENTRY_free);
}
static int x509_name_ex_d2i(ASN1_VALUE **val, static int x509_name_ex_d2i(ASN1_VALUE **val,
const unsigned char **in, long len, const unsigned char **in, long len,
const ASN1_ITEM *it, int tag, int aclass, const ASN1_ITEM *it, int tag, int aclass,
@ -228,13 +238,14 @@ static int x509_name_ex_d2i(ASN1_VALUE **val,
entry->set = i; entry->set = i;
if (!sk_X509_NAME_ENTRY_push(nm.x->entries, entry)) if (!sk_X509_NAME_ENTRY_push(nm.x->entries, entry))
goto err; goto err;
sk_X509_NAME_ENTRY_set(entries, j, NULL);
} }
sk_X509_NAME_ENTRY_free(entries);
} }
sk_STACK_OF_X509_NAME_ENTRY_free(intname.s);
ret = x509_name_canon(nm.x); ret = x509_name_canon(nm.x);
if (!ret) if (!ret)
goto err; goto err;
sk_STACK_OF_X509_NAME_ENTRY_pop_free(intname.s,
local_sk_X509_NAME_ENTRY_free);
nm.x->modified = 0; nm.x->modified = 0;
*val = nm.a; *val = nm.a;
*in = p; *in = p;
@ -242,6 +253,8 @@ static int x509_name_ex_d2i(ASN1_VALUE **val,
err: err:
if (nm.x != NULL) if (nm.x != NULL)
X509_NAME_free(nm.x); X509_NAME_free(nm.x);
sk_STACK_OF_X509_NAME_ENTRY_pop_free(intname.s,
local_sk_X509_NAME_ENTRY_pop_free);
ASN1err(ASN1_F_X509_NAME_EX_D2I, ERR_R_NESTED_ASN1_ERROR); ASN1err(ASN1_F_X509_NAME_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
return 0; return 0;
} }
@ -267,16 +280,6 @@ static int x509_name_ex_i2d(ASN1_VALUE **val, unsigned char **out,
return ret; return ret;
} }
static void local_sk_X509_NAME_ENTRY_free(STACK_OF(X509_NAME_ENTRY) *ne)
{
sk_X509_NAME_ENTRY_free(ne);
}
static void local_sk_X509_NAME_ENTRY_pop_free(STACK_OF(X509_NAME_ENTRY) *ne)
{
sk_X509_NAME_ENTRY_pop_free(ne, X509_NAME_ENTRY_free);
}
static int x509_name_encode(X509_NAME *a) static int x509_name_encode(X509_NAME *a)
{ {
union { union {
@ -299,8 +302,10 @@ static int x509_name_encode(X509_NAME *a)
entries = sk_X509_NAME_ENTRY_new_null(); entries = sk_X509_NAME_ENTRY_new_null();
if (!entries) if (!entries)
goto memerr; goto memerr;
if (!sk_STACK_OF_X509_NAME_ENTRY_push(intname.s, entries)) if (!sk_STACK_OF_X509_NAME_ENTRY_push(intname.s, entries)) {
sk_X509_NAME_ENTRY_free(entries);
goto memerr; goto memerr;
}
set = entry->set; set = entry->set;
} }
if (!sk_X509_NAME_ENTRY_push(entries, entry)) if (!sk_X509_NAME_ENTRY_push(entries, entry))
@ -370,8 +375,10 @@ static int x509_name_canon(X509_NAME *a)
entries = sk_X509_NAME_ENTRY_new_null(); entries = sk_X509_NAME_ENTRY_new_null();
if (!entries) if (!entries)
goto err; goto err;
if (!sk_STACK_OF_X509_NAME_ENTRY_push(intname, entries)) if (!sk_STACK_OF_X509_NAME_ENTRY_push(intname, entries)) {
sk_X509_NAME_ENTRY_free(entries);
goto err; goto err;
}
set = entry->set; set = entry->set;
} }
tmpentry = X509_NAME_ENTRY_new(); tmpentry = X509_NAME_ENTRY_new();

2
deps/openssl/openssl/crypto/bio/b_print.c

@ -502,7 +502,7 @@ fmtint(char **sbuffer,
if (!(flags & DP_F_UNSIGNED)) { if (!(flags & DP_F_UNSIGNED)) {
if (value < 0) { if (value < 0) {
signvalue = '-'; signvalue = '-';
uvalue = -value; uvalue = -(unsigned LLONG)value;
} else if (flags & DP_F_PLUS) } else if (flags & DP_F_PLUS)
signvalue = '+'; signvalue = '+';
else if (flags & DP_F_SPACE) else if (flags & DP_F_SPACE)

3
deps/openssl/openssl/crypto/bio/bio_cb.c

@ -78,6 +78,9 @@ long MS_CALLBACK BIO_debug_callback(BIO *bio, int cmd, const char *argp,
len = BIO_snprintf(buf,sizeof buf,"BIO[%p]: ",(void *)bio); len = BIO_snprintf(buf,sizeof buf,"BIO[%p]: ",(void *)bio);
/* Ignore errors and continue printing the other information. */
if (len < 0)
len = 0;
p = buf + len; p = buf + len;
p_maxlen = sizeof(buf) - len; p_maxlen = sizeof(buf) - len;

20
deps/openssl/openssl/crypto/bio/bss_file.c

@ -251,7 +251,7 @@ static int MS_CALLBACK file_read(BIO *b, char *out, int outl)
ret = fread(out, 1, (int)outl, (FILE *)b->ptr); ret = fread(out, 1, (int)outl, (FILE *)b->ptr);
if (ret == 0 if (ret == 0
&& (b->flags & BIO_FLAGS_UPLINK) ? UP_ferror((FILE *)b->ptr) : && (b->flags & BIO_FLAGS_UPLINK) ? UP_ferror((FILE *)b->ptr) :
ferror((FILE *)b->ptr)) { ferror((FILE *)b->ptr)) {
SYSerr(SYS_F_FREAD, get_last_sys_error()); SYSerr(SYS_F_FREAD, get_last_sys_error());
BIOerr(BIO_F_FILE_READ, ERR_R_SYS_LIB); BIOerr(BIO_F_FILE_READ, ERR_R_SYS_LIB);
ret = -1; ret = -1;
@ -287,6 +287,7 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr)
FILE *fp = (FILE *)b->ptr; FILE *fp = (FILE *)b->ptr;
FILE **fpp; FILE **fpp;
char p[4]; char p[4];
int st;
switch (cmd) { switch (cmd) {
case BIO_C_FILE_SEEK: case BIO_C_FILE_SEEK:
@ -318,8 +319,11 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr)
# if defined(__MINGW32__) && defined(__MSVCRT__) && !defined(_IOB_ENTRIES) # if defined(__MINGW32__) && defined(__MSVCRT__) && !defined(_IOB_ENTRIES)
# define _IOB_ENTRIES 20 # define _IOB_ENTRIES 20
# endif # endif
# if defined(_IOB_ENTRIES)
/* Safety net to catch purely internal BIO_set_fp calls */ /* Safety net to catch purely internal BIO_set_fp calls */
# if defined(_MSC_VER) && _MSC_VER>=1900
if (ptr == stdin || ptr == stdout || ptr == stderr)
BIO_clear_flags(b, BIO_FLAGS_UPLINK);
# elif defined(_IOB_ENTRIES)
if ((size_t)ptr >= (size_t)stdin && if ((size_t)ptr >= (size_t)stdin &&
(size_t)ptr < (size_t)(stdin + _IOB_ENTRIES)) (size_t)ptr < (size_t)(stdin + _IOB_ENTRIES))
BIO_clear_flags(b, BIO_FLAGS_UPLINK); BIO_clear_flags(b, BIO_FLAGS_UPLINK);
@ -424,10 +428,14 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr)
b->shutdown = (int)num; b->shutdown = (int)num;
break; break;
case BIO_CTRL_FLUSH: case BIO_CTRL_FLUSH:
if (b->flags & BIO_FLAGS_UPLINK) st = b->flags & BIO_FLAGS_UPLINK
UP_fflush(b->ptr); ? UP_fflush(b->ptr) : fflush((FILE *)b->ptr);
else if (st == EOF) {
fflush((FILE *)b->ptr); SYSerr(SYS_F_FFLUSH, get_last_sys_error());
ERR_add_error_data(1, "fflush()");
BIOerr(BIO_F_FILE_CTRL, ERR_R_SYS_LIB);
ret = 0;
}
break; break;
case BIO_CTRL_DUP: case BIO_CTRL_DUP:
ret = 1; ret = 1;

2
deps/openssl/openssl/crypto/bn/Makefile

@ -187,7 +187,7 @@ dclean:
mv -f Makefile.new $(MAKEFILE) mv -f Makefile.new $(MAKEFILE)
clean: clean:
rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff rm -f *.s *.S *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
# DO NOT DELETE THIS LINE -- make depend depends on it. # DO NOT DELETE THIS LINE -- make depend depends on it.

29
deps/openssl/openssl/crypto/bn/asm/sparcv9-mont.pl

@ -290,7 +290,7 @@ ___
######## .Lbn_sqr_mont gives up to 20% *overall* improvement over ######## .Lbn_sqr_mont gives up to 20% *overall* improvement over
######## code without following dedicated squaring procedure. ######## code without following dedicated squaring procedure.
######## ########
$sbit="%i2"; # re-use $bp! $sbit="%o5";
$code.=<<___; $code.=<<___;
.align 32 .align 32
@ -403,7 +403,7 @@ $code.=<<___;
mulx $apj,$mul0,$acc0 mulx $apj,$mul0,$acc0
mulx $npj,$mul1,$acc1 mulx $npj,$mul1,$acc1
add $acc0,$car0,$car0 add $acc0,$car0,$car0
add $tpj,$car1,$car1 add $tpj,$sbit,$sbit
ld [$ap+$j],$apj ! ap[j] ld [$ap+$j],$apj ! ap[j]
and $car0,$mask,$acc0 and $car0,$mask,$acc0
ld [$np+$j],$npj ! np[j] ld [$np+$j],$npj ! np[j]
@ -412,7 +412,7 @@ $code.=<<___;
ld [$tp+8],$tpj ! tp[j] ld [$tp+8],$tpj ! tp[j]
add $acc0,$acc0,$acc0 add $acc0,$acc0,$acc0
add $j,4,$j ! j++ add $j,4,$j ! j++
or $sbit,$acc0,$acc0 add $sbit,$acc0,$acc0
srlx $acc0,32,$sbit srlx $acc0,32,$sbit
and $acc0,$mask,$acc0 and $acc0,$mask,$acc0
cmp $j,$num cmp $j,$num
@ -426,12 +426,12 @@ $code.=<<___;
mulx $apj,$mul0,$acc0 mulx $apj,$mul0,$acc0
mulx $npj,$mul1,$acc1 mulx $npj,$mul1,$acc1
add $acc0,$car0,$car0 add $acc0,$car0,$car0
add $tpj,$car1,$car1 add $tpj,$sbit,$sbit
and $car0,$mask,$acc0 and $car0,$mask,$acc0
srlx $car0,32,$car0 srlx $car0,32,$car0
add $acc1,$car1,$car1 add $acc1,$car1,$car1
add $acc0,$acc0,$acc0 add $acc0,$acc0,$acc0
or $sbit,$acc0,$acc0 add $sbit,$acc0,$acc0
srlx $acc0,32,$sbit srlx $acc0,32,$sbit
and $acc0,$mask,$acc0 and $acc0,$mask,$acc0
add $acc0,$car1,$car1 add $acc0,$car1,$car1
@ -439,7 +439,7 @@ $code.=<<___;
srlx $car1,32,$car1 srlx $car1,32,$car1
add $car0,$car0,$car0 add $car0,$car0,$car0
or $sbit,$car0,$car0 add $sbit,$car0,$car0
add $car0,$car1,$car1 add $car0,$car1,$car1
add $car2,$car1,$car1 add $car2,$car1,$car1
st $car1,[$tp+4] st $car1,[$tp+4]
@ -499,7 +499,7 @@ $code.=<<___;
.Lsqr_inner2: .Lsqr_inner2:
mulx $apj,$mul0,$acc0 mulx $apj,$mul0,$acc0
mulx $npj,$mul1,$acc1 mulx $npj,$mul1,$acc1
add $tpj,$car1,$car1 add $tpj,$sbit,$sbit
add $acc0,$car0,$car0 add $acc0,$car0,$car0
ld [$ap+$j],$apj ! ap[j] ld [$ap+$j],$apj ! ap[j]
and $car0,$mask,$acc0 and $car0,$mask,$acc0
@ -507,7 +507,7 @@ $code.=<<___;
srlx $car0,32,$car0 srlx $car0,32,$car0
add $acc0,$acc0,$acc0 add $acc0,$acc0,$acc0
ld [$tp+8],$tpj ! tp[j] ld [$tp+8],$tpj ! tp[j]
or $sbit,$acc0,$acc0 add $sbit,$acc0,$acc0
add $j,4,$j ! j++ add $j,4,$j ! j++
srlx $acc0,32,$sbit srlx $acc0,32,$sbit
and $acc0,$mask,$acc0 and $acc0,$mask,$acc0
@ -522,12 +522,12 @@ $code.=<<___;
.Lsqr_no_inner2: .Lsqr_no_inner2:
mulx $apj,$mul0,$acc0 mulx $apj,$mul0,$acc0
mulx $npj,$mul1,$acc1 mulx $npj,$mul1,$acc1
add $tpj,$car1,$car1 add $tpj,$sbit,$sbit
add $acc0,$car0,$car0 add $acc0,$car0,$car0
and $car0,$mask,$acc0 and $car0,$mask,$acc0
srlx $car0,32,$car0 srlx $car0,32,$car0
add $acc0,$acc0,$acc0 add $acc0,$acc0,$acc0
or $sbit,$acc0,$acc0 add $sbit,$acc0,$acc0
srlx $acc0,32,$sbit srlx $acc0,32,$sbit
and $acc0,$mask,$acc0 and $acc0,$mask,$acc0
add $acc0,$car1,$car1 add $acc0,$car1,$car1
@ -536,7 +536,7 @@ $code.=<<___;
srlx $car1,32,$car1 srlx $car1,32,$car1
add $car0,$car0,$car0 add $car0,$car0,$car0
or $sbit,$car0,$car0 add $sbit,$car0,$car0
add $car0,$car1,$car1 add $car0,$car1,$car1
add $car2,$car1,$car1 add $car2,$car1,$car1
st $car1,[$tp+4] st $car1,[$tp+4]
@ -581,14 +581,17 @@ $code.=<<___;
!.Lsqr_last !.Lsqr_last
mulx $npj,$mul1,$acc1 mulx $npj,$mul1,$acc1
add $tpj,$car1,$car1 add $tpj,$acc0,$acc0
srlx $acc0,32,$tmp0
and $acc0,$mask,$acc0
add $tmp0,$sbit,$sbit
add $acc0,$car1,$car1 add $acc0,$car1,$car1
add $acc1,$car1,$car1 add $acc1,$car1,$car1
st $car1,[$tp] st $car1,[$tp]
srlx $car1,32,$car1 srlx $car1,32,$car1
add $car0,$car0,$car0 ! recover $car0 add $car0,$car0,$car0 ! recover $car0
or $sbit,$car0,$car0 add $sbit,$car0,$car0
add $car0,$car1,$car1 add $car0,$car1,$car1
add $car2,$car1,$car1 add $car2,$car1,$car1
st $car1,[$tp+4] st $car1,[$tp+4]

24
deps/openssl/openssl/crypto/bn/bn_prime.c

@ -252,7 +252,6 @@ int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed,
BN_CTX *ctx = NULL; BN_CTX *ctx = NULL;
BIGNUM *A1, *A1_odd, *check; /* taken from ctx */ BIGNUM *A1, *A1_odd, *check; /* taken from ctx */
BN_MONT_CTX *mont = NULL; BN_MONT_CTX *mont = NULL;
const BIGNUM *A = NULL;
if (BN_cmp(a, BN_value_one()) <= 0) if (BN_cmp(a, BN_value_one()) <= 0)
return 0; return 0;
@ -278,25 +277,14 @@ int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed,
goto err; goto err;
BN_CTX_start(ctx); BN_CTX_start(ctx);
/* A := abs(a) */
if (a->neg) {
BIGNUM *t;
if ((t = BN_CTX_get(ctx)) == NULL)
goto err;
if (BN_copy(t, a) == NULL)
goto err;
t->neg = 0;
A = t;
} else
A = a;
A1 = BN_CTX_get(ctx); A1 = BN_CTX_get(ctx);
A1_odd = BN_CTX_get(ctx); A1_odd = BN_CTX_get(ctx);
check = BN_CTX_get(ctx); check = BN_CTX_get(ctx);
if (check == NULL) if (check == NULL)
goto err; goto err;
/* compute A1 := A - 1 */ /* compute A1 := a - 1 */
if (!BN_copy(A1, A)) if (!BN_copy(A1, a))
goto err; goto err;
if (!BN_sub_word(A1, 1)) if (!BN_sub_word(A1, 1))
goto err; goto err;
@ -312,11 +300,11 @@ int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed,
if (!BN_rshift(A1_odd, A1, k)) if (!BN_rshift(A1_odd, A1, k))
goto err; goto err;
/* Montgomery setup for computations mod A */ /* Montgomery setup for computations mod a */
mont = BN_MONT_CTX_new(); mont = BN_MONT_CTX_new();
if (mont == NULL) if (mont == NULL)
goto err; goto err;
if (!BN_MONT_CTX_set(mont, A, ctx)) if (!BN_MONT_CTX_set(mont, a, ctx))
goto err; goto err;
for (i = 0; i < checks; i++) { for (i = 0; i < checks; i++) {
@ -324,9 +312,9 @@ int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed,
goto err; goto err;
if (!BN_add_word(check, 1)) if (!BN_add_word(check, 1))
goto err; goto err;
/* now 1 <= check < A */ /* now 1 <= check < a */
j = witness(check, A, A1, A1_odd, k, ctx, mont); j = witness(check, a, A1, A1_odd, k, ctx, mont);
if (j == -1) if (j == -1)
goto err; goto err;
if (j) { if (j) {

514
deps/openssl/openssl/crypto/bn/bn_prime.h

@ -64,263 +64,263 @@ typedef unsigned short prime_t;
typedef unsigned char prime_t; typedef unsigned char prime_t;
#endif #endif
static const prime_t primes[NUMPRIMES] = { static const prime_t primes[NUMPRIMES] = {
2, 3, 5, 7, 11, 13, 17, 19, 2, 3, 5, 7, 11, 13, 17, 19,
23, 29, 31, 37, 41, 43, 47, 53, 23, 29, 31, 37, 41, 43, 47, 53,
59, 61, 67, 71, 73, 79, 83, 89, 59, 61, 67, 71, 73, 79, 83, 89,
97, 101, 103, 107, 109, 113, 127, 131, 97, 101, 103, 107, 109, 113, 127, 131,
137, 139, 149, 151, 157, 163, 167, 173, 137, 139, 149, 151, 157, 163, 167, 173,
179, 181, 191, 193, 197, 199, 211, 223, 179, 181, 191, 193, 197, 199, 211, 223,
227, 229, 233, 239, 241, 251, 227, 229, 233, 239, 241, 251,
#ifndef EIGHT_BIT #ifndef EIGHT_BIT
257, 263, 257, 263,
269, 271, 277, 281, 283, 293, 307, 311, 269, 271, 277, 281, 283, 293, 307, 311,
313, 317, 331, 337, 347, 349, 353, 359, 313, 317, 331, 337, 347, 349, 353, 359,
367, 373, 379, 383, 389, 397, 401, 409, 367, 373, 379, 383, 389, 397, 401, 409,
419, 421, 431, 433, 439, 443, 449, 457, 419, 421, 431, 433, 439, 443, 449, 457,
461, 463, 467, 479, 487, 491, 499, 503, 461, 463, 467, 479, 487, 491, 499, 503,
509, 521, 523, 541, 547, 557, 563, 569, 509, 521, 523, 541, 547, 557, 563, 569,
571, 577, 587, 593, 599, 601, 607, 613, 571, 577, 587, 593, 599, 601, 607, 613,
617, 619, 631, 641, 643, 647, 653, 659, 617, 619, 631, 641, 643, 647, 653, 659,
661, 673, 677, 683, 691, 701, 709, 719, 661, 673, 677, 683, 691, 701, 709, 719,
727, 733, 739, 743, 751, 757, 761, 769, 727, 733, 739, 743, 751, 757, 761, 769,
773, 787, 797, 809, 811, 821, 823, 827, 773, 787, 797, 809, 811, 821, 823, 827,
829, 839, 853, 857, 859, 863, 877, 881, 829, 839, 853, 857, 859, 863, 877, 881,
883, 887, 907, 911, 919, 929, 937, 941, 883, 887, 907, 911, 919, 929, 937, 941,
947, 953, 967, 971, 977, 983, 991, 997, 947, 953, 967, 971, 977, 983, 991, 997,
1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049,
1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097,
1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163,
1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223,
1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283,
1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321,
1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423,
1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459,
1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511,
1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571,
1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619,
1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693,
1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747,
1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811,
1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877,
1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949,
1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003,
2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069,
2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129,
2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203,
2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267, 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267,
2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311,
2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377, 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377,
2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423,
2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503,
2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579,
2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657,
2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693,
2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741,
2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801,
2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861,
2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939,
2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011,
3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079,
3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167,
3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221, 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221,
3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301,
3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347,
3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413,
3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491,
3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541, 3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541,
3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607, 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607,
3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671,
3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727, 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727,
3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797,
3803, 3821, 3823, 3833, 3847, 3851, 3853, 3863, 3803, 3821, 3823, 3833, 3847, 3851, 3853, 3863,
3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923, 3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923,
3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003, 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003,
4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057,
4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129,
4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211, 4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211,
4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259, 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259,
4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337, 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337,
4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409,
4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481, 4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481,
4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547,
4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621, 4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621,
4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673,
4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751,
4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813,
4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909,
4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967, 4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967,
4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011,
5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087,
5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167,
5171, 5179, 5189, 5197, 5209, 5227, 5231, 5233, 5171, 5179, 5189, 5197, 5209, 5227, 5231, 5233,
5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309,
5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399, 5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399,
5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443,
5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507,
5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573, 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573,
5581, 5591, 5623, 5639, 5641, 5647, 5651, 5653, 5581, 5591, 5623, 5639, 5641, 5647, 5651, 5653,
5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711, 5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711,
5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791,
5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849,
5851, 5857, 5861, 5867, 5869, 5879, 5881, 5897, 5851, 5857, 5861, 5867, 5869, 5879, 5881, 5897,
5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007, 5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007,
6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073, 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073,
6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133, 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133,
6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211,
6217, 6221, 6229, 6247, 6257, 6263, 6269, 6271, 6217, 6221, 6229, 6247, 6257, 6263, 6269, 6271,
6277, 6287, 6299, 6301, 6311, 6317, 6323, 6329, 6277, 6287, 6299, 6301, 6311, 6317, 6323, 6329,
6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379, 6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379,
6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473, 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473,
6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563, 6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563,
6569, 6571, 6577, 6581, 6599, 6607, 6619, 6637, 6569, 6571, 6577, 6581, 6599, 6607, 6619, 6637,
6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701, 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701,
6703, 6709, 6719, 6733, 6737, 6761, 6763, 6779, 6703, 6709, 6719, 6733, 6737, 6761, 6763, 6779,
6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833, 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833,
6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907,
6911, 6917, 6947, 6949, 6959, 6961, 6967, 6971, 6911, 6917, 6947, 6949, 6959, 6961, 6967, 6971,
6977, 6983, 6991, 6997, 7001, 7013, 7019, 7027, 6977, 6983, 6991, 6997, 7001, 7013, 7019, 7027,
7039, 7043, 7057, 7069, 7079, 7103, 7109, 7121, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7121,
7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207, 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207,
7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, 7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253,
7283, 7297, 7307, 7309, 7321, 7331, 7333, 7349, 7283, 7297, 7307, 7309, 7321, 7331, 7333, 7349,
7351, 7369, 7393, 7411, 7417, 7433, 7451, 7457, 7351, 7369, 7393, 7411, 7417, 7433, 7451, 7457,
7459, 7477, 7481, 7487, 7489, 7499, 7507, 7517, 7459, 7477, 7481, 7487, 7489, 7499, 7507, 7517,
7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561, 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561,
7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621, 7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621,
7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691, 7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691,
7699, 7703, 7717, 7723, 7727, 7741, 7753, 7757, 7699, 7703, 7717, 7723, 7727, 7741, 7753, 7757,
7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853,
7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919, 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919,
7927, 7933, 7937, 7949, 7951, 7963, 7993, 8009, 7927, 7933, 7937, 7949, 7951, 7963, 7993, 8009,
8011, 8017, 8039, 8053, 8059, 8069, 8081, 8087, 8011, 8017, 8039, 8053, 8059, 8069, 8081, 8087,
8089, 8093, 8101, 8111, 8117, 8123, 8147, 8161, 8089, 8093, 8101, 8111, 8117, 8123, 8147, 8161,
8167, 8171, 8179, 8191, 8209, 8219, 8221, 8231, 8167, 8171, 8179, 8191, 8209, 8219, 8221, 8231,
8233, 8237, 8243, 8263, 8269, 8273, 8287, 8291, 8233, 8237, 8243, 8263, 8269, 8273, 8287, 8291,
8293, 8297, 8311, 8317, 8329, 8353, 8363, 8369, 8293, 8297, 8311, 8317, 8329, 8353, 8363, 8369,
8377, 8387, 8389, 8419, 8423, 8429, 8431, 8443, 8377, 8387, 8389, 8419, 8423, 8429, 8431, 8443,
8447, 8461, 8467, 8501, 8513, 8521, 8527, 8537, 8447, 8461, 8467, 8501, 8513, 8521, 8527, 8537,
8539, 8543, 8563, 8573, 8581, 8597, 8599, 8609, 8539, 8543, 8563, 8573, 8581, 8597, 8599, 8609,
8623, 8627, 8629, 8641, 8647, 8663, 8669, 8677, 8623, 8627, 8629, 8641, 8647, 8663, 8669, 8677,
8681, 8689, 8693, 8699, 8707, 8713, 8719, 8731, 8681, 8689, 8693, 8699, 8707, 8713, 8719, 8731,
8737, 8741, 8747, 8753, 8761, 8779, 8783, 8803, 8737, 8741, 8747, 8753, 8761, 8779, 8783, 8803,
8807, 8819, 8821, 8831, 8837, 8839, 8849, 8861, 8807, 8819, 8821, 8831, 8837, 8839, 8849, 8861,
8863, 8867, 8887, 8893, 8923, 8929, 8933, 8941, 8863, 8867, 8887, 8893, 8923, 8929, 8933, 8941,
8951, 8963, 8969, 8971, 8999, 9001, 9007, 9011, 8951, 8963, 8969, 8971, 8999, 9001, 9007, 9011,
9013, 9029, 9041, 9043, 9049, 9059, 9067, 9091, 9013, 9029, 9041, 9043, 9049, 9059, 9067, 9091,
9103, 9109, 9127, 9133, 9137, 9151, 9157, 9161, 9103, 9109, 9127, 9133, 9137, 9151, 9157, 9161,
9173, 9181, 9187, 9199, 9203, 9209, 9221, 9227, 9173, 9181, 9187, 9199, 9203, 9209, 9221, 9227,
9239, 9241, 9257, 9277, 9281, 9283, 9293, 9311, 9239, 9241, 9257, 9277, 9281, 9283, 9293, 9311,
9319, 9323, 9337, 9341, 9343, 9349, 9371, 9377, 9319, 9323, 9337, 9341, 9343, 9349, 9371, 9377,
9391, 9397, 9403, 9413, 9419, 9421, 9431, 9433, 9391, 9397, 9403, 9413, 9419, 9421, 9431, 9433,
9437, 9439, 9461, 9463, 9467, 9473, 9479, 9491, 9437, 9439, 9461, 9463, 9467, 9473, 9479, 9491,
9497, 9511, 9521, 9533, 9539, 9547, 9551, 9587, 9497, 9511, 9521, 9533, 9539, 9547, 9551, 9587,
9601, 9613, 9619, 9623, 9629, 9631, 9643, 9649, 9601, 9613, 9619, 9623, 9629, 9631, 9643, 9649,
9661, 9677, 9679, 9689, 9697, 9719, 9721, 9733, 9661, 9677, 9679, 9689, 9697, 9719, 9721, 9733,
9739, 9743, 9749, 9767, 9769, 9781, 9787, 9791, 9739, 9743, 9749, 9767, 9769, 9781, 9787, 9791,
9803, 9811, 9817, 9829, 9833, 9839, 9851, 9857, 9803, 9811, 9817, 9829, 9833, 9839, 9851, 9857,
9859, 9871, 9883, 9887, 9901, 9907, 9923, 9929, 9859, 9871, 9883, 9887, 9901, 9907, 9923, 9929,
9931, 9941, 9949, 9967, 9973, 10007, 10009, 10037, 9931, 9941, 9949, 9967, 9973, 10007, 10009, 10037,
10039, 10061, 10067, 10069, 10079, 10091, 10093, 10099, 10039, 10061, 10067, 10069, 10079, 10091, 10093, 10099,
10103, 10111, 10133, 10139, 10141, 10151, 10159, 10163, 10103, 10111, 10133, 10139, 10141, 10151, 10159, 10163,
10169, 10177, 10181, 10193, 10211, 10223, 10243, 10247, 10169, 10177, 10181, 10193, 10211, 10223, 10243, 10247,
10253, 10259, 10267, 10271, 10273, 10289, 10301, 10303, 10253, 10259, 10267, 10271, 10273, 10289, 10301, 10303,
10313, 10321, 10331, 10333, 10337, 10343, 10357, 10369, 10313, 10321, 10331, 10333, 10337, 10343, 10357, 10369,
10391, 10399, 10427, 10429, 10433, 10453, 10457, 10459, 10391, 10399, 10427, 10429, 10433, 10453, 10457, 10459,
10463, 10477, 10487, 10499, 10501, 10513, 10529, 10531, 10463, 10477, 10487, 10499, 10501, 10513, 10529, 10531,
10559, 10567, 10589, 10597, 10601, 10607, 10613, 10627, 10559, 10567, 10589, 10597, 10601, 10607, 10613, 10627,
10631, 10639, 10651, 10657, 10663, 10667, 10687, 10691, 10631, 10639, 10651, 10657, 10663, 10667, 10687, 10691,
10709, 10711, 10723, 10729, 10733, 10739, 10753, 10771, 10709, 10711, 10723, 10729, 10733, 10739, 10753, 10771,
10781, 10789, 10799, 10831, 10837, 10847, 10853, 10859, 10781, 10789, 10799, 10831, 10837, 10847, 10853, 10859,
10861, 10867, 10883, 10889, 10891, 10903, 10909, 10937, 10861, 10867, 10883, 10889, 10891, 10903, 10909, 10937,
10939, 10949, 10957, 10973, 10979, 10987, 10993, 11003, 10939, 10949, 10957, 10973, 10979, 10987, 10993, 11003,
11027, 11047, 11057, 11059, 11069, 11071, 11083, 11087, 11027, 11047, 11057, 11059, 11069, 11071, 11083, 11087,
11093, 11113, 11117, 11119, 11131, 11149, 11159, 11161, 11093, 11113, 11117, 11119, 11131, 11149, 11159, 11161,
11171, 11173, 11177, 11197, 11213, 11239, 11243, 11251, 11171, 11173, 11177, 11197, 11213, 11239, 11243, 11251,
11257, 11261, 11273, 11279, 11287, 11299, 11311, 11317, 11257, 11261, 11273, 11279, 11287, 11299, 11311, 11317,
11321, 11329, 11351, 11353, 11369, 11383, 11393, 11399, 11321, 11329, 11351, 11353, 11369, 11383, 11393, 11399,
11411, 11423, 11437, 11443, 11447, 11467, 11471, 11483, 11411, 11423, 11437, 11443, 11447, 11467, 11471, 11483,
11489, 11491, 11497, 11503, 11519, 11527, 11549, 11551, 11489, 11491, 11497, 11503, 11519, 11527, 11549, 11551,
11579, 11587, 11593, 11597, 11617, 11621, 11633, 11657, 11579, 11587, 11593, 11597, 11617, 11621, 11633, 11657,
11677, 11681, 11689, 11699, 11701, 11717, 11719, 11731, 11677, 11681, 11689, 11699, 11701, 11717, 11719, 11731,
11743, 11777, 11779, 11783, 11789, 11801, 11807, 11813, 11743, 11777, 11779, 11783, 11789, 11801, 11807, 11813,
11821, 11827, 11831, 11833, 11839, 11863, 11867, 11887, 11821, 11827, 11831, 11833, 11839, 11863, 11867, 11887,
11897, 11903, 11909, 11923, 11927, 11933, 11939, 11941, 11897, 11903, 11909, 11923, 11927, 11933, 11939, 11941,
11953, 11959, 11969, 11971, 11981, 11987, 12007, 12011, 11953, 11959, 11969, 11971, 11981, 11987, 12007, 12011,
12037, 12041, 12043, 12049, 12071, 12073, 12097, 12101, 12037, 12041, 12043, 12049, 12071, 12073, 12097, 12101,
12107, 12109, 12113, 12119, 12143, 12149, 12157, 12161, 12107, 12109, 12113, 12119, 12143, 12149, 12157, 12161,
12163, 12197, 12203, 12211, 12227, 12239, 12241, 12251, 12163, 12197, 12203, 12211, 12227, 12239, 12241, 12251,
12253, 12263, 12269, 12277, 12281, 12289, 12301, 12323, 12253, 12263, 12269, 12277, 12281, 12289, 12301, 12323,
12329, 12343, 12347, 12373, 12377, 12379, 12391, 12401, 12329, 12343, 12347, 12373, 12377, 12379, 12391, 12401,
12409, 12413, 12421, 12433, 12437, 12451, 12457, 12473, 12409, 12413, 12421, 12433, 12437, 12451, 12457, 12473,
12479, 12487, 12491, 12497, 12503, 12511, 12517, 12527, 12479, 12487, 12491, 12497, 12503, 12511, 12517, 12527,
12539, 12541, 12547, 12553, 12569, 12577, 12583, 12589, 12539, 12541, 12547, 12553, 12569, 12577, 12583, 12589,
12601, 12611, 12613, 12619, 12637, 12641, 12647, 12653, 12601, 12611, 12613, 12619, 12637, 12641, 12647, 12653,
12659, 12671, 12689, 12697, 12703, 12713, 12721, 12739, 12659, 12671, 12689, 12697, 12703, 12713, 12721, 12739,
12743, 12757, 12763, 12781, 12791, 12799, 12809, 12821, 12743, 12757, 12763, 12781, 12791, 12799, 12809, 12821,
12823, 12829, 12841, 12853, 12889, 12893, 12899, 12907, 12823, 12829, 12841, 12853, 12889, 12893, 12899, 12907,
12911, 12917, 12919, 12923, 12941, 12953, 12959, 12967, 12911, 12917, 12919, 12923, 12941, 12953, 12959, 12967,
12973, 12979, 12983, 13001, 13003, 13007, 13009, 13033, 12973, 12979, 12983, 13001, 13003, 13007, 13009, 13033,
13037, 13043, 13049, 13063, 13093, 13099, 13103, 13109, 13037, 13043, 13049, 13063, 13093, 13099, 13103, 13109,
13121, 13127, 13147, 13151, 13159, 13163, 13171, 13177, 13121, 13127, 13147, 13151, 13159, 13163, 13171, 13177,
13183, 13187, 13217, 13219, 13229, 13241, 13249, 13259, 13183, 13187, 13217, 13219, 13229, 13241, 13249, 13259,
13267, 13291, 13297, 13309, 13313, 13327, 13331, 13337, 13267, 13291, 13297, 13309, 13313, 13327, 13331, 13337,
13339, 13367, 13381, 13397, 13399, 13411, 13417, 13421, 13339, 13367, 13381, 13397, 13399, 13411, 13417, 13421,
13441, 13451, 13457, 13463, 13469, 13477, 13487, 13499, 13441, 13451, 13457, 13463, 13469, 13477, 13487, 13499,
13513, 13523, 13537, 13553, 13567, 13577, 13591, 13597, 13513, 13523, 13537, 13553, 13567, 13577, 13591, 13597,
13613, 13619, 13627, 13633, 13649, 13669, 13679, 13681, 13613, 13619, 13627, 13633, 13649, 13669, 13679, 13681,
13687, 13691, 13693, 13697, 13709, 13711, 13721, 13723, 13687, 13691, 13693, 13697, 13709, 13711, 13721, 13723,
13729, 13751, 13757, 13759, 13763, 13781, 13789, 13799, 13729, 13751, 13757, 13759, 13763, 13781, 13789, 13799,
13807, 13829, 13831, 13841, 13859, 13873, 13877, 13879, 13807, 13829, 13831, 13841, 13859, 13873, 13877, 13879,
13883, 13901, 13903, 13907, 13913, 13921, 13931, 13933, 13883, 13901, 13903, 13907, 13913, 13921, 13931, 13933,
13963, 13967, 13997, 13999, 14009, 14011, 14029, 14033, 13963, 13967, 13997, 13999, 14009, 14011, 14029, 14033,
14051, 14057, 14071, 14081, 14083, 14087, 14107, 14143, 14051, 14057, 14071, 14081, 14083, 14087, 14107, 14143,
14149, 14153, 14159, 14173, 14177, 14197, 14207, 14221, 14149, 14153, 14159, 14173, 14177, 14197, 14207, 14221,
14243, 14249, 14251, 14281, 14293, 14303, 14321, 14323, 14243, 14249, 14251, 14281, 14293, 14303, 14321, 14323,
14327, 14341, 14347, 14369, 14387, 14389, 14401, 14407, 14327, 14341, 14347, 14369, 14387, 14389, 14401, 14407,
14411, 14419, 14423, 14431, 14437, 14447, 14449, 14461, 14411, 14419, 14423, 14431, 14437, 14447, 14449, 14461,
14479, 14489, 14503, 14519, 14533, 14537, 14543, 14549, 14479, 14489, 14503, 14519, 14533, 14537, 14543, 14549,
14551, 14557, 14561, 14563, 14591, 14593, 14621, 14627, 14551, 14557, 14561, 14563, 14591, 14593, 14621, 14627,
14629, 14633, 14639, 14653, 14657, 14669, 14683, 14699, 14629, 14633, 14639, 14653, 14657, 14669, 14683, 14699,
14713, 14717, 14723, 14731, 14737, 14741, 14747, 14753, 14713, 14717, 14723, 14731, 14737, 14741, 14747, 14753,
14759, 14767, 14771, 14779, 14783, 14797, 14813, 14821, 14759, 14767, 14771, 14779, 14783, 14797, 14813, 14821,
14827, 14831, 14843, 14851, 14867, 14869, 14879, 14887, 14827, 14831, 14843, 14851, 14867, 14869, 14879, 14887,
14891, 14897, 14923, 14929, 14939, 14947, 14951, 14957, 14891, 14897, 14923, 14929, 14939, 14947, 14951, 14957,
14969, 14983, 15013, 15017, 15031, 15053, 15061, 15073, 14969, 14983, 15013, 15017, 15031, 15053, 15061, 15073,
15077, 15083, 15091, 15101, 15107, 15121, 15131, 15137, 15077, 15083, 15091, 15101, 15107, 15121, 15131, 15137,
15139, 15149, 15161, 15173, 15187, 15193, 15199, 15217, 15139, 15149, 15161, 15173, 15187, 15193, 15199, 15217,
15227, 15233, 15241, 15259, 15263, 15269, 15271, 15277, 15227, 15233, 15241, 15259, 15263, 15269, 15271, 15277,
15287, 15289, 15299, 15307, 15313, 15319, 15329, 15331, 15287, 15289, 15299, 15307, 15313, 15319, 15329, 15331,
15349, 15359, 15361, 15373, 15377, 15383, 15391, 15401, 15349, 15359, 15361, 15373, 15377, 15383, 15391, 15401,
15413, 15427, 15439, 15443, 15451, 15461, 15467, 15473, 15413, 15427, 15439, 15443, 15451, 15461, 15467, 15473,
15493, 15497, 15511, 15527, 15541, 15551, 15559, 15569, 15493, 15497, 15511, 15527, 15541, 15551, 15559, 15569,
15581, 15583, 15601, 15607, 15619, 15629, 15641, 15643, 15581, 15583, 15601, 15607, 15619, 15629, 15641, 15643,
15647, 15649, 15661, 15667, 15671, 15679, 15683, 15727, 15647, 15649, 15661, 15667, 15671, 15679, 15683, 15727,
15731, 15733, 15737, 15739, 15749, 15761, 15767, 15773, 15731, 15733, 15737, 15739, 15749, 15761, 15767, 15773,
15787, 15791, 15797, 15803, 15809, 15817, 15823, 15859, 15787, 15791, 15797, 15803, 15809, 15817, 15823, 15859,
15877, 15881, 15887, 15889, 15901, 15907, 15913, 15919, 15877, 15881, 15887, 15889, 15901, 15907, 15913, 15919,
15923, 15937, 15959, 15971, 15973, 15991, 16001, 16007, 15923, 15937, 15959, 15971, 15973, 15991, 16001, 16007,
16033, 16057, 16061, 16063, 16067, 16069, 16073, 16087, 16033, 16057, 16061, 16063, 16067, 16069, 16073, 16087,
16091, 16097, 16103, 16111, 16127, 16139, 16141, 16183, 16091, 16097, 16103, 16111, 16127, 16139, 16141, 16183,
16187, 16189, 16193, 16217, 16223, 16229, 16231, 16249, 16187, 16189, 16193, 16217, 16223, 16229, 16231, 16249,
16253, 16267, 16273, 16301, 16319, 16333, 16339, 16349, 16253, 16267, 16273, 16301, 16319, 16333, 16339, 16349,
16361, 16363, 16369, 16381, 16411, 16417, 16421, 16427, 16361, 16363, 16369, 16381, 16411, 16417, 16421, 16427,
16433, 16447, 16451, 16453, 16477, 16481, 16487, 16493, 16433, 16447, 16451, 16453, 16477, 16481, 16487, 16493,
16519, 16529, 16547, 16553, 16561, 16567, 16573, 16603, 16519, 16529, 16547, 16553, 16561, 16567, 16573, 16603,
16607, 16619, 16631, 16633, 16649, 16651, 16657, 16661, 16607, 16619, 16631, 16633, 16649, 16651, 16657, 16661,
16673, 16691, 16693, 16699, 16703, 16729, 16741, 16747, 16673, 16691, 16693, 16699, 16703, 16729, 16741, 16747,
16759, 16763, 16787, 16811, 16823, 16829, 16831, 16843, 16759, 16763, 16787, 16811, 16823, 16829, 16831, 16843,
16871, 16879, 16883, 16889, 16901, 16903, 16921, 16927, 16871, 16879, 16883, 16889, 16901, 16903, 16921, 16927,
16931, 16937, 16943, 16963, 16979, 16981, 16987, 16993, 16931, 16937, 16943, 16963, 16979, 16981, 16987, 16993,
17011, 17021, 17027, 17029, 17033, 17041, 17047, 17053, 17011, 17021, 17027, 17029, 17033, 17041, 17047, 17053,
17077, 17093, 17099, 17107, 17117, 17123, 17137, 17159, 17077, 17093, 17099, 17107, 17117, 17123, 17137, 17159,
17167, 17183, 17189, 17191, 17203, 17207, 17209, 17231, 17167, 17183, 17189, 17191, 17203, 17207, 17209, 17231,
17239, 17257, 17291, 17293, 17299, 17317, 17321, 17327, 17239, 17257, 17291, 17293, 17299, 17317, 17321, 17327,
17333, 17341, 17351, 17359, 17377, 17383, 17387, 17389, 17333, 17341, 17351, 17359, 17377, 17383, 17387, 17389,
17393, 17401, 17417, 17419, 17431, 17443, 17449, 17467, 17393, 17401, 17417, 17419, 17431, 17443, 17449, 17467,
17471, 17477, 17483, 17489, 17491, 17497, 17509, 17519, 17471, 17477, 17483, 17489, 17491, 17497, 17509, 17519,
17539, 17551, 17569, 17573, 17579, 17581, 17597, 17599, 17539, 17551, 17569, 17573, 17579, 17581, 17597, 17599,
17609, 17623, 17627, 17657, 17659, 17669, 17681, 17683, 17609, 17623, 17627, 17657, 17659, 17669, 17681, 17683,
17707, 17713, 17729, 17737, 17747, 17749, 17761, 17783, 17707, 17713, 17729, 17737, 17747, 17749, 17761, 17783,
17789, 17791, 17807, 17827, 17837, 17839, 17851, 17863, 17789, 17791, 17807, 17827, 17837, 17839, 17851, 17863,
#endif #endif
}; };

28
deps/openssl/openssl/crypto/bn/bn_prime.pl

@ -26,7 +26,7 @@ loop: while ($#primes < $num-1)
# * the code are not to be removed. # * the code are not to be removed.
# * See the COPYRIGHT file in the SSLeay distribution for more details. # * See the COPYRIGHT file in the SSLeay distribution for more details.
# */ # */
# #
# EOF # EOF
print <<\EOF; print <<\EOF;
@ -37,21 +37,21 @@ print <<\EOF;
* This package is an SSL implementation written * This package is an SSL implementation written
* by Eric Young (eay@cryptsoft.com). * by Eric Young (eay@cryptsoft.com).
* The implementation was written so as to conform with Netscapes SSL. * The implementation was written so as to conform with Netscapes SSL.
* *
* This library is free for commercial and non-commercial use as long as * This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions * the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA, * apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation * lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms * included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson (tjh@cryptsoft.com). * except that the holder is Tim Hudson (tjh@cryptsoft.com).
* *
* Copyright remains Eric Young's, and as such any Copyright notices in * Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed. * the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution * If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used. * as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or * This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package. * in documentation (online or textual) provided with the package.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
@ -66,10 +66,10 @@ print <<\EOF;
* Eric Young (eay@cryptsoft.com)" * Eric Young (eay@cryptsoft.com)"
* The word 'cryptographic' can be left out if the rouines from the library * The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-). * being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from * 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement: * the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
* *
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@ -81,7 +81,7 @@ print <<\EOF;
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* The licence and distribution terms for any publically available version or * The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be * derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence * copied and put under another distribution licence
@ -100,20 +100,20 @@ for ($i=0; $i <= $#primes; $i++)
} }
printf "#ifndef EIGHT_BIT\n"; printf "#ifndef EIGHT_BIT\n";
printf "#define NUMPRIMES %d\n",$num; printf "# define NUMPRIMES %d\n",$num;
printf "typedef unsigned short prime_t;\n"; printf "typedef unsigned short prime_t;\n";
printf "#else\n"; printf "#else\n";
printf "#define NUMPRIMES %d\n",$eight; printf "# define NUMPRIMES %d\n",$eight;
printf "typedef unsigned char prime_t;\n"; printf "typedef unsigned char prime_t;\n";
printf "#endif\n"; printf "#endif\n";
print "static const prime_t primes[NUMPRIMES]=\n\t{\n\t"; print "static const prime_t primes[NUMPRIMES] = {";
$init=0; $init=0;
for ($i=0; $i <= $#primes; $i++) for ($i=0; $i <= $#primes; $i++)
{ {
printf "\n#ifndef EIGHT_BIT\n\t" if ($primes[$i] > 256) && !($init++); printf "\n#ifndef EIGHT_BIT\n " if ($primes[$i] > 256) && !($init++);
printf("\n\t") if (($i%8) == 0) && ($i != 0); printf("\n ") if ($i%8) == 0;
printf("%4d,",$primes[$i]); printf(" %5d,",$primes[$i]);
} }
print "\n#endif\n\t};\n"; print "\n#endif\n};\n";

2
deps/openssl/openssl/crypto/bn/bn_print.c

@ -82,8 +82,6 @@ char *BN_bn2hex(const BIGNUM *a)
p = buf; p = buf;
if (a->neg) if (a->neg)
*(p++) = '-'; *(p++) = '-';
if (BN_is_zero(a))
*(p++) = '0';
for (i = a->top - 1; i >= 0; i--) { for (i = a->top - 1; i >= 0; i--) {
for (j = BN_BITS2 - 8; j >= 0; j -= 8) { for (j = BN_BITS2 - 8; j >= 0; j -= 8) {
/* strip leading zeros */ /* strip leading zeros */

25
deps/openssl/openssl/crypto/comp/c_rle.c

@ -31,12 +31,11 @@ static int rle_compress_block(COMP_CTX *ctx, unsigned char *out,
unsigned int olen, unsigned char *in, unsigned int olen, unsigned char *in,
unsigned int ilen) unsigned int ilen)
{ {
/* int i; */ if (ilen == 0)
return 0;
if (ilen == 0 || olen < (ilen - 1)) { if (olen <= ilen)
/* ZZZZZZZZZZZZZZZZZZZZZZ */ return -1;
return (-1);
}
*(out++) = 0; *(out++) = 0;
memcpy(out, in, ilen); memcpy(out, in, ilen);
@ -49,14 +48,16 @@ static int rle_expand_block(COMP_CTX *ctx, unsigned char *out,
{ {
int i; int i;
if (olen < (ilen - 1)) { if (ilen == 0)
/* ZZZZZZZZZZZZZZZZZZZZZZ */ return 0;
return (-1);
} if (olen < (ilen - 1))
return -1;
i = *(in++); i = *(in++);
if (i == 0) { if (i != 0)
memcpy(out, in, ilen - 1); return -1;
}
memcpy(out, in, ilen - 1);
return (ilen - 1); return (ilen - 1);
} }

1
deps/openssl/openssl/crypto/conf/conf.h

@ -259,6 +259,7 @@ void ERR_load_CONF_strings(void);
# define CONF_R_NO_VALUE 108 # define CONF_R_NO_VALUE 108
# define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103 # define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103
# define CONF_R_UNKNOWN_MODULE_NAME 113 # define CONF_R_UNKNOWN_MODULE_NAME 113
# define CONF_R_VARIABLE_EXPANSION_TOO_LONG 116
# define CONF_R_VARIABLE_HAS_NO_VALUE 104 # define CONF_R_VARIABLE_HAS_NO_VALUE 104
#ifdef __cplusplus #ifdef __cplusplus

16
deps/openssl/openssl/crypto/conf/conf_def.c

@ -69,6 +69,12 @@
#include <openssl/buffer.h> #include <openssl/buffer.h>
#include <openssl/err.h> #include <openssl/err.h>
/*
* The maximum length we can grow a value to after variable expansion. 64k
* should be more than enough for all reasonable uses.
*/
#define MAX_CONF_VALUE_LENGTH 65536
static char *eat_ws(CONF *conf, char *p); static char *eat_ws(CONF *conf, char *p);
static char *eat_alpha_numeric(CONF *conf, char *p); static char *eat_alpha_numeric(CONF *conf, char *p);
static void clear_comments(CONF *conf, char *p); static void clear_comments(CONF *conf, char *p);
@ -530,6 +536,8 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from)
} else if (IS_EOF(conf, *from)) } else if (IS_EOF(conf, *from))
break; break;
else if (*from == '$') { else if (*from == '$') {
size_t newsize;
/* try to expand it */ /* try to expand it */
rrp = NULL; rrp = NULL;
s = &(from[1]); s = &(from[1]);
@ -584,8 +592,12 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from)
CONFerr(CONF_F_STR_COPY, CONF_R_VARIABLE_HAS_NO_VALUE); CONFerr(CONF_F_STR_COPY, CONF_R_VARIABLE_HAS_NO_VALUE);
goto err; goto err;
} }
if (!BUF_MEM_grow_clean(buf, newsize = strlen(p) + buf->length - (e - from);
(strlen(p) + buf->length - (e - from)))) { if (newsize > MAX_CONF_VALUE_LENGTH) {
CONFerr(CONF_F_STR_COPY, CONF_R_VARIABLE_EXPANSION_TOO_LONG);
goto err;
}
if (!BUF_MEM_grow_clean(buf, newsize)) {
CONFerr(CONF_F_STR_COPY, ERR_R_MALLOC_FAILURE); CONFerr(CONF_F_STR_COPY, ERR_R_MALLOC_FAILURE);
goto err; goto err;
} }

2
deps/openssl/openssl/crypto/conf/conf_err.c

@ -115,6 +115,8 @@ static ERR_STRING_DATA CONF_str_reasons[] = {
{ERR_REASON(CONF_R_UNABLE_TO_CREATE_NEW_SECTION), {ERR_REASON(CONF_R_UNABLE_TO_CREATE_NEW_SECTION),
"unable to create new section"}, "unable to create new section"},
{ERR_REASON(CONF_R_UNKNOWN_MODULE_NAME), "unknown module name"}, {ERR_REASON(CONF_R_UNKNOWN_MODULE_NAME), "unknown module name"},
{ERR_REASON(CONF_R_VARIABLE_EXPANSION_TOO_LONG),
"variable expansion too long"},
{ERR_REASON(CONF_R_VARIABLE_HAS_NO_VALUE), "variable has no value"}, {ERR_REASON(CONF_R_VARIABLE_HAS_NO_VALUE), "variable has no value"},
{0, NULL} {0, NULL}
}; };

2
deps/openssl/openssl/crypto/des/Makefile

@ -107,7 +107,7 @@ dclean:
mv -f Makefile.new $(MAKEFILE) mv -f Makefile.new $(MAKEFILE)
clean: clean:
rm -f *.s *.o *.obj des lib tags core .pure .nfs* *.old *.bak fluff rm -f *.s *.S *.o *.obj des lib tags core .pure .nfs* *.old *.bak fluff
# DO NOT DELETE THIS LINE -- make depend depends on it. # DO NOT DELETE THIS LINE -- make depend depends on it.

2
deps/openssl/openssl/crypto/des/set_key.c

@ -120,7 +120,7 @@ int DES_check_key_parity(const_DES_cblock *key)
} }
/*- /*-
* Weak and semi week keys as take from * Weak and semi weak keys as taken from
* %A D.W. Davies * %A D.W. Davies
* %A W.L. Price * %A W.L. Price
* %T Security for Computer Networks * %T Security for Computer Networks

29
deps/openssl/openssl/crypto/dh/dh.h

@ -182,12 +182,29 @@ struct dh_st {
*/ */
# define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME # define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME
# define d2i_DHparams_fp(fp,x) (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ # define d2i_DHparams_fp(fp,x) \
(char *(*)())d2i_DHparams,(fp),(unsigned char **)(x)) (DH *)ASN1_d2i_fp((char *(*)())DH_new, \
# define i2d_DHparams_fp(fp,x) ASN1_i2d_fp(i2d_DHparams,(fp), \ (char *(*)())d2i_DHparams, \
(unsigned char *)(x)) (fp), \
# define d2i_DHparams_bio(bp,x) ASN1_d2i_bio_of(DH,DH_new,d2i_DHparams,bp,x) (unsigned char **)(x))
# define i2d_DHparams_bio(bp,x) ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x) # define i2d_DHparams_fp(fp,x) \
ASN1_i2d_fp(i2d_DHparams,(fp), (unsigned char *)(x))
# define d2i_DHparams_bio(bp,x) \
ASN1_d2i_bio_of(DH, DH_new, d2i_DHparams, bp, x)
# define i2d_DHparams_bio(bp,x) \
ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x)
# define d2i_DHxparams_fp(fp,x) \
(DH *)ASN1_d2i_fp((char *(*)())DH_new, \
(char *(*)())d2i_DHxparams, \
(fp), \
(unsigned char **)(x))
# define i2d_DHxparams_fp(fp,x) \
ASN1_i2d_fp(i2d_DHxparams,(fp), (unsigned char *)(x))
# define d2i_DHxparams_bio(bp,x) \
ASN1_d2i_bio_of(DH, DH_new, d2i_DHxparams, bp, x)
# define i2d_DHxparams_bio(bp,x) \
ASN1_i2d_bio_of_const(DH, i2d_DHxparams, bp, x)
DH *DHparams_dup(DH *); DH *DHparams_dup(DH *);

4
deps/openssl/openssl/crypto/ec/ec_ameth.c

@ -342,8 +342,10 @@ static int eckey_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
} }
if (!PKCS8_pkey_set0(p8, OBJ_nid2obj(NID_X9_62_id_ecPublicKey), 0, if (!PKCS8_pkey_set0(p8, OBJ_nid2obj(NID_X9_62_id_ecPublicKey), 0,
ptype, pval, ep, eplen)) ptype, pval, ep, eplen)) {
OPENSSL_free(ep);
return 0; return 0;
}
return 1; return 1;
} }

11
deps/openssl/openssl/crypto/ec/ec_asn1.c

@ -62,17 +62,22 @@
#include <openssl/asn1t.h> #include <openssl/asn1t.h>
#include <openssl/objects.h> #include <openssl/objects.h>
#define OSSL_NELEM(x) (sizeof(x)/sizeof(x[0]))
int EC_GROUP_get_basis_type(const EC_GROUP *group) int EC_GROUP_get_basis_type(const EC_GROUP *group)
{ {
int i = 0; int i;
if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) != if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) !=
NID_X9_62_characteristic_two_field) NID_X9_62_characteristic_two_field)
/* everything else is currently not supported */ /* everything else is currently not supported */
return 0; return 0;
while (group->poly[i] != 0) /* Find the last non-zero element of group->poly[] */
i++; for (i = 0;
i < (int)OSSL_NELEM(group->poly) && group->poly[i] != 0;
i++)
continue;
if (i == 4) if (i == 4)
return NID_X9_62_ppBasis; return NID_X9_62_ppBasis;

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

@ -68,10 +68,14 @@
#include "ec_lcl.h" #include "ec_lcl.h"
/* /*
* This file implements the wNAF-based interleaving multi-exponentation method * This file implements the wNAF-based interleaving multi-exponentiation method
* (<URL:http://www.informatik.tu-darmstadt.de/TI/Mitarbeiter/moeller.html#multiexp>); * Formerly at:
* for multiplication with precomputation, we use wNAF splitting * http://www.informatik.tu-darmstadt.de/TI/Mitarbeiter/moeller.html#multiexp
* (<URL:http://www.informatik.tu-darmstadt.de/TI/Mitarbeiter/moeller.html#fastexp>). * You might now find it here:
* http://link.springer.com/chapter/10.1007%2F3-540-45537-X_13
* http://www.bmoeller.de/pdf/TI-01-08.multiexp.pdf
* For multiplication with precomputation, we use wNAF splitting, formerly at:
* http://www.informatik.tu-darmstadt.de/TI/Mitarbeiter/moeller.html#fastexp
*/ */
/* structure for precomputed multiples of the generator */ /* structure for precomputed multiples of the generator */

2
deps/openssl/openssl/crypto/ec/eck_prn.c

@ -342,7 +342,7 @@ static int print_bin(BIO *fp, const char *name, const unsigned char *buf,
size_t len, int off) size_t len, int off)
{ {
size_t i; size_t i;
char str[128]; char str[128 + 1 + 4];
if (buf == NULL) if (buf == NULL)
return 1; return 1;

5
deps/openssl/openssl/crypto/engine/eng_cryptodev.c

@ -810,14 +810,15 @@ static int cryptodev_digest_update(EVP_MD_CTX *ctx, const void *data,
if (!(ctx->flags & EVP_MD_CTX_FLAG_ONESHOT)) { if (!(ctx->flags & EVP_MD_CTX_FLAG_ONESHOT)) {
/* if application doesn't support one buffer */ /* if application doesn't support one buffer */
state->mac_data = char *mac_data =
OPENSSL_realloc(state->mac_data, state->mac_len + count); OPENSSL_realloc(state->mac_data, state->mac_len + count);
if (!state->mac_data) { if (mac_data == NULL) {
printf("cryptodev_digest_update: realloc failed\n"); printf("cryptodev_digest_update: realloc failed\n");
return (0); return (0);
} }
state->mac_data = mac_data;
memcpy(state->mac_data + state->mac_len, data, count); memcpy(state->mac_data + state->mac_len, data, count);
state->mac_len += count; state->mac_len += count;

1
deps/openssl/openssl/crypto/err/err.c

@ -172,6 +172,7 @@ static ERR_STRING_DATA ERR_str_functs[] = {
# endif # endif
{ERR_PACK(0, SYS_F_OPENDIR, 0), "opendir"}, {ERR_PACK(0, SYS_F_OPENDIR, 0), "opendir"},
{ERR_PACK(0, SYS_F_FREAD, 0), "fread"}, {ERR_PACK(0, SYS_F_FREAD, 0), "fread"},
{ERR_PACK(0, SYS_F_FFLUSH, 0), "fflush"},
{0, NULL}, {0, NULL},
}; };

1
deps/openssl/openssl/crypto/err/err.h

@ -258,6 +258,7 @@ typedef struct err_state_st {
# define SYS_F_WSASTARTUP 9/* Winsock stuff */ # define SYS_F_WSASTARTUP 9/* Winsock stuff */
# define SYS_F_OPENDIR 10 # define SYS_F_OPENDIR 10
# define SYS_F_FREAD 11 # define SYS_F_FREAD 11
# define SYS_F_FFLUSH 18
/* reasons */ /* reasons */
# define ERR_R_SYS_LIB ERR_LIB_SYS/* 2 */ # define ERR_R_SYS_LIB ERR_LIB_SYS/* 2 */

9
deps/openssl/openssl/crypto/evp/e_aes.c

@ -1120,6 +1120,8 @@ BLOCK_CIPHER_generic_pack(NID_aes, 128, EVP_CIPH_FLAG_FIPS)
static int aes_gcm_cleanup(EVP_CIPHER_CTX *c) static int aes_gcm_cleanup(EVP_CIPHER_CTX *c)
{ {
EVP_AES_GCM_CTX *gctx = c->cipher_data; EVP_AES_GCM_CTX *gctx = c->cipher_data;
if (gctx == NULL)
return 0;
OPENSSL_cleanse(&gctx->gcm, sizeof(gctx->gcm)); OPENSSL_cleanse(&gctx->gcm, sizeof(gctx->gcm));
if (gctx->iv != c->iv) if (gctx->iv != c->iv)
OPENSSL_free(gctx->iv); OPENSSL_free(gctx->iv);
@ -1235,10 +1237,15 @@ static int aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
{ {
unsigned int len = c->buf[arg - 2] << 8 | c->buf[arg - 1]; unsigned int len = c->buf[arg - 2] << 8 | c->buf[arg - 1];
/* Correct length for explicit IV */ /* Correct length for explicit IV */
if (len < EVP_GCM_TLS_EXPLICIT_IV_LEN)
return 0;
len -= EVP_GCM_TLS_EXPLICIT_IV_LEN; len -= EVP_GCM_TLS_EXPLICIT_IV_LEN;
/* If decrypting correct for tag too */ /* If decrypting correct for tag too */
if (!c->encrypt) if (!c->encrypt) {
if (len < EVP_GCM_TLS_TAG_LEN)
return 0;
len -= EVP_GCM_TLS_TAG_LEN; len -= EVP_GCM_TLS_TAG_LEN;
}
c->buf[arg - 2] = len >> 8; c->buf[arg - 2] = len >> 8;
c->buf[arg - 1] = len & 0xff; c->buf[arg - 1] = len & 0xff;
} }

2
deps/openssl/openssl/crypto/evp/e_aes_cbc_hmac_sha1.c

@ -859,6 +859,8 @@ static int aesni_cbc_hmac_sha1_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg,
key->payload_length = len; key->payload_length = len;
if ((key->aux.tls_ver = if ((key->aux.tls_ver =
p[arg - 4] << 8 | p[arg - 3]) >= TLS1_1_VERSION) { p[arg - 4] << 8 | p[arg - 3]) >= TLS1_1_VERSION) {
if (len < AES_BLOCK_SIZE)
return 0;
len -= AES_BLOCK_SIZE; len -= AES_BLOCK_SIZE;
p[arg - 2] = len >> 8; p[arg - 2] = len >> 8;
p[arg - 1] = len; p[arg - 1] = len;

6
deps/openssl/openssl/crypto/evp/e_aes_cbc_hmac_sha256.c

@ -825,15 +825,19 @@ static int aesni_cbc_hmac_sha256_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg,
case EVP_CTRL_AEAD_TLS1_AAD: case EVP_CTRL_AEAD_TLS1_AAD:
{ {
unsigned char *p = ptr; unsigned char *p = ptr;
unsigned int len = p[arg - 2] << 8 | p[arg - 1]; unsigned int len;
if (arg != EVP_AEAD_TLS1_AAD_LEN) if (arg != EVP_AEAD_TLS1_AAD_LEN)
return -1; return -1;
len = p[arg - 2] << 8 | p[arg - 1];
if (ctx->encrypt) { if (ctx->encrypt) {
key->payload_length = len; key->payload_length = len;
if ((key->aux.tls_ver = if ((key->aux.tls_ver =
p[arg - 4] << 8 | p[arg - 3]) >= TLS1_1_VERSION) { p[arg - 4] << 8 | p[arg - 3]) >= TLS1_1_VERSION) {
if (len < AES_BLOCK_SIZE)
return 0;
len -= AES_BLOCK_SIZE; len -= AES_BLOCK_SIZE;
p[arg - 2] = len >> 8; p[arg - 2] = len >> 8;
p[arg - 1] = len; p[arg - 1] = len;

2
deps/openssl/openssl/crypto/evp/e_des3.c

@ -212,6 +212,8 @@ static int des_ede3_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
size_t n; size_t n;
unsigned char c[1], d[1]; unsigned char c[1], d[1];
if (!EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS))
inl *= 8;
for (n = 0; n < inl; ++n) { for (n = 0; n < inl; ++n) {
c[0] = (in[n / 8] & (1 << (7 - n % 8))) ? 0x80 : 0; c[0] = (in[n / 8] & (1 << (7 - n % 8))) ? 0x80 : 0;
DES_ede3_cfb_encrypt(c, d, 1, 1, DES_ede3_cfb_encrypt(c, d, 1, 1,

9
deps/openssl/openssl/crypto/evp/evp_enc.c

@ -182,6 +182,7 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
if (ctx->cipher->ctx_size) { if (ctx->cipher->ctx_size) {
ctx->cipher_data = OPENSSL_malloc(ctx->cipher->ctx_size); ctx->cipher_data = OPENSSL_malloc(ctx->cipher->ctx_size);
if (!ctx->cipher_data) { if (!ctx->cipher_data) {
ctx->cipher = NULL;
EVPerr(EVP_F_EVP_CIPHERINIT_EX, ERR_R_MALLOC_FAILURE); EVPerr(EVP_F_EVP_CIPHERINIT_EX, ERR_R_MALLOC_FAILURE);
return 0; return 0;
} }
@ -193,6 +194,7 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
ctx->flags &= EVP_CIPHER_CTX_FLAG_WRAP_ALLOW; ctx->flags &= EVP_CIPHER_CTX_FLAG_WRAP_ALLOW;
if (ctx->cipher->flags & EVP_CIPH_CTRL_INIT) { if (ctx->cipher->flags & EVP_CIPH_CTRL_INIT) {
if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_INIT, 0, NULL)) { if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_INIT, 0, NULL)) {
ctx->cipher = NULL;
EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_INITIALIZATION_ERROR); EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_INITIALIZATION_ERROR);
return 0; return 0;
} }
@ -654,6 +656,7 @@ int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in)
if (in->cipher_data && in->cipher->ctx_size) { if (in->cipher_data && in->cipher->ctx_size) {
out->cipher_data = OPENSSL_malloc(in->cipher->ctx_size); out->cipher_data = OPENSSL_malloc(in->cipher->ctx_size);
if (!out->cipher_data) { if (!out->cipher_data) {
out->cipher = NULL;
EVPerr(EVP_F_EVP_CIPHER_CTX_COPY, ERR_R_MALLOC_FAILURE); EVPerr(EVP_F_EVP_CIPHER_CTX_COPY, ERR_R_MALLOC_FAILURE);
return 0; return 0;
} }
@ -661,6 +664,10 @@ int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in)
} }
if (in->cipher->flags & EVP_CIPH_CUSTOM_COPY) if (in->cipher->flags & EVP_CIPH_CUSTOM_COPY)
return in->cipher->ctrl((EVP_CIPHER_CTX *)in, EVP_CTRL_COPY, 0, out); if (!in->cipher->ctrl((EVP_CIPHER_CTX *)in, EVP_CTRL_COPY, 0, out)) {
out->cipher = NULL;
EVPerr(EVP_F_EVP_CIPHER_CTX_COPY, EVP_R_INITIALIZATION_ERROR);
return 0;
}
return 1; return 1;
} }

2
deps/openssl/openssl/crypto/evp/pmeth_lib.c

@ -188,6 +188,7 @@ static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id)
if (pmeth->init) { if (pmeth->init) {
if (pmeth->init(ret) <= 0) { if (pmeth->init(ret) <= 0) {
ret->pmeth = NULL;
EVP_PKEY_CTX_free(ret); EVP_PKEY_CTX_free(ret);
return NULL; return NULL;
} }
@ -315,6 +316,7 @@ EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *pctx)
if (pctx->pmeth->copy(rctx, pctx) > 0) if (pctx->pmeth->copy(rctx, pctx) > 0)
return rctx; return rctx;
rctx->pmeth = NULL;
EVP_PKEY_CTX_free(rctx); EVP_PKEY_CTX_free(rctx);
return NULL; return NULL;

41
deps/openssl/openssl/crypto/ex_data.c

@ -331,7 +331,11 @@ static EX_CLASS_ITEM *def_get_class(int class_index)
* from the insert will be NULL * from the insert will be NULL
*/ */
(void)lh_EX_CLASS_ITEM_insert(ex_data, gen); (void)lh_EX_CLASS_ITEM_insert(ex_data, gen);
p = gen; p = lh_EX_CLASS_ITEM_retrieve(ex_data, &d);
if (p != gen) {
sk_CRYPTO_EX_DATA_FUNCS_free(gen->meth);
OPENSSL_free(gen);
}
} }
} }
} }
@ -455,7 +459,7 @@ static int int_dup_ex_data(int class_index, CRYPTO_EX_DATA *to,
CRYPTO_EX_DATA *from) CRYPTO_EX_DATA *from)
{ {
int mx, j, i; int mx, j, i;
char *ptr; void *ptr;
CRYPTO_EX_DATA_FUNCS **storage = NULL; CRYPTO_EX_DATA_FUNCS **storage = NULL;
EX_CLASS_ITEM *item; EX_CLASS_ITEM *item;
if (!from->sk) if (!from->sk)
@ -469,6 +473,8 @@ static int int_dup_ex_data(int class_index, CRYPTO_EX_DATA *to,
if (j < mx) if (j < mx)
mx = j; mx = j;
if (mx > 0) { if (mx > 0) {
if (!CRYPTO_set_ex_data(to, mx - 1, NULL))
goto skip;
storage = OPENSSL_malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS *)); storage = OPENSSL_malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS *));
if (!storage) if (!storage)
goto skip; goto skip;
@ -499,11 +505,12 @@ static void int_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad)
int mx, i; int mx, i;
EX_CLASS_ITEM *item; EX_CLASS_ITEM *item;
void *ptr; void *ptr;
CRYPTO_EX_DATA_FUNCS *f;
CRYPTO_EX_DATA_FUNCS **storage = NULL; CRYPTO_EX_DATA_FUNCS **storage = NULL;
if (ex_data == NULL) if (ex_data == NULL)
return; goto err;
if ((item = def_get_class(class_index)) == NULL) if ((item = def_get_class(class_index)) == NULL)
return; goto err;
CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA); CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA);
mx = sk_CRYPTO_EX_DATA_FUNCS_num(item->meth); mx = sk_CRYPTO_EX_DATA_FUNCS_num(item->meth);
if (mx > 0) { if (mx > 0) {
@ -515,23 +522,23 @@ static void int_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad)
} }
skip: skip:
CRYPTO_r_unlock(CRYPTO_LOCK_EX_DATA); CRYPTO_r_unlock(CRYPTO_LOCK_EX_DATA);
if ((mx > 0) && !storage) {
CRYPTOerr(CRYPTO_F_INT_FREE_EX_DATA, ERR_R_MALLOC_FAILURE);
return;
}
for (i = 0; i < mx; i++) { for (i = 0; i < mx; i++) {
if (storage[i] && storage[i]->free_func) { if (storage != NULL)
f = storage[i];
else {
CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA);
f = sk_CRYPTO_EX_DATA_FUNCS_value(item->meth, i);
CRYPTO_r_unlock(CRYPTO_LOCK_EX_DATA);
}
if (f != NULL && f->free_func != NULL) {
ptr = CRYPTO_get_ex_data(ad, i); ptr = CRYPTO_get_ex_data(ad, i);
storage[i]->free_func(obj, ptr, ad, i, f->free_func(obj, ptr, ad, i, f->argl, f->argp);
storage[i]->argl, storage[i]->argp);
} }
} }
if (storage) OPENSSL_free(storage);
OPENSSL_free(storage); err:
if (ad->sk) { sk_void_free(ad->sk);
sk_void_free(ad->sk); ad->sk = NULL;
ad->sk = NULL;
}
} }
/********************************************************************/ /********************************************************************/

11
deps/openssl/openssl/crypto/hmac/hm_pmeth.c

@ -99,15 +99,18 @@ static int pkey_hmac_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)
sctx = src->data; sctx = src->data;
dctx = dst->data; dctx = dst->data;
dctx->md = sctx->md; dctx->md = sctx->md;
HMAC_CTX_init(&dctx->ctx);
if (!HMAC_CTX_copy(&dctx->ctx, &sctx->ctx)) if (!HMAC_CTX_copy(&dctx->ctx, &sctx->ctx))
return 0; goto err;
if (sctx->ktmp.data) { if (sctx->ktmp.data != NULL) {
if (!ASN1_OCTET_STRING_set(&dctx->ktmp, if (!ASN1_OCTET_STRING_set(&dctx->ktmp,
sctx->ktmp.data, sctx->ktmp.length)) sctx->ktmp.data, sctx->ktmp.length))
return 0; goto err;
} }
return 1; return 1;
err:
HMAC_CTX_cleanup(&dctx->ctx);
OPENSSL_free(dctx);
return 0;
} }
static void pkey_hmac_cleanup(EVP_PKEY_CTX *ctx) static void pkey_hmac_cleanup(EVP_PKEY_CTX *ctx)

28
deps/openssl/openssl/crypto/include/internal/bn_conf.h

@ -0,0 +1,28 @@
/* WARNING: do not edit! */
/* Generated by Makefile from crypto/include/internal/bn_conf.h.in */
/*
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (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
*/
#ifndef HEADER_BN_CONF_H
# define HEADER_BN_CONF_H
/*
* The contents of this file are not used in the UEFI build, as
* both 32-bit and 64-bit builds are supported from a single run
* of the Configure script.
*/
/* Should we define BN_DIV2W here? */
/* Only one for the following should be defined */
#define SIXTY_FOUR_BIT_LONG
#undef SIXTY_FOUR_BIT
#undef THIRTY_TWO_BIT
#endif

16
deps/openssl/openssl/crypto/include/internal/dso_conf.h

@ -0,0 +1,16 @@
/* WARNING: do not edit! */
/* Generated by Makefile from crypto/include/internal/dso_conf.h.in */
/*
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (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
*/
#ifndef HEADER_DSO_CONF_H
# define HEADER_DSO_CONF_H
# define DSO_EXTENSION ".so"
#endif

2
deps/openssl/openssl/crypto/md5/Makefile

@ -90,7 +90,7 @@ dclean:
mv -f Makefile.new $(MAKEFILE) mv -f Makefile.new $(MAKEFILE)
clean: clean:
rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff rm -f *.s *.S *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
# DO NOT DELETE THIS LINE -- make depend depends on it. # DO NOT DELETE THIS LINE -- make depend depends on it.

4
deps/openssl/openssl/crypto/mem.c

@ -150,12 +150,12 @@ static long (*get_debug_options_func) (void) = NULL;
int CRYPTO_set_mem_functions(void *(*m) (size_t), void *(*r) (void *, size_t), int CRYPTO_set_mem_functions(void *(*m) (size_t), void *(*r) (void *, size_t),
void (*f) (void *)) void (*f) (void *))
{ {
/* Dummy call just to ensure OPENSSL_init() gets linked in */
OPENSSL_init();
if (!allow_customize) if (!allow_customize)
return 0; return 0;
if ((m == 0) || (r == 0) || (f == 0)) if ((m == 0) || (r == 0) || (f == 0))
return 0; return 0;
/* Dummy call just to ensure OPENSSL_init() gets linked in */
OPENSSL_init();
malloc_func = m; malloc_func = m;
malloc_ex_func = default_malloc_ex; malloc_ex_func = default_malloc_ex;
realloc_func = r; realloc_func = r;

2
deps/openssl/openssl/crypto/modes/Makefile

@ -106,7 +106,7 @@ dclean:
mv -f Makefile.new $(MAKEFILE) mv -f Makefile.new $(MAKEFILE)
clean: clean:
rm -f *.s *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff rm -f *.s *.S *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
# DO NOT DELETE THIS LINE -- make depend depends on it. # DO NOT DELETE THIS LINE -- make depend depends on it.

3
deps/openssl/openssl/crypto/o_dir.c

@ -73,7 +73,8 @@
#include "o_dir.h" #include "o_dir.h"
#define LPDIR_H #define LPDIR_H
#if defined OPENSSL_SYS_UNIX || defined DJGPP #if defined OPENSSL_SYS_UNIX || defined DJGPP \
|| (defined __VMS_VER && __VMS_VER >= 70000000)
# include "LPdir_unix.c" # include "LPdir_unix.c"
#elif defined OPENSSL_SYS_VMS #elif defined OPENSSL_SYS_VMS
# include "LPdir_vms.c" # include "LPdir_vms.c"

7
deps/openssl/openssl/crypto/o_time.c

@ -106,11 +106,8 @@ struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result)
struct tm *ts = NULL; struct tm *ts = NULL;
#if defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32) && !defined(OPENSSL_SYS_OS2) && (!defined(OPENSSL_SYS_VMS) || defined(gmtime_r)) && !defined(OPENSSL_SYS_MACOSX) && !defined(OPENSSL_SYS_SUNOS) #if defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32) && !defined(OPENSSL_SYS_OS2) && (!defined(OPENSSL_SYS_VMS) || defined(gmtime_r)) && !defined(OPENSSL_SYS_MACOSX) && !defined(OPENSSL_SYS_SUNOS)
/* if (gmtime_r(timer, result) == NULL)
* should return &data, but doesn't on some systems, so we don't even return NULL;
* look at the return value
*/
gmtime_r(timer, result);
ts = result; ts = result;
#elif !defined(OPENSSL_SYS_VMS) || defined(VMS_GMTIME_OK) #elif !defined(OPENSSL_SYS_VMS) || defined(VMS_GMTIME_OK)
ts = gmtime(timer); ts = gmtime(timer);

266
deps/openssl/openssl/crypto/opensslconf.h

@ -1 +1,265 @@
#include "../../config/opensslconf.h" /* opensslconf.h */
/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
#ifdef __cplusplus
extern "C" {
#endif
/* OpenSSL was configured with the following options: */
#ifndef OPENSSL_DOING_MAKEDEPEND
#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
# define OPENSSL_NO_EC_NISTP_64_GCC_128
#endif
#ifndef OPENSSL_NO_GMP
# define OPENSSL_NO_GMP
#endif
#ifndef OPENSSL_NO_JPAKE
# define OPENSSL_NO_JPAKE
#endif
#ifndef OPENSSL_NO_KRB5
# define OPENSSL_NO_KRB5
#endif
#ifndef OPENSSL_NO_LIBUNBOUND
# define OPENSSL_NO_LIBUNBOUND
#endif
#ifndef OPENSSL_NO_MD2
# define OPENSSL_NO_MD2
#endif
#ifndef OPENSSL_NO_RC5
# define OPENSSL_NO_RC5
#endif
#ifndef OPENSSL_NO_RFC3779
# define OPENSSL_NO_RFC3779
#endif
#ifndef OPENSSL_NO_SCTP
# define OPENSSL_NO_SCTP
#endif
#ifndef OPENSSL_NO_SSL_TRACE
# define OPENSSL_NO_SSL_TRACE
#endif
#ifndef OPENSSL_NO_SSL2
# define OPENSSL_NO_SSL2
#endif
#ifndef OPENSSL_NO_STORE
# define OPENSSL_NO_STORE
#endif
#ifndef OPENSSL_NO_UNIT_TEST
# define OPENSSL_NO_UNIT_TEST
#endif
#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS
# define OPENSSL_NO_WEAK_SSL_CIPHERS
#endif
#endif /* OPENSSL_DOING_MAKEDEPEND */
#ifndef OPENSSL_NO_DYNAMIC_ENGINE
# define OPENSSL_NO_DYNAMIC_ENGINE
#endif
/* The OPENSSL_NO_* macros are also defined as NO_* if the application
asks for it. This is a transient feature that is provided for those
who haven't had the time to do the appropriate changes in their
applications. */
#ifdef OPENSSL_ALGORITHM_DEFINES
# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
# define NO_EC_NISTP_64_GCC_128
# endif
# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
# define NO_GMP
# endif
# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
# define NO_JPAKE
# endif
# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
# define NO_KRB5
# endif
# if defined(OPENSSL_NO_LIBUNBOUND) && !defined(NO_LIBUNBOUND)
# define NO_LIBUNBOUND
# endif
# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
# define NO_MD2
# endif
# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
# define NO_RC5
# endif
# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
# define NO_RFC3779
# endif
# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
# define NO_SCTP
# endif
# if defined(OPENSSL_NO_SSL_TRACE) && !defined(NO_SSL_TRACE)
# define NO_SSL_TRACE
# endif
# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
# define NO_SSL2
# endif
# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
# define NO_STORE
# endif
# if defined(OPENSSL_NO_UNIT_TEST) && !defined(NO_UNIT_TEST)
# define NO_UNIT_TEST
# endif
# if defined(OPENSSL_NO_WEAK_SSL_CIPHERS) && !defined(NO_WEAK_SSL_CIPHERS)
# define NO_WEAK_SSL_CIPHERS
# endif
#endif
/* crypto/opensslconf.h.in */
/* Generate 80386 code? */
#undef I386_ONLY
#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
#define ENGINESDIR "/usr/local/ssl/lib/engines"
#define OPENSSLDIR "/usr/local/ssl"
#endif
#endif
#undef OPENSSL_UNISTD
#define OPENSSL_UNISTD <unistd.h>
#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
#define IDEA_INT unsigned int
#endif
#if defined(HEADER_MD2_H) && !defined(MD2_INT)
#define MD2_INT unsigned int
#endif
#if defined(HEADER_RC2_H) && !defined(RC2_INT)
/* I need to put in a mod for the alpha - eay */
#define RC2_INT unsigned int
#endif
#if defined(HEADER_RC4_H)
#if !defined(RC4_INT)
/* using int types make the structure larger but make the code faster
* on most boxes I have tested - up to %20 faster. */
/*
* I don't know what does "most" mean, but declaring "int" is a must on:
* - Intel P6 because partial register stalls are very expensive;
* - elder Alpha because it lacks byte load/store instructions;
*/
#define RC4_INT unsigned int
#endif
#if !defined(RC4_CHUNK)
/*
* This enables code handling data aligned at natural CPU word
* boundary. See crypto/rc4/rc4_enc.c for further details.
*/
#undef RC4_CHUNK
#endif
#endif
#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
* %20 speed up (longs are 8 bytes, int's are 4). */
#ifndef DES_LONG
#define DES_LONG unsigned long
#endif
#endif
#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
#define CONFIG_HEADER_BN_H
#undef BN_LLONG
/* Should we define BN_DIV2W here? */
/* Only one for the following should be defined */
#undef SIXTY_FOUR_BIT_LONG
#undef SIXTY_FOUR_BIT
#define THIRTY_TWO_BIT
#endif
#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
#define CONFIG_HEADER_RC4_LOCL_H
/* if this is defined data[i] is used instead of *data, this is a %20
* speedup on x86 */
#undef RC4_INDEX
#endif
#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
#define CONFIG_HEADER_BF_LOCL_H
#undef BF_PTR
#endif /* HEADER_BF_LOCL_H */
#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
#define CONFIG_HEADER_DES_LOCL_H
#ifndef DES_DEFAULT_OPTIONS
/* the following is tweaked from a config script, that is why it is a
* protected undef/define */
#ifndef DES_PTR
#undef DES_PTR
#endif
/* This helps C compiler generate the correct code for multiple functional
* units. It reduces register dependancies at the expense of 2 more
* registers */
#ifndef DES_RISC1
#undef DES_RISC1
#endif
#ifndef DES_RISC2
#undef DES_RISC2
#endif
#if defined(DES_RISC1) && defined(DES_RISC2)
#error YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
#endif
/* Unroll the inner loop, this sometimes helps, sometimes hinders.
* Very mucy CPU dependant */
#ifndef DES_UNROLL
#undef DES_UNROLL
#endif
/* These default values were supplied by
* Peter Gutman <pgut001@cs.auckland.ac.nz>
* They are only used if nothing else has been defined */
#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
/* Special defines which change the way the code is built depending on the
CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
even newer MIPS CPU's, but at the moment one size fits all for
optimization options. Older Sparc's work better with only UNROLL, but
there's no way to tell at compile time what it is you're running on */
#if defined( __sun ) || defined ( sun ) /* Newer Sparc's */
# define DES_PTR
# define DES_RISC1
# define DES_UNROLL
#elif defined( __ultrix ) /* Older MIPS */
# define DES_PTR
# define DES_RISC2
# define DES_UNROLL
#elif defined( __osf1__ ) /* Alpha */
# define DES_PTR
# define DES_RISC2
#elif defined ( _AIX ) /* RS6000 */
/* Unknown */
#elif defined( __hpux ) /* HP-PA */
/* Unknown */
#elif defined( __aux ) /* 68K */
/* Unknown */
#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
# define DES_UNROLL
#elif defined( __sgi ) /* Newer MIPS */
# define DES_PTR
# define DES_RISC2
# define DES_UNROLL
#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
# define DES_PTR
# define DES_RISC1
# define DES_UNROLL
#endif /* Systems-specific speed defines */
#endif
#endif /* DES_DEFAULT_OPTIONS */
#endif /* HEADER_DES_LOCL_H */
#ifdef __cplusplus
}
#endif

6
deps/openssl/openssl/crypto/opensslv.h

@ -30,11 +30,11 @@ extern "C" {
* (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for
* major minor fix final patch/beta) * major minor fix final patch/beta)
*/ */
# define OPENSSL_VERSION_NUMBER 0x100020bfL # define OPENSSL_VERSION_NUMBER 0x100020cfL
# ifdef OPENSSL_FIPS # ifdef OPENSSL_FIPS
# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2k-fips 26 Jan 2017" # define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2l-fips 25 May 2017"
# else # else
# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2k 26 Jan 2017" # define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2l 25 May 2017"
# endif # endif
# define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT # define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT

4
deps/openssl/openssl/crypto/perlasm/x86_64-xlate.pl

@ -415,7 +415,7 @@ my %globals;
} }
} }
} }
{ package expr; # pick up expressioins { package expr; # pick up expressions
sub re { sub re {
my $self = shift; # single instance is enough... my $self = shift; # single instance is enough...
local *line = shift; local *line = shift;
@ -978,7 +978,7 @@ close STDOUT;
# the area above user stack pointer in true asynchronous manner... # the area above user stack pointer in true asynchronous manner...
# #
# All the above means that if assembler programmer adheres to Unix # All the above means that if assembler programmer adheres to Unix
# register and stack layout, but disregards the "red zone" existense, # register and stack layout, but disregards the "red zone" existence,
# it's possible to use following prologue and epilogue to "gear" from # it's possible to use following prologue and epilogue to "gear" from
# Unix to Win64 ABI in leaf functions with not more than 6 arguments. # Unix to Win64 ABI in leaf functions with not more than 6 arguments.
# #

14
deps/openssl/openssl/crypto/perlasm/x86masm.pl

@ -18,10 +18,10 @@ sub ::generic
if ($opcode =~ /lea/ && @arg[1] =~ s/.*PTR\s+(\(.*\))$/OFFSET $1/) # no [] if ($opcode =~ /lea/ && @arg[1] =~ s/.*PTR\s+(\(.*\))$/OFFSET $1/) # no []
{ $opcode="mov"; } { $opcode="mov"; }
elsif ($opcode !~ /mov[dq]$/) elsif ($opcode !~ /movq/)
{ # fix xmm references { # fix xmm references
$arg[0] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[-1]=~/\bxmm[0-7]\b/i); $arg[0] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[1]=~/\bxmm[0-7]\b/i);
$arg[-1] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[0]=~/\bxmm[0-7]\b/i); $arg[1] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[0]=~/\bxmm[0-7]\b/i);
} }
&::emit($opcode,@arg); &::emit($opcode,@arg);
@ -82,7 +82,7 @@ TITLE $_[0].asm
IF \@Version LT 800 IF \@Version LT 800
ECHO MASM version 8.00 or later is strongly recommended. ECHO MASM version 8.00 or later is strongly recommended.
ENDIF ENDIF
.686 .486
.MODEL FLAT .MODEL FLAT
OPTION DOTNAME OPTION DOTNAME
IF \@Version LT 800 IF \@Version LT 800
@ -160,13 +160,13 @@ sub ::public_label
{ push(@out,"PUBLIC\t".&::LABEL($_[0],$nmdecor.$_[0])."\n"); } { push(@out,"PUBLIC\t".&::LABEL($_[0],$nmdecor.$_[0])."\n"); }
sub ::data_byte sub ::data_byte
{ push(@out,("DB\t").join(',',splice(@_,0,16))."\n") while(@_); } { push(@out,("DB\t").join(',',@_)."\n"); }
sub ::data_short sub ::data_short
{ push(@out,("DW\t").join(',',splice(@_,0,8))."\n") while(@_); } { push(@out,("DW\t").join(',',@_)."\n"); }
sub ::data_word sub ::data_word
{ push(@out,("DD\t").join(',',splice(@_,0,4))."\n") while(@_); } { push(@out,("DD\t").join(',',@_)."\n"); }
sub ::align sub ::align
{ push(@out,"ALIGN\t$_[0]\n"); } { push(@out,"ALIGN\t$_[0]\n"); }

5
deps/openssl/openssl/crypto/pkcs12/p12_mutl.c

@ -159,7 +159,10 @@ int PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen,
int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, int saltlen, int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, int saltlen,
const EVP_MD *md_type) const EVP_MD *md_type)
{ {
if (!(p12->mac = PKCS12_MAC_DATA_new())) PKCS12_MAC_DATA_free(p12->mac);
p12->mac = NULL;
if ((p12->mac = PKCS12_MAC_DATA_new()) == NULL)
return PKCS12_ERROR; return PKCS12_ERROR;
if (iter > 1) { if (iter > 1) {
if (!(p12->mac->iter = M_ASN1_INTEGER_new())) { if (!(p12->mac->iter = M_ASN1_INTEGER_new())) {

24
deps/openssl/openssl/crypto/ppccap.c

@ -7,6 +7,10 @@
#if defined(__linux) || defined(_AIX) #if defined(__linux) || defined(_AIX)
# include <sys/utsname.h> # include <sys/utsname.h>
#endif #endif
#if defined(__APPLE__) && defined(__MACH__)
# include <sys/types.h>
# include <sys/sysctl.h>
#endif
#include <openssl/crypto.h> #include <openssl/crypto.h>
#include <openssl/bn.h> #include <openssl/bn.h>
@ -123,6 +127,26 @@ void OPENSSL_cpuid_setup(void)
} }
#endif #endif
#if defined(__APPLE__) && defined(__MACH__)
{
int val;
size_t len = sizeof(val);
if (sysctlbyname("hw.optional.64bitops", &val, &len, NULL, 0) == 0) {
if (val)
OPENSSL_ppccap_P |= PPC_FPU64;
}
len = sizeof(val);
if (sysctlbyname("hw.optional.altivec", &val, &len, NULL, 0) == 0) {
if (val)
OPENSSL_ppccap_P |= PPC_ALTIVEC;
}
return;
}
#endif
memset(&ill_act, 0, sizeof(ill_act)); memset(&ill_act, 0, sizeof(ill_act));
ill_act.sa_handler = ill_handler; ill_act.sa_handler = ill_handler;
ill_act.sa_mask = all_masked; ill_act.sa_mask = all_masked;

72
deps/openssl/openssl/crypto/rand/md_rand.c

@ -266,17 +266,21 @@ static void ssleay_rand_add(const void *buf, int num, double add)
j = (num - i); j = (num - i);
j = (j > MD_DIGEST_LENGTH) ? MD_DIGEST_LENGTH : j; j = (j > MD_DIGEST_LENGTH) ? MD_DIGEST_LENGTH : j;
MD_Init(&m); if (!MD_Init(&m) ||
MD_Update(&m, local_md, MD_DIGEST_LENGTH); !MD_Update(&m, local_md, MD_DIGEST_LENGTH))
goto err;
k = (st_idx + j) - STATE_SIZE; k = (st_idx + j) - STATE_SIZE;
if (k > 0) { if (k > 0) {
MD_Update(&m, &(state[st_idx]), j - k); if (!MD_Update(&m, &(state[st_idx]), j - k) ||
MD_Update(&m, &(state[0]), k); !MD_Update(&m, &(state[0]), k))
goto err;
} else } else
MD_Update(&m, &(state[st_idx]), j); if (!MD_Update(&m, &(state[st_idx]), j))
goto err;
/* DO NOT REMOVE THE FOLLOWING CALL TO MD_Update()! */ /* DO NOT REMOVE THE FOLLOWING CALL TO MD_Update()! */
MD_Update(&m, buf, j); if (!MD_Update(&m, buf, j))
goto err;
/* /*
* We know that line may cause programs such as purify and valgrind * We know that line may cause programs such as purify and valgrind
* to complain about use of uninitialized data. The problem is not, * to complain about use of uninitialized data. The problem is not,
@ -285,8 +289,9 @@ static void ssleay_rand_add(const void *buf, int num, double add)
* insecure keys. * insecure keys.
*/ */
MD_Update(&m, (unsigned char *)&(md_c[0]), sizeof(md_c)); if (!MD_Update(&m, (unsigned char *)&(md_c[0]), sizeof(md_c)) ||
MD_Final(&m, local_md); !MD_Final(&m, local_md))
goto err;
md_c[1]++; md_c[1]++;
buf = (const char *)buf + j; buf = (const char *)buf + j;
@ -305,7 +310,6 @@ static void ssleay_rand_add(const void *buf, int num, double add)
st_idx = 0; st_idx = 0;
} }
} }
EVP_MD_CTX_cleanup(&m);
if (!do_not_lock) if (!do_not_lock)
CRYPTO_w_lock(CRYPTO_LOCK_RAND); CRYPTO_w_lock(CRYPTO_LOCK_RAND);
@ -326,6 +330,9 @@ static void ssleay_rand_add(const void *buf, int num, double add)
#if !defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32) #if !defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32)
assert(md_c[1] == md_count[1]); assert(md_c[1] == md_count[1]);
#endif #endif
err:
EVP_MD_CTX_cleanup(&m);
} }
static void ssleay_rand_seed(const void *buf, int num) static void ssleay_rand_seed(const void *buf, int num)
@ -469,15 +476,18 @@ int ssleay_rand_bytes(unsigned char *buf, int num, int pseudo, int lock)
/* num_ceil -= MD_DIGEST_LENGTH/2 */ /* num_ceil -= MD_DIGEST_LENGTH/2 */
j = (num >= MD_DIGEST_LENGTH / 2) ? MD_DIGEST_LENGTH / 2 : num; j = (num >= MD_DIGEST_LENGTH / 2) ? MD_DIGEST_LENGTH / 2 : num;
num -= j; num -= j;
MD_Init(&m); if (!MD_Init(&m))
goto err;
#ifndef GETPID_IS_MEANINGLESS #ifndef GETPID_IS_MEANINGLESS
if (curr_pid) { /* just in the first iteration to save time */ if (curr_pid) { /* just in the first iteration to save time */
MD_Update(&m, (unsigned char *)&curr_pid, sizeof curr_pid); if (!MD_Update(&m, (unsigned char *)&curr_pid, sizeof curr_pid))
goto err;
curr_pid = 0; curr_pid = 0;
} }
#endif #endif
MD_Update(&m, local_md, MD_DIGEST_LENGTH); if (!MD_Update(&m, local_md, MD_DIGEST_LENGTH) ||
MD_Update(&m, (unsigned char *)&(md_c[0]), sizeof(md_c)); !MD_Update(&m, (unsigned char *)&(md_c[0]), sizeof(md_c)))
goto err;
#ifndef PURIFY /* purify complains */ #ifndef PURIFY /* purify complains */
/* /*
@ -487,16 +497,21 @@ int ssleay_rand_bytes(unsigned char *buf, int num, int pseudo, int lock)
* builds it is not used: the removal of such a small source of * builds it is not used: the removal of such a small source of
* entropy has negligible impact on security. * entropy has negligible impact on security.
*/ */
MD_Update(&m, buf, j); if (!MD_Update(&m, buf, j))
goto err;
#endif #endif
k = (st_idx + MD_DIGEST_LENGTH / 2) - st_num; k = (st_idx + MD_DIGEST_LENGTH / 2) - st_num;
if (k > 0) { if (k > 0) {
MD_Update(&m, &(state[st_idx]), MD_DIGEST_LENGTH / 2 - k); if (!MD_Update(&m, &(state[st_idx]), MD_DIGEST_LENGTH / 2 - k) ||
MD_Update(&m, &(state[0]), k); !MD_Update(&m, &(state[0]), k))
} else goto err;
MD_Update(&m, &(state[st_idx]), MD_DIGEST_LENGTH / 2); } else {
MD_Final(&m, local_md); if (!MD_Update(&m, &(state[st_idx]), MD_DIGEST_LENGTH / 2))
goto err;
}
if (!MD_Final(&m, local_md))
goto err;
for (i = 0; i < MD_DIGEST_LENGTH / 2; i++) { for (i = 0; i < MD_DIGEST_LENGTH / 2; i++) {
/* may compete with other threads */ /* may compete with other threads */
@ -508,13 +523,18 @@ int ssleay_rand_bytes(unsigned char *buf, int num, int pseudo, int lock)
} }
} }
MD_Init(&m); if (!MD_Init(&m) ||
MD_Update(&m, (unsigned char *)&(md_c[0]), sizeof(md_c)); !MD_Update(&m, (unsigned char *)&(md_c[0]), sizeof(md_c)) ||
MD_Update(&m, local_md, MD_DIGEST_LENGTH); !MD_Update(&m, local_md, MD_DIGEST_LENGTH))
goto err;
if (lock) if (lock)
CRYPTO_w_lock(CRYPTO_LOCK_RAND); CRYPTO_w_lock(CRYPTO_LOCK_RAND);
MD_Update(&m, md, MD_DIGEST_LENGTH); if (!MD_Update(&m, md, MD_DIGEST_LENGTH) ||
MD_Final(&m, md); !MD_Final(&m, md)) {
if (lock)
CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
goto err;
}
if (lock) if (lock)
CRYPTO_w_unlock(CRYPTO_LOCK_RAND); CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
@ -529,6 +549,10 @@ int ssleay_rand_bytes(unsigned char *buf, int num, int pseudo, int lock)
"http://www.openssl.org/support/faq.html"); "http://www.openssl.org/support/faq.html");
return (0); return (0);
} }
err:
EVP_MD_CTX_cleanup(&m);
return (0);
} }
static int ssleay_rand_nopseudo_bytes(unsigned char *buf, int num) static int ssleay_rand_nopseudo_bytes(unsigned char *buf, int num)

2
deps/openssl/openssl/crypto/rc4/Makefile

@ -100,7 +100,7 @@ dclean:
mv -f Makefile.new $(MAKEFILE) mv -f Makefile.new $(MAKEFILE)
clean: clean:
rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff rm -f *.s *.S *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
# DO NOT DELETE THIS LINE -- make depend depends on it. # DO NOT DELETE THIS LINE -- make depend depends on it.

9
deps/openssl/openssl/crypto/rsa/rsa_pmeth.c

@ -446,19 +446,14 @@ static int pkey_rsa_decrypt(EVP_PKEY_CTX *ctx,
int ret; int ret;
RSA_PKEY_CTX *rctx = ctx->data; RSA_PKEY_CTX *rctx = ctx->data;
if (rctx->pad_mode == RSA_PKCS1_OAEP_PADDING) { if (rctx->pad_mode == RSA_PKCS1_OAEP_PADDING) {
int i;
if (!setup_tbuf(rctx, ctx)) if (!setup_tbuf(rctx, ctx))
return -1; return -1;
ret = RSA_private_decrypt(inlen, in, rctx->tbuf, ret = RSA_private_decrypt(inlen, in, rctx->tbuf,
ctx->pkey->pkey.rsa, RSA_NO_PADDING); ctx->pkey->pkey.rsa, RSA_NO_PADDING);
if (ret <= 0) if (ret <= 0)
return ret; return ret;
for (i = 0; i < ret; i++) { ret = RSA_padding_check_PKCS1_OAEP_mgf1(out, ret, rctx->tbuf,
if (rctx->tbuf[i]) ret, ret,
break;
}
ret = RSA_padding_check_PKCS1_OAEP_mgf1(out, ret, rctx->tbuf + i,
ret - i, ret,
rctx->oaep_label, rctx->oaep_label,
rctx->oaep_labellen, rctx->oaep_labellen,
rctx->md, rctx->mgf1md); rctx->md, rctx->mgf1md);

13
deps/openssl/openssl/crypto/rsa/rsa_pss.c

@ -122,7 +122,11 @@ int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash,
EM++; EM++;
emLen--; emLen--;
} }
if (emLen < (hLen + sLen + 2)) { /* sLen can be small negative */ if (emLen < hLen + 2) {
RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, RSA_R_DATA_TOO_LARGE);
goto err;
}
if (sLen > emLen - hLen - 2) { /* sLen can be small negative */
RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, RSA_R_DATA_TOO_LARGE); RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, RSA_R_DATA_TOO_LARGE);
goto err; goto err;
} }
@ -222,9 +226,14 @@ int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM,
*EM++ = 0; *EM++ = 0;
emLen--; emLen--;
} }
if (emLen < hLen + 2) {
RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1,
RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
goto err;
}
if (sLen == -2) { if (sLen == -2) {
sLen = emLen - hLen - 2; sLen = emLen - hLen - 2;
} else if (emLen < (hLen + sLen + 2)) { } else if (sLen > emLen - hLen - 2) {
RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1, RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1,
RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE); RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
goto err; goto err;

2
deps/openssl/openssl/crypto/sha/Makefile

@ -135,7 +135,7 @@ dclean:
mv -f Makefile.new $(MAKEFILE) mv -f Makefile.new $(MAKEFILE)
clean: clean:
rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff rm -f *.s *.S *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
# DO NOT DELETE THIS LINE -- make depend depends on it. # DO NOT DELETE THIS LINE -- make depend depends on it.

7
deps/openssl/openssl/crypto/srp/srp_vfy.c

@ -86,10 +86,13 @@ static int t_fromb64(unsigned char *a, size_t alen, const char *src)
int i, j; int i, j;
int size; int size;
if (alen == 0 || alen > INT_MAX)
return -1;
while (*src && (*src == ' ' || *src == '\t' || *src == '\n')) while (*src && (*src == ' ' || *src == '\t' || *src == '\n'))
++src; ++src;
size = strlen(src); size = strlen(src);
if (alen > INT_MAX || size > (int)alen) if (size < 0 || size >= (int)alen)
return -1; return -1;
i = 0; i = 0;
@ -127,7 +130,7 @@ static int t_fromb64(unsigned char *a, size_t alen, const char *src)
if (--i < 0) if (--i < 0)
break; break;
} }
while (a[j] == 0 && j <= size) while (j <= size && a[j] == 0)
++j; ++j;
i = 0; i = 0;
while (j <= size) while (j <= size)

32
deps/openssl/openssl/crypto/txt_db/txt_db.c

@ -162,6 +162,7 @@ TXT_DB *TXT_DB_read(BIO *in, int num)
"wrong number of fields on line %ld (looking for field %d, got %d, '%s' left)\n", "wrong number of fields on line %ld (looking for field %d, got %d, '%s' left)\n",
ln, num, n, f); ln, num, n, f);
#endif #endif
OPENSSL_free(pp);
er = 2; er = 2;
goto err; goto err;
} }
@ -171,6 +172,7 @@ TXT_DB *TXT_DB_read(BIO *in, int num)
* fix :-( */ * fix :-( */
fprintf(stderr, "failure in sk_push\n"); fprintf(stderr, "failure in sk_push\n");
#endif #endif
OPENSSL_free(pp);
er = 2; er = 2;
goto err; goto err;
} }
@ -222,7 +224,7 @@ int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *),
LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp) LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp)
{ {
LHASH_OF(OPENSSL_STRING) *idx; LHASH_OF(OPENSSL_STRING) *idx;
OPENSSL_STRING *r; OPENSSL_STRING *r, *k;
int i, n; int i, n;
if (field >= db->num_fields) { if (field >= db->num_fields) {
@ -239,13 +241,18 @@ int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *),
r = sk_OPENSSL_PSTRING_value(db->data, i); r = sk_OPENSSL_PSTRING_value(db->data, i);
if ((qual != NULL) && (qual(r) == 0)) if ((qual != NULL) && (qual(r) == 0))
continue; continue;
if ((r = lh_OPENSSL_STRING_insert(idx, r)) != NULL) { if ((k = lh_OPENSSL_STRING_insert(idx, r)) != NULL) {
db->error = DB_ERROR_INDEX_CLASH; db->error = DB_ERROR_INDEX_CLASH;
db->arg1 = sk_OPENSSL_PSTRING_find(db->data, r); db->arg1 = sk_OPENSSL_PSTRING_find(db->data, k);
db->arg2 = i; db->arg2 = i;
lh_OPENSSL_STRING_free(idx); lh_OPENSSL_STRING_free(idx);
return (0); return (0);
} }
if (lh_OPENSSL_STRING_retrieve(idx, r) == NULL) {
db->error = DB_ERROR_MALLOC;
lh_OPENSSL_STRING_free(idx);
return (0);
}
} }
if (db->index[field] != NULL) if (db->index[field] != NULL)
lh_OPENSSL_STRING_free(db->index[field]); lh_OPENSSL_STRING_free(db->index[field]);
@ -320,20 +327,29 @@ int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *row)
} }
} }
} }
/* We have passed the index checks, now just append and insert */
if (!sk_OPENSSL_PSTRING_push(db->data, row)) {
db->error = DB_ERROR_MALLOC;
goto err;
}
for (i = 0; i < db->num_fields; i++) { for (i = 0; i < db->num_fields; i++) {
if (db->index[i] != NULL) { if (db->index[i] != NULL) {
if ((db->qual[i] != NULL) && (db->qual[i] (row) == 0)) if ((db->qual[i] != NULL) && (db->qual[i] (row) == 0))
continue; continue;
(void)lh_OPENSSL_STRING_insert(db->index[i], row); (void)lh_OPENSSL_STRING_insert(db->index[i], row);
if (lh_OPENSSL_STRING_retrieve(db->index[i], row) == NULL)
goto err1;
} }
} }
if (!sk_OPENSSL_PSTRING_push(db->data, row))
goto err1;
return (1); return (1);
err1:
db->error = DB_ERROR_MALLOC;
while (i-- > 0) {
if (db->index[i] != NULL) {
if ((db->qual[i] != NULL) && (db->qual[i] (row) == 0))
continue;
(void)lh_OPENSSL_STRING_delete(db->index[i], row);
}
}
err: err:
return (0); return (0);
} }

1
deps/openssl/openssl/crypto/ui/ui_lib.c

@ -747,7 +747,6 @@ const char *UI_get0_action_string(UI_STRING *uis)
if (!uis) if (!uis)
return NULL; return NULL;
switch (uis->type) { switch (uis->type) {
case UIT_PROMPT:
case UIT_BOOLEAN: case UIT_BOOLEAN:
return uis->_.boolean_data.action_desc; return uis->_.boolean_data.action_desc;
default: default:

41
deps/openssl/openssl/crypto/x509/x509_lu.c

@ -185,14 +185,16 @@ X509_STORE *X509_STORE_new(void)
if ((ret = (X509_STORE *)OPENSSL_malloc(sizeof(X509_STORE))) == NULL) if ((ret = (X509_STORE *)OPENSSL_malloc(sizeof(X509_STORE))) == NULL)
return NULL; return NULL;
ret->objs = sk_X509_OBJECT_new(x509_object_cmp); if ((ret->objs = sk_X509_OBJECT_new(x509_object_cmp)) == NULL)
goto err0;
ret->cache = 1; ret->cache = 1;
ret->get_cert_methods = sk_X509_LOOKUP_new_null(); if ((ret->get_cert_methods = sk_X509_LOOKUP_new_null()) == NULL)
goto err1;
ret->verify = 0; ret->verify = 0;
ret->verify_cb = 0; ret->verify_cb = 0;
if ((ret->param = X509_VERIFY_PARAM_new()) == NULL) if ((ret->param = X509_VERIFY_PARAM_new()) == NULL)
return NULL; goto err2;
ret->get_issuer = 0; ret->get_issuer = 0;
ret->check_issued = 0; ret->check_issued = 0;
@ -204,14 +206,21 @@ X509_STORE *X509_STORE_new(void)
ret->lookup_crls = 0; ret->lookup_crls = 0;
ret->cleanup = 0; ret->cleanup = 0;
if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE, ret, &ret->ex_data)) { if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE, ret, &ret->ex_data))
sk_X509_OBJECT_free(ret->objs); goto err3;
OPENSSL_free(ret);
return NULL;
}
ret->references = 1; ret->references = 1;
return ret; return ret;
err3:
X509_VERIFY_PARAM_free(ret->param);
err2:
sk_X509_LOOKUP_free(ret->get_cert_methods);
err1:
sk_X509_OBJECT_free(ret->objs);
err0:
OPENSSL_free(ret);
return NULL;
} }
static void cleanup(X509_OBJECT *a) static void cleanup(X509_OBJECT *a)
@ -360,8 +369,12 @@ int X509_STORE_add_cert(X509_STORE *ctx, X509 *x)
X509err(X509_F_X509_STORE_ADD_CERT, X509err(X509_F_X509_STORE_ADD_CERT,
X509_R_CERT_ALREADY_IN_HASH_TABLE); X509_R_CERT_ALREADY_IN_HASH_TABLE);
ret = 0; ret = 0;
} else } else if (!sk_X509_OBJECT_push(ctx->objs, obj)) {
sk_X509_OBJECT_push(ctx->objs, obj); X509_OBJECT_free_contents(obj);
OPENSSL_free(obj);
X509err(X509_F_X509_STORE_ADD_CERT, ERR_R_MALLOC_FAILURE);
ret = 0;
}
CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
@ -392,8 +405,12 @@ int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x)
OPENSSL_free(obj); OPENSSL_free(obj);
X509err(X509_F_X509_STORE_ADD_CRL, X509_R_CERT_ALREADY_IN_HASH_TABLE); X509err(X509_F_X509_STORE_ADD_CRL, X509_R_CERT_ALREADY_IN_HASH_TABLE);
ret = 0; ret = 0;
} else } else if (!sk_X509_OBJECT_push(ctx->objs, obj)) {
sk_X509_OBJECT_push(ctx->objs, obj); X509_OBJECT_free_contents(obj);
OPENSSL_free(obj);
X509err(X509_F_X509_STORE_ADD_CRL, ERR_R_MALLOC_FAILURE);
ret = 0;
}
CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);

32
deps/openssl/openssl/crypto/x509v3/v3_alt.c

@ -119,32 +119,39 @@ STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method,
int i; int i;
switch (gen->type) { switch (gen->type) {
case GEN_OTHERNAME: case GEN_OTHERNAME:
X509V3_add_value("othername", "<unsupported>", &ret); if (!X509V3_add_value("othername", "<unsupported>", &ret))
return NULL;
break; break;
case GEN_X400: case GEN_X400:
X509V3_add_value("X400Name", "<unsupported>", &ret); if (!X509V3_add_value("X400Name", "<unsupported>", &ret))
return NULL;
break; break;
case GEN_EDIPARTY: case GEN_EDIPARTY:
X509V3_add_value("EdiPartyName", "<unsupported>", &ret); if (!X509V3_add_value("EdiPartyName", "<unsupported>", &ret))
return NULL;
break; break;
case GEN_EMAIL: case GEN_EMAIL:
X509V3_add_value_uchar("email", gen->d.ia5->data, &ret); if (!X509V3_add_value_uchar("email", gen->d.ia5->data, &ret))
return NULL;
break; break;
case GEN_DNS: case GEN_DNS:
X509V3_add_value_uchar("DNS", gen->d.ia5->data, &ret); if (!X509V3_add_value_uchar("DNS", gen->d.ia5->data, &ret))
return NULL;
break; break;
case GEN_URI: case GEN_URI:
X509V3_add_value_uchar("URI", gen->d.ia5->data, &ret); if (!X509V3_add_value_uchar("URI", gen->d.ia5->data, &ret))
return NULL;
break; break;
case GEN_DIRNAME: case GEN_DIRNAME:
X509_NAME_oneline(gen->d.dirn, oline, 256); if (X509_NAME_oneline(gen->d.dirn, oline, 256) == NULL
X509V3_add_value("DirName", oline, &ret); || !X509V3_add_value("DirName", oline, &ret))
return NULL;
break; break;
case GEN_IPADD: case GEN_IPADD:
@ -162,15 +169,18 @@ STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method,
strcat(oline, ":"); strcat(oline, ":");
} }
} else { } else {
X509V3_add_value("IP Address", "<invalid>", &ret); if (!X509V3_add_value("IP Address", "<invalid>", &ret))
return NULL;
break; break;
} }
X509V3_add_value("IP Address", oline, &ret); if (!X509V3_add_value("IP Address", oline, &ret))
return NULL;
break; break;
case GEN_RID: case GEN_RID:
i2t_ASN1_OBJECT(oline, 256, gen->d.rid); i2t_ASN1_OBJECT(oline, 256, gen->d.rid);
X509V3_add_value("Registered ID", oline, &ret); if (!X509V3_add_value("Registered ID", oline, &ret))
return NULL;
break; break;
} }
return ret; return ret;

14
deps/openssl/openssl/crypto/x509v3/v3_cpols.c

@ -390,10 +390,10 @@ static int nref_nos(STACK_OF(ASN1_INTEGER) *nnums, STACK_OF(CONF_VALUE) *nos)
return 1; return 1;
merr: merr:
ASN1_INTEGER_free(aint);
X509V3err(X509V3_F_NREF_NOS, ERR_R_MALLOC_FAILURE); X509V3err(X509V3_F_NREF_NOS, ERR_R_MALLOC_FAILURE);
err: err:
sk_ASN1_INTEGER_pop_free(nnums, ASN1_STRING_free);
return 0; return 0;
} }
@ -458,9 +458,15 @@ static void print_notice(BIO *out, USERNOTICE *notice, int indent)
num = sk_ASN1_INTEGER_value(ref->noticenos, i); num = sk_ASN1_INTEGER_value(ref->noticenos, i);
if (i) if (i)
BIO_puts(out, ", "); BIO_puts(out, ", ");
tmp = i2s_ASN1_INTEGER(NULL, num); if (num == NULL)
BIO_puts(out, tmp); BIO_puts(out, "(null)");
OPENSSL_free(tmp); else {
tmp = i2s_ASN1_INTEGER(NULL, num);
if (tmp == NULL)
return;
BIO_puts(out, tmp);
OPENSSL_free(tmp);
}
} }
BIO_puts(out, "\n"); BIO_puts(out, "\n");
} }

37
deps/openssl/openssl/crypto/x509v3/v3_info.c

@ -107,29 +107,30 @@ ASN1_ITEM_TEMPLATE_END(AUTHORITY_INFO_ACCESS)
IMPLEMENT_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS) IMPLEMENT_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS)
static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS(
*method, AUTHORITY_INFO_ACCESS X509V3_EXT_METHOD *method, AUTHORITY_INFO_ACCESS *ainfo,
*ainfo, STACK_OF(CONF_VALUE) STACK_OF(CONF_VALUE) *ret)
*ret)
{ {
ACCESS_DESCRIPTION *desc; ACCESS_DESCRIPTION *desc;
int i, nlen; int i, nlen;
char objtmp[80], *ntmp; char objtmp[80], *ntmp;
CONF_VALUE *vtmp; CONF_VALUE *vtmp;
STACK_OF(CONF_VALUE) *tret = ret;
for (i = 0; i < sk_ACCESS_DESCRIPTION_num(ainfo); i++) { for (i = 0; i < sk_ACCESS_DESCRIPTION_num(ainfo); i++) {
STACK_OF(CONF_VALUE) *tmp;
desc = sk_ACCESS_DESCRIPTION_value(ainfo, i); desc = sk_ACCESS_DESCRIPTION_value(ainfo, i);
ret = i2v_GENERAL_NAME(method, desc->location, ret); tmp = i2v_GENERAL_NAME(method, desc->location, tret);
if (!ret) if (tmp == NULL)
break; goto err;
vtmp = sk_CONF_VALUE_value(ret, i); tret = tmp;
vtmp = sk_CONF_VALUE_value(tret, i);
i2t_ASN1_OBJECT(objtmp, sizeof objtmp, desc->method); i2t_ASN1_OBJECT(objtmp, sizeof objtmp, desc->method);
nlen = strlen(objtmp) + strlen(vtmp->name) + 5; nlen = strlen(objtmp) + strlen(vtmp->name) + 5;
ntmp = OPENSSL_malloc(nlen); ntmp = OPENSSL_malloc(nlen);
if (!ntmp) { if (ntmp == NULL)
X509V3err(X509V3_F_I2V_AUTHORITY_INFO_ACCESS, goto err;
ERR_R_MALLOC_FAILURE);
return NULL;
}
BUF_strlcpy(ntmp, objtmp, nlen); BUF_strlcpy(ntmp, objtmp, nlen);
BUF_strlcat(ntmp, " - ", nlen); BUF_strlcat(ntmp, " - ", nlen);
BUF_strlcat(ntmp, vtmp->name, nlen); BUF_strlcat(ntmp, vtmp->name, nlen);
@ -137,9 +138,15 @@ static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD
vtmp->name = ntmp; vtmp->name = ntmp;
} }
if (!ret) if (ret == NULL && tret == NULL)
return sk_CONF_VALUE_new_null(); return sk_CONF_VALUE_new_null();
return ret;
return tret;
err:
X509V3err(X509V3_F_I2V_AUTHORITY_INFO_ACCESS, ERR_R_MALLOC_FAILURE);
if (ret == NULL && tret != NULL)
sk_CONF_VALUE_pop_free(tret, X509V3_conf_free);
return NULL;
} }
static AUTHORITY_INFO_ACCESS *v2i_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD static AUTHORITY_INFO_ACCESS *v2i_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD

1
deps/openssl/openssl/crypto/x509v3/v3_purp.c

@ -321,6 +321,7 @@ int X509_supported_extension(X509_EXTENSION *ex)
NID_subject_alt_name, /* 85 */ NID_subject_alt_name, /* 85 */
NID_basic_constraints, /* 87 */ NID_basic_constraints, /* 87 */
NID_certificate_policies, /* 89 */ NID_certificate_policies, /* 89 */
NID_crl_distribution_points, /* 103 */
NID_ext_key_usage, /* 126 */ NID_ext_key_usage, /* 126 */
#ifndef OPENSSL_NO_RFC3779 #ifndef OPENSSL_NO_RFC3779
NID_sbgp_ipAddrBlock, /* 290 */ NID_sbgp_ipAddrBlock, /* 290 */

19
deps/openssl/openssl/crypto/x86_64cpuid.pl

@ -59,7 +59,7 @@ OPENSSL_ia32_cpuid:
mov %rbx,%r8 # save %rbx mov %rbx,%r8 # save %rbx
xor %eax,%eax xor %eax,%eax
mov %eax,8(%rdi) # clear 3rd word mov %eax,8(%rdi) # clear extended feature flags
cpuid cpuid
mov %eax,%r11d # max value for standard query level mov %eax,%r11d # max value for standard query level
@ -127,14 +127,6 @@ OPENSSL_ia32_cpuid:
shr \$14,%r10d shr \$14,%r10d
and \$0xfff,%r10d # number of cores -1 per L1D and \$0xfff,%r10d # number of cores -1 per L1D
cmp \$7,%r11d
jb .Lnocacheinfo
mov \$7,%eax
xor %ecx,%ecx
cpuid
mov %ebx,8(%rdi)
.Lnocacheinfo: .Lnocacheinfo:
mov \$1,%eax mov \$1,%eax
cpuid cpuid
@ -164,6 +156,15 @@ OPENSSL_ia32_cpuid:
or %ecx,%r9d # merge AMD XOP flag or %ecx,%r9d # merge AMD XOP flag
mov %edx,%r10d # %r9d:%r10d is copy of %ecx:%edx mov %edx,%r10d # %r9d:%r10d is copy of %ecx:%edx
cmp \$7,%r11d
jb .Lno_extended_info
mov \$7,%eax
xor %ecx,%ecx
cpuid
mov %ebx,8(%rdi) # save extended feature flags
.Lno_extended_info:
bt \$27,%r9d # check OSXSAVE bit bt \$27,%r9d # check OSXSAVE bit
jnc .Lclear_avx jnc .Lclear_avx
xor %ecx,%ecx # XCR0 xor %ecx,%ecx # XCR0

38
deps/openssl/openssl/crypto/x86cpuid.pl

@ -20,10 +20,10 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); }
&pop ("eax"); &pop ("eax");
&xor ("ecx","eax"); &xor ("ecx","eax");
&xor ("eax","eax"); &xor ("eax","eax");
&mov ("esi",&wparam(0));
&mov (&DWP(8,"esi"),"eax"); # clear extended feature flags
&bt ("ecx",21); &bt ("ecx",21);
&jnc (&label("nocpuid")); &jnc (&label("nocpuid"));
&mov ("esi",&wparam(0));
&mov (&DWP(8,"esi"),"eax"); # clear 3rd word
&cpuid (); &cpuid ();
&mov ("edi","eax"); # max value for standard query level &mov ("edi","eax"); # max value for standard query level
@ -81,26 +81,16 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); }
&jmp (&label("generic")); &jmp (&label("generic"));
&set_label("intel"); &set_label("intel");
&cmp ("edi",7);
&jb (&label("cacheinfo"));
&mov ("esi",&wparam(0));
&mov ("eax",7);
&xor ("ecx","ecx");
&cpuid ();
&mov (&DWP(8,"esi"),"ebx");
&set_label("cacheinfo");
&cmp ("edi",4); &cmp ("edi",4);
&mov ("edi",-1); &mov ("esi",-1);
&jb (&label("nocacheinfo")); &jb (&label("nocacheinfo"));
&mov ("eax",4); &mov ("eax",4);
&mov ("ecx",0); # query L1D &mov ("ecx",0); # query L1D
&cpuid (); &cpuid ();
&mov ("edi","eax"); &mov ("esi","eax");
&shr ("edi",14); &shr ("esi",14);
&and ("edi",0xfff); # number of cores -1 per L1D &and ("esi",0xfff); # number of cores -1 per L1D
&set_label("nocacheinfo"); &set_label("nocacheinfo");
&mov ("eax",1); &mov ("eax",1);
@ -118,7 +108,7 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); }
&bt ("edx",28); # test hyper-threading bit &bt ("edx",28); # test hyper-threading bit
&jnc (&label("generic")); &jnc (&label("generic"));
&and ("edx",0xefffffff); &and ("edx",0xefffffff);
&cmp ("edi",0); &cmp ("esi",0);
&je (&label("generic")); &je (&label("generic"));
&or ("edx",0x10000000); &or ("edx",0x10000000);
@ -130,10 +120,19 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); }
&set_label("generic"); &set_label("generic");
&and ("ebp",1<<11); # isolate AMD XOP flag &and ("ebp",1<<11); # isolate AMD XOP flag
&and ("ecx",0xfffff7ff); # force 11th bit to 0 &and ("ecx",0xfffff7ff); # force 11th bit to 0
&mov ("esi","edx"); &mov ("esi","edx"); # %ebp:%esi is copy of %ecx:%edx
&or ("ebp","ecx"); # merge AMD XOP flag &or ("ebp","ecx"); # merge AMD XOP flag
&bt ("ecx",27); # check OSXSAVE bit &cmp ("edi",7);
&mov ("edi",&wparam(0));
&jb (&label("no_extended_info"));
&mov ("eax",7);
&xor ("ecx","ecx");
&cpuid ();
&mov (&DWP(8,"edi"),"ebx"); # save extended feature flag
&set_label("no_extended_info");
&bt ("ebp",27); # check OSXSAVE bit
&jnc (&label("clear_avx")); &jnc (&label("clear_avx"));
&xor ("ecx","ecx"); &xor ("ecx","ecx");
&data_byte(0x0f,0x01,0xd0); # xgetbv &data_byte(0x0f,0x01,0xd0); # xgetbv
@ -147,7 +146,6 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); }
&and ("esi",0xfeffffff); # clear FXSR &and ("esi",0xfeffffff); # clear FXSR
&set_label("clear_avx"); &set_label("clear_avx");
&and ("ebp",0xefffe7ff); # clear AVX, FMA and AMD XOP bits &and ("ebp",0xefffe7ff); # clear AVX, FMA and AMD XOP bits
&mov ("edi",&wparam(0));
&and (&DWP(8,"edi"),0xffffffdf); # clear AVX2 &and (&DWP(8,"edi"),0xffffffdf); # clear AVX2
&set_label("done"); &set_label("done");
&mov ("eax","esi"); &mov ("eax","esi");

0
deps/openssl/openssl/doc-nits

3
deps/openssl/openssl/doc/apps/ciphers.pod

@ -179,7 +179,8 @@ When in doubt, include B<!aNULL> in your cipherlist.
=item B<kRSA>, B<RSA> =item B<kRSA>, B<RSA>
cipher suites using RSA key exchange. cipher suites using RSA key exchange or authentication. B<RSA> is an alias for
B<kRSA>.
=item B<kDHr>, B<kDHd>, B<kDH> =item B<kDHr>, B<kDHd>, B<kDH>

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save