oweals/openssl.git
8 years agoConstify X509V3_EXT_*_conf*
FdaSilvaYY [Sat, 14 May 2016 21:09:34 +0000 (23:09 +0200)]
Constify X509V3_EXT_*_conf*

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1074)

8 years agoConstify ASN1_generate_nconf
FdaSilvaYY [Sat, 14 May 2016 21:18:49 +0000 (23:18 +0200)]
Constify ASN1_generate_nconf

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1074)

8 years agoConstify ASN1_generate_v3
FdaSilvaYY [Sat, 14 May 2016 20:23:55 +0000 (22:23 +0200)]
Constify ASN1_generate_v3

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1074)

8 years agoConstify s2i_ASN1_IA5STRING
FdaSilvaYY [Sat, 14 May 2016 21:03:22 +0000 (23:03 +0200)]
Constify s2i_ASN1_IA5STRING

Return directly NULL after ASN1_STRING_set, as it already has set an error code.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1074)

8 years agoConstify s2i_ASN1_INTEGER
FdaSilvaYY [Sat, 14 May 2016 06:59:16 +0000 (08:59 +0200)]
Constify s2i_ASN1_INTEGER

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1074)

8 years agoConstify X509_OBJECT_get_type & X509_OBJECT_get0_X509
FdaSilvaYY [Sat, 14 May 2016 06:58:28 +0000 (08:58 +0200)]
Constify X509_OBJECT_get_type & X509_OBJECT_get0_X509

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1074)

8 years agoClean away the last unixmake vestiges
Richard Levitte [Sat, 4 Jun 2016 18:35:58 +0000 (20:35 +0200)]
Clean away the last unixmake vestiges

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix re-used function code
Rich Salz [Sat, 4 Jun 2016 16:28:08 +0000 (12:28 -0400)]
Fix re-used function code

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoIgnore buildtest artifacts.
Rich Salz [Sat, 4 Jun 2016 12:23:11 +0000 (08:23 -0400)]
Ignore buildtest artifacts.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoAdd developer targets for each subdirectory we have something to build in
Richard Levitte [Sat, 2 Apr 2016 20:26:38 +0000 (22:26 +0200)]
Add developer targets for each subdirectory we have something to build in

Previous build scheme allowed building just the stuff in one
subdirectory, like this:

    make -C crypto/aes

Because the unified only has a top-level Makefile, this is not
possible with it.  This change adds a replacement where each directory
we have something to build in becomes a target in its own right,
allowing building something like this:

    make crypto/aes

The exception is the directory test, because we already have such a
target.

Reviewed-by: Stephen Henson <steve@openssl.org>
8 years agoSpecifiy size of arrays
Kurt Roeckx [Fri, 27 May 2016 19:10:05 +0000 (21:10 +0200)]
Specifiy size of arrays

Reviewed-by: Rich Salz <rsalz@openssl.org>
GH: #1139

8 years agoCheck for overflows in EOC.
Dr. Stephen Henson [Sat, 4 Jun 2016 11:48:00 +0000 (12:48 +0100)]
Check for overflows in EOC.

RT#4474 (partial)

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd support for fuzzing with AFL
Kurt Roeckx [Sat, 7 May 2016 20:09:13 +0000 (22:09 +0200)]
Add support for fuzzing with AFL

Reviewed-by: Ben Laurie <ben@links.org>
MR: #2740

8 years agoRT3895: Remove fprintf's from SSL library.
Rich Salz [Sat, 4 Jun 2016 02:45:47 +0000 (22:45 -0400)]
RT3895: Remove fprintf's from SSL library.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoMore utils cleanup.
Rich Salz [Fri, 3 Jun 2016 18:49:20 +0000 (14:49 -0400)]
More utils cleanup.

Remove some unused files.
Rename doc-nit-check to be consistent.
Add check for multiple #include in synopsis.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoMake 25-test_gen.t and 25-test_req.t into one
Richard Levitte [Fri, 3 Jun 2016 23:05:06 +0000 (01:05 +0200)]
Make 25-test_gen.t and 25-test_req.t into one

Since one generates files that the other depends on, there's no
real reason to keep them separate.  Since they were both different
aspects of 'openssl req', the merge ends up in 25-test_req.t.

This also makes cleanup easier.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoHave some more test recipes clean up after themselves
Richard Levitte [Fri, 3 Jun 2016 22:50:17 +0000 (00:50 +0200)]
Have some more test recipes clean up after themselves

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoWindows build: Remove .manifest files in test/ as well
Richard Levitte [Fri, 3 Jun 2016 22:48:13 +0000 (00:48 +0200)]
Windows build: Remove .manifest files in test/ as well

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoChange inclusion of sys/types.h to stdlib.h in include/openssl/ebcdic.h
Richard Levitte [Fri, 3 Jun 2016 18:28:39 +0000 (20:28 +0200)]
Change inclusion of sys/types.h to stdlib.h in include/openssl/ebcdic.h

Needed to get size_t on Windows

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd inclusion of stdlib.h in include/openssl/mdc2.h
Richard Levitte [Fri, 3 Jun 2016 13:04:22 +0000 (15:04 +0200)]
Add inclusion of stdlib.h in include/openssl/mdc2.h

Needed to get size_t

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd inclusion of openssl/x509.h in include/openssl/tls1.h
Richard Levitte [Fri, 3 Jun 2016 13:05:03 +0000 (15:05 +0200)]
Add inclusion of openssl/x509.h in include/openssl/tls1.h

Needed to get the needed declarations for STACK_OF(X509)

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoGenerate simple build test files
Richard Levitte [Fri, 3 Jun 2016 13:02:10 +0000 (15:02 +0200)]
Generate simple build test files

Generate small test programs to check that external programs can be
built with our stuff at a very basic level.

For now, they check that each of our header files can be included
individually without compile failure.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix documentation error in x509 app certopt flag
Matt Caswell [Fri, 3 Jun 2016 20:49:01 +0000 (21:49 +0100)]
Fix documentation error in x509 app certopt flag

According to the x509 man page in the section discussing -certopt it says
that the ca_default option is the same as that used by the ca utility and
(amongst other things) has the effect of suppressing printing of the
signature - but in fact it doesn't. This error seems to have been present
since the documentation was written back in 2001. It never had this effect.

The default config file sets the certopt value to ca_default. The ca utility
takes that and THEN adds additional options to suppress printing of the
signature. So the ca utility DOES suppress printing of the signature - but
it is not as a result of using the ca_default option.

GitHub Issue #247

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoBIO_printf() can fail to print the last character
Matt Caswell [Fri, 3 Jun 2016 14:53:54 +0000 (15:53 +0100)]
BIO_printf() can fail to print the last character

If the string to print is exactly 2048 character long (excluding the NULL
terminator) then BIO_printf will chop off the last byte. This is because
it has filled its static buffer but hasn't yet allocated a dynamic buffer.
In cases where we don't have a dynamic buffer we need to truncate but that
is not the case for BIO_printf(). We need to check whether we are able to
have a dynamic buffer buffer deciding to truncate.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agocryptodev_asym, zapparams: use OPENSSL_* allocation routines, handle errors
Jonas Maebe [Sun, 8 Dec 2013 16:24:18 +0000 (17:24 +0100)]
cryptodev_asym, zapparams: use OPENSSL_* allocation routines, handle errors

zapparams modification based on tip from Matt Caswell

RT#3198

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoHandle a memory allocation failure in ssl3_init_finished_mac()
Matt Caswell [Fri, 3 Jun 2016 10:59:19 +0000 (11:59 +0100)]
Handle a memory allocation failure in ssl3_init_finished_mac()

The ssl3_init_finished_mac() function can fail, in which case we need to
propagate the error up through the stack.

RT#3198

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoUpdate INSTALL instructions
Matt Caswell [Thu, 2 Jun 2016 19:18:33 +0000 (20:18 +0100)]
Update INSTALL instructions

Fill out the INSTALL instructions with more information on Configure
arguments, environment variables and Makefile targets.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoAdded define for STATUS_SUCCESS
Mat [Thu, 2 Jun 2016 21:38:56 +0000 (23:38 +0200)]
Added define for STATUS_SUCCESS

Use STATUS_SUCCESS instead of 0.
Renamed USE_BCRYPT to RAND_WINDOWS_USE_BCRYPT to avoid possible collisions with other defines.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1142)

8 years agoAdds casts for 64-bit
Mat [Sun, 29 May 2016 18:44:27 +0000 (20:44 +0200)]
Adds casts for 64-bit

Adds missing casts for 64-bit.
Removed zero initialization of hProvider. hProvider is an "out" parameter of CryptAcquireContextW.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1142)

8 years agoDefine USE_BCRYPT
Mat [Sun, 29 May 2016 18:38:37 +0000 (20:38 +0200)]
Define USE_BCRYPT

Define USE_BCRYPT
Removed _WIN32_WINNT define
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1142)

8 years agoUse BCryptGenRandom on Windows 7 or higher
Mat [Sun, 29 May 2016 18:23:22 +0000 (20:23 +0200)]
Use BCryptGenRandom on Windows 7 or higher

When openssl is compiled with MSVC and _WIN32_WINNT>=0x0601 (Windows 7), BCryptGenRandom is used instead of the legacy CryptoAPI.

This change brings the following benefits:
- Removes dependency on CryptoAPI (legacy API) respectively advapi32.dll
- CryptoAPI Cryptographic Service Providers (rsa full) are not dynamically loaded.
- Allows Universal Windows Platform (UWP) apps to use openssl (CryptGenRandom is not available for Windows store apps)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1142)

8 years agoAdd a paragraph on documentation to CONTRIBUTING
Matt Caswell [Fri, 3 Jun 2016 09:51:13 +0000 (10:51 +0100)]
Add a paragraph on documentation to CONTRIBUTING

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFurther update CONTRIBUTING
Matt Caswell [Fri, 3 Jun 2016 09:42:20 +0000 (10:42 +0100)]
Further update CONTRIBUTING

Tweak to the wording on merge commits.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoTweaks to NOTES.PERL
Matt Caswell [Thu, 2 Jun 2016 10:09:13 +0000 (11:09 +0100)]
Tweaks to NOTES.PERL

Fix some typos and other minor amendments to NOTES.PERL.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoUpdate NOTES.WIN
Matt Caswell [Thu, 2 Jun 2016 10:03:45 +0000 (11:03 +0100)]
Update NOTES.WIN

Make the recommendation for MSYS perl in an MSYS environment more forceful.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoUpdate CONTRIBUTING
Matt Caswell [Thu, 2 Jun 2016 10:03:10 +0000 (11:03 +0100)]
Update CONTRIBUTING

Fix typos and clarify a few things in the CONTRIBUTING file.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoBring the README file up to date
Matt Caswell [Thu, 2 Jun 2016 10:01:32 +0000 (11:01 +0100)]
Bring the README file up to date

The README file was a little out of date so needed a refresh

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFix threading issue that at best will leak memory
Pauli [Fri, 3 Jun 2016 14:52:32 +0000 (10:52 -0400)]
Fix threading issue that at best will leak memory

The problem is the checking in policy_cache_set, there is a race
condition between the null check and obtaining the lock.  The fix is in
policy_cache_new to detect if the creation has happened already.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agotests: clean up temporary SSL session files.
Richard Levitte [Fri, 3 Jun 2016 11:56:20 +0000 (13:56 +0200)]
tests: clean up temporary SSL session files.

RT#4557

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd ct fuzzer.
Ben Laurie [Fri, 3 Jun 2016 10:07:42 +0000 (11:07 +0100)]
Add ct fuzzer.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoLinkify libfuzzer.
Ben Laurie [Thu, 12 May 2016 09:39:43 +0000 (10:39 +0100)]
Linkify libfuzzer.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFuzz everything with every input.
Ben Laurie [Wed, 11 May 2016 15:07:14 +0000 (16:07 +0100)]
Fuzz everything with every input.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoSort.
Ben Laurie [Sat, 7 May 2016 17:58:44 +0000 (18:58 +0100)]
Sort.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoUpdate client authentication tests
Emilia Kasper [Tue, 31 May 2016 14:42:58 +0000 (16:42 +0200)]
Update client authentication tests

Port client auth tests to the new framework, add coverage. The old tests
were only testing success, and only for some protocol versions; the new
tests add all protocol versions and various failure modes.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agochacha/chacha_enc.c: harmonize counter width with subroutine name.
Andy Polyakov [Wed, 27 Apr 2016 13:07:32 +0000 (15:07 +0200)]
chacha/chacha_enc.c: harmonize counter width with subroutine name.

_ctr32 in function name refers to 32-bit counter, but it was implementing
64-bit one. This didn't pose problem to EVP, but 64-bit counter was just
misleading.

RT#4512

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoGH1123: sort dir before rehash
Rich Salz [Wed, 25 May 2016 12:59:10 +0000 (08:59 -0400)]
GH1123: sort dir before rehash

This is needed to generate stable output names/symlinks.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoBuild the 'openssl rehash' command on VMS version 8.3 and up
Richard Levitte [Thu, 2 Jun 2016 18:44:11 +0000 (20:44 +0200)]
Build the 'openssl rehash' command on VMS version 8.3 and up

Include a note in INSTALL that tests must be run from an unprivileged
process.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix test failures when using enable-ubsan
Matt Caswell [Thu, 2 Jun 2016 12:53:49 +0000 (13:53 +0100)]
Fix test failures when using enable-ubsan

Numerous test failures were occuring when Configured with enable-ubsan
although they could all be traced back to one issue.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoTidy up OCSP print handling.
Dr. Stephen Henson [Thu, 26 May 2016 15:57:25 +0000 (16:57 +0100)]
Tidy up OCSP print handling.

Also fixes -Wstrict-oveflow warning on this file.

RT#4474 (partial)

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoperl: refactor .pod name section extractor into its own module
Richard Levitte [Thu, 2 Jun 2016 13:38:16 +0000 (15:38 +0200)]
perl: refactor .pod name section extractor into its own module

Adapt util/process_docs.pl

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd a warning about using enable-crypto-mdebug-backtrace
Richard Levitte [Thu, 2 Jun 2016 10:14:52 +0000 (12:14 +0200)]
Add a warning about using enable-crypto-mdebug-backtrace

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoTesting symbol presence: also take note of small objects
Richard Levitte [Thu, 2 Jun 2016 00:06:25 +0000 (02:06 +0200)]
Testing symbol presence: also take note of small objects

The S symbol class wasn't checked.

Notified by Sebastian Andrzej Siewior

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoRemove NOEXIST entries
Rich Salz [Wed, 1 Jun 2016 15:49:36 +0000 (11:49 -0400)]
Remove NOEXIST entries

checkpoint before release.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoDon't leak memory on set_reasons() error path
Matt Caswell [Thu, 28 Apr 2016 13:00:10 +0000 (14:00 +0100)]
Don't leak memory on set_reasons() error path

The set_reasons() function in v3_crld.c leaks a STACK_OF(CONF_VALUE)
object on an error path.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoDon't leak memory on int X509_PURPOSE_add() error path
Matt Caswell [Thu, 28 Apr 2016 12:53:52 +0000 (13:53 +0100)]
Don't leak memory on int X509_PURPOSE_add() error path

The int X509_PURPOSE_add() function was leaking an X509_PURPOSE object
on error.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoDon't leak memory on X509_TRUST_add() error path
Matt Caswell [Thu, 28 Apr 2016 12:46:31 +0000 (13:46 +0100)]
Don't leak memory on X509_TRUST_add() error path

The X509_TRUST_add() function was leaking an X509_TRUST object on error.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoDon't leak memory on ASN1_item_pack() error path
Matt Caswell [Wed, 27 Apr 2016 16:19:01 +0000 (17:19 +0100)]
Don't leak memory on ASN1_item_pack() error path

The ASN1_item_pack() function was leaking an ASN1_STRING object on error
paths.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoDon't leak memory on ASN1_GENERALIZEDTIME_adj() error path
Matt Caswell [Wed, 27 Apr 2016 15:59:49 +0000 (16:59 +0100)]
Don't leak memory on ASN1_GENERALIZEDTIME_adj() error path

The ASN1_GENERALIZEDTIME_adj() function leaks an ASN1_GENERALIZEDTIME
object on an error path.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoDon't leak memory in v2i_POLICY_MAPPINGS() on error path
Matt Caswell [Wed, 27 Apr 2016 15:50:14 +0000 (16:50 +0100)]
Don't leak memory in v2i_POLICY_MAPPINGS() on error path

The v2i_POLICY_MAPPINGS() function leaked ASN1_OBJECT pointers on error
paths.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoDon't leak memory from notice_section function on error path
Matt Caswell [Wed, 27 Apr 2016 15:41:43 +0000 (16:41 +0100)]
Don't leak memory from notice_section function on error path

The notice_section() function allocates a STACK_OF(CONF_VALUE) but
then fails to free it on an error path.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoDon't leak memory in v2i_AUTHORITY_KEYID
Matt Caswell [Wed, 27 Apr 2016 14:03:26 +0000 (15:03 +0100)]
Don't leak memory in v2i_AUTHORITY_KEYID

The v2i_AUTHORITY_KEYID() function can leak memory under an error
condition.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFix memory leak in crl2pkcs7 app
Matt Caswell [Wed, 27 Apr 2016 13:59:35 +0000 (14:59 +0100)]
Fix memory leak in crl2pkcs7 app

The crl2pkcs7 app leaks a stack of OPENSSL_STRINGs in error paths.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFree a temporary buffer used by dsaparam application
Matt Caswell [Wed, 27 Apr 2016 13:54:58 +0000 (14:54 +0100)]
Free a temporary buffer used by dsaparam application

The dsaparam application allocates a temporary buffer but then doesn't
free it.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFree buffer on error in a2i_ASN1_INTEGER()
Matt Caswell [Wed, 27 Apr 2016 13:50:32 +0000 (14:50 +0100)]
Free buffer on error in a2i_ASN1_INTEGER()

The function a2i_ASN1_INTEGER() allocates a buffer |s| but then fails
to free it on error paths.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFree memory on error in cms app
Matt Caswell [Wed, 27 Apr 2016 13:46:09 +0000 (14:46 +0100)]
Free memory on error in cms app

The make_receipt_request() function in the cms app can leak memory on
an error condition.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFree tempory data on error in ec_wNAF_mul()
Matt Caswell [Wed, 27 Apr 2016 13:38:44 +0000 (14:38 +0100)]
Free tempory data on error in ec_wNAF_mul()

The ec_wNAF_mul() function allocates some temporary storage that it
doesn't always free on an error condition.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFix nits in crypto.pod,ssl.pod
Rich Salz [Tue, 31 May 2016 16:20:08 +0000 (12:20 -0400)]
Fix nits in crypto.pod,ssl.pod

After this merge, the only things left (from doc-nit-check) is
74 pages without a "RETURN VALUES" section.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFix various doc nits.
Rich Salz [Wed, 25 May 2016 18:29:57 +0000 (14:29 -0400)]
Fix various doc nits.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoRemove/rename some old files.
Rich Salz [Fri, 20 May 2016 20:16:07 +0000 (16:16 -0400)]
Remove/rename some old files.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoAdd final(?) set of copyrights.
Rich Salz [Wed, 1 Jun 2016 15:26:40 +0000 (11:26 -0400)]
Add final(?) set of copyrights.

Add copyright to missing assembler files.
Add copyrights to missing test/* files.
Add copyrights
Various source and misc files.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFix some RAND bugs
Rich Salz [Sun, 29 May 2016 18:11:44 +0000 (14:11 -0400)]
Fix some RAND bugs

RT2630 -- segfault for int overlow
RT2877 -- check return values in apps/rand
Update CHANGES file for previous "windows rand" changes.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoEnsure an ASN1_OBJECT is freed in error paths
Matt Caswell [Tue, 26 Apr 2016 17:45:46 +0000 (18:45 +0100)]
Ensure an ASN1_OBJECT is freed in error paths

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFree allocated password strings on exit
Matt Caswell [Tue, 26 Apr 2016 17:37:58 +0000 (18:37 +0100)]
Free allocated password strings on exit

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFree a BIO_ADDR if DTLSv1_listen return <=0
Matt Caswell [Tue, 26 Apr 2016 17:33:03 +0000 (18:33 +0100)]
Free a BIO_ADDR if DTLSv1_listen return <=0

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoEnsure BIGNUM is freed in an error path
Matt Caswell [Tue, 26 Apr 2016 17:29:49 +0000 (18:29 +0100)]
Ensure BIGNUM is freed in an error path

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFree an X509_CRL in an error path
Matt Caswell [Tue, 26 Apr 2016 17:28:03 +0000 (18:28 +0100)]
Free an X509_CRL in an error path

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoDon't leak X509_OBJECT in an error path
Matt Caswell [Tue, 26 Apr 2016 17:25:39 +0000 (18:25 +0100)]
Don't leak X509_OBJECT in an error path

Swap the ordering of some code to avoid a leak in an error path.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoRT4337: Crash in DES
Rich Salz [Wed, 1 Jun 2016 03:05:48 +0000 (23:05 -0400)]
RT4337: Crash in DES

Salt must be two ASCII characters.  Add tests to check for that,
and a test to test the checks.

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoFix printing of DH Parameters
Matt Caswell [Fri, 27 May 2016 12:55:47 +0000 (13:55 +0100)]
Fix printing of DH Parameters

The -text argument to dhparam is broken, because the DHparams_print()
function always returns an error. The problem is that always expects a
public or private key to be present, even though that is never the case
with parameters.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoAdd dhparam sanity check and update DH_check documentation
Matt Caswell [Fri, 27 May 2016 12:26:03 +0000 (13:26 +0100)]
Add dhparam sanity check and update DH_check documentation

The -check argument to dhparam should never identify any problems if we
have just generated the parameters. Add a sanity check for this and print
an error and fail if necessary.

Also updates the documentation for the -check argument, and the DH_check()
function.

RT#4244

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoRaise an Err when CRYPTO_THREAD_lock_new fails
FdaSilvaYY [Sat, 30 Apr 2016 14:23:33 +0000 (16:23 +0200)]
Raise an Err when CRYPTO_THREAD_lock_new fails

Add missing error raise call, as it is done everywhere else.
and as CRYPTO_THREAD_lock_new don't do it internally.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoreq command incorrectly displays the bits for an EC key
Matt Caswell [Wed, 1 Jun 2016 09:48:36 +0000 (10:48 +0100)]
req command incorrectly displays the bits for an EC key

When the "req" command is used to generate a new EC key using the -newkey
option it will incorrectly display:

 Generating a 2048 bit EC private key

This commit fixes the message to not display the bit length for EC keys
because we don't currently support getting that during generation.

GitHub Issue #1068

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoOpenBSD doesn't have ucontext.h so don't try and include it
Matt Caswell [Wed, 11 May 2016 10:18:57 +0000 (11:18 +0100)]
OpenBSD doesn't have ucontext.h so don't try and include it

On OpenBSD we turn off async capabilities due to no ucontext.h.

RT#4379

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agomake update
Matt Caswell [Tue, 31 May 2016 22:03:54 +0000 (23:03 +0100)]
make update

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoUpdates from review
Mat [Tue, 10 May 2016 13:51:28 +0000 (15:51 +0200)]
Updates from review
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix: PEM_read_bio_PrivateKey with no-ui / no-stdio
Mat [Mon, 9 May 2016 19:36:39 +0000 (21:36 +0200)]
Fix: PEM_read_bio_PrivateKey with no-ui / no-stdio

If openssl is compiled with no-ui or no-stdio, then PEM_read_bio_PrivateKey fails if a password but no callback is provided.

The reason is that the premature return in the PEM_def_callback implementation when OPENSSL_NO_STDIO or OPENSSL_NO_UI is defined, comes too early.

This patch moves the ifdef block to the correct place.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRemove null check, per review feedback. Note this in the docs.
TJ Saunders [Tue, 31 May 2016 21:09:17 +0000 (14:09 -0700)]
Remove null check, per review feedback.  Note this in the docs.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1135)

8 years agoAdd requested HISTORY section, remove copy/pastos, per review feedback.
TJ Saunders [Fri, 27 May 2016 17:22:17 +0000 (10:22 -0700)]
Add requested HISTORY section, remove copy/pastos, per review feedback.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1135)

8 years agoAdd an SSL_SESSION accessor for obtaining the protocol version number, with
TJ Saunders [Thu, 26 May 2016 22:40:13 +0000 (15:40 -0700)]
Add an SSL_SESSION accessor for obtaining the protocol version number, with
accompanying documentation.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1135)

8 years agoRT4539: Add section for renamed ciphers.
Rich Salz [Tue, 31 May 2016 17:44:25 +0000 (13:44 -0400)]
RT4539: Add section for renamed ciphers.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agospeed.c: fix segfault with unrecognized algorithms
Cristian Stoica [Tue, 17 May 2016 15:40:14 +0000 (18:40 +0300)]
speed.c: fix segfault with unrecognized algorithms

When an unrecognized algorithm is given on command line together with
-async_jobs, speed_main will jump to clean-up and run
ASYNC_cleanup_thread without calling ASYNC_init_thread first.

Example:
openssl speed -async_jobs 4 ras2048

Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1084)

8 years agoParameter copy sanity checks.
Dr. Stephen Henson [Fri, 27 May 2016 13:18:40 +0000 (14:18 +0100)]
Parameter copy sanity checks.

Don't copy parameters is they're already present in the destination.
Return error if an attempt is made to copy different parameters to
destination. Update documentation.

If key type is not initialised return missing parameters

RT#4149

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoreturn error in ct_move_scts()
Dr. Stephen Henson [Fri, 27 May 2016 12:37:11 +0000 (13:37 +0100)]
return error in ct_move_scts()

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoTravis: update sanitizer configs
Emilia Kasper [Thu, 12 May 2016 18:00:14 +0000 (20:00 +0200)]
Travis: update sanitizer configs

- Use the new enable-ubsan and enable-asan configuration options.
- Separate ubsan and asan runs.
- In addition, run shared ubsan tests to get more coverage.
  (Shared asan tests need a bit more thought to get them working.)

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix strdup macro redefinition
Mat [Fri, 27 May 2016 17:35:12 +0000 (19:35 +0200)]
Fix strdup macro redefinition

This fixes the following error when the CRT debug heap (crtdbg.h) is used:
e_os.h(476): warning C4005: 'strdup': macro redefinition
C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\ucrt\crtdbg.h(319): note: see previous definition of 'strdup'
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1137)

8 years agoperl: use the 'if' module to conditionally load File::Glob
Richard Levitte [Mon, 30 May 2016 09:20:37 +0000 (11:20 +0200)]
perl: use the 'if' module to conditionally load File::Glob

Trying to use normal perl conditions to conditionally 'use' a perl
module didn't quite work.  Using the 'if' module to do so does work.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoMake sure max in fmtstr() doesn't overflow into negativity
Richard Levitte [Mon, 30 May 2016 03:41:57 +0000 (05:41 +0200)]
Make sure max in fmtstr() doesn't overflow into negativity

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoset RAND_event and RAND_screen to deprecated in 1.1.0 in librypto.num
Joey Yandle [Tue, 17 May 2016 20:42:52 +0000 (13:42 -0700)]
set RAND_event and RAND_screen to deprecated in 1.1.0 in librypto.num

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1079)

8 years agofix deprecation version number in docs
Joey Yandle [Mon, 16 May 2016 19:51:40 +0000 (12:51 -0700)]
fix deprecation version number in docs

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1079)

8 years agoupdate docs with descriptions and deprecation
Joey Yandle [Mon, 16 May 2016 19:46:48 +0000 (12:46 -0700)]
update docs with descriptions and deprecation

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1079)