openssl.git
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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)

7 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)

7 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)

7 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>
7 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)

7 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>
7 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>
7 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>
7 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)

7 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>
7 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>
7 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)

7 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)

7 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)

7 years agofix return value in docs
Joey Yandle [Mon, 16 May 2016 19:41:02 +0000 (12:41 -0700)]
fix return value 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)

7 years agoadd removed functions back as deprecated
Joey Yandle [Mon, 16 May 2016 19:30:41 +0000 (12:30 -0700)]
add removed functions back as deprecated

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)

7 years agoget rid of now empty #if
Joey Yandle [Wed, 13 Jan 2016 19:15:51 +0000 (11:15 -0800)]
get rid of now empty #if

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)

7 years agoremove winrand.c entirely, nothing seems to reference it
Joey Yandle [Wed, 13 Jan 2016 18:11:06 +0000 (10:11 -0800)]
remove winrand.c entirely, nothing seems to reference it

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)

7 years agocherry pick pr-512 changes
Joey Yandle [Wed, 13 Jan 2016 05:27:27 +0000 (21:27 -0800)]
cherry pick pr-512 changes

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)

7 years agoget rid of unnecessary include
Joey Yandle [Wed, 13 Jan 2016 05:16:42 +0000 (21:16 -0800)]
get rid of unnecessary include

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)

7 years agoremove RAND_screen and friends
Joey Yandle [Wed, 13 Jan 2016 04:18:59 +0000 (20:18 -0800)]
remove RAND_screen and friends

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)

7 years agocherry pick pr-512 changes
Joey Yandle [Tue, 12 Jan 2016 19:53:16 +0000 (11:53 -0800)]
cherry pick pr-512 changes

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)

7 years agoOR flags with CRYPT_SILENT to really make sure no UI pops up
Joey Yandle [Wed, 23 Dec 2015 18:39:09 +0000 (10:39 -0800)]
OR flags with CRYPT_SILENT to really make sure no UI pops up

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)

7 years agofix endif comment
Joey Yandle [Mon, 21 Dec 2015 02:44:11 +0000 (18:44 -0800)]
fix endif comment

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)

7 years agoremove all WINCE ifdefs
Joey Yandle [Mon, 21 Dec 2015 02:37:56 +0000 (18:37 -0800)]
remove all WINCE ifdefs

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)

7 years ago- remove insane heap walk and kernel loading code; clean up style and calling conventions
Joey Yandle [Sat, 12 Dec 2015 01:53:03 +0000 (17:53 -0800)]
- remove insane heap walk and kernel loading code; clean up style and calling conventions

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)

7 years agox86_64 assembly pack: tolerate spaces in source directory name.
Andy Polyakov [Sat, 28 May 2016 14:25:38 +0000 (16:25 +0200)]
x86_64 assembly pack: tolerate spaces in source directory name.

[as it is now quoting $output is not required, but done just in case]

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoConfigure,test/recipes: "pin" glob to File::Glob::glob.
Andy Polyakov [Sat, 28 May 2016 14:11:01 +0000 (16:11 +0200)]
Configure,test/recipes: "pin" glob to File::Glob::glob.

As it turns out default glob's behaviour for quoted argument varies
from version to version, making it impossible to Configure or run
tests in some cases. The reason for quoting globs was to accommodate
source path with spaces in its name, which was treated by default glob
as multiple paths. File::Glob::glob on the other hand doesn't consider
spaces as delimiters and therefore works with unquoted patterns.

[Unfortunaltely File::Glob::glob, being too csh-ly, doesn't work
on VMS, hence the "pinning" is conditional.]

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoAdd more zalloc
FdaSilvaYY [Sun, 6 Mar 2016 20:40:58 +0000 (21:40 +0100)]
Add more zalloc

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

7 years agoFix some missing inits
FdaSilvaYY [Sun, 6 Mar 2016 20:26:46 +0000 (21:26 +0100)]
Fix some missing inits

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

7 years agopoly1305/asm/poly1305-mips.pl: adhere to standard frame layout.
Andy Polyakov [Fri, 27 May 2016 19:50:49 +0000 (21:50 +0200)]
poly1305/asm/poly1305-mips.pl: adhere to standard frame layout.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoSPARC assembly pack: add missing .type directives.
Andy Polyakov [Fri, 27 May 2016 20:13:16 +0000 (22:13 +0200)]
SPARC assembly pack: add missing .type directives.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoChange a call of OPENSSL_strcasecmp to strcasecmp
Richard Levitte [Fri, 27 May 2016 08:46:42 +0000 (10:46 +0200)]
Change a call of OPENSSL_strcasecmp to strcasecmp

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
7 years agomake update
Richard Levitte [Fri, 27 May 2016 08:17:42 +0000 (10:17 +0200)]
make update

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
7 years agoRemove internal functions OPENSSL_strcasecmp and OPENSSL_strncasecmp
Richard Levitte [Fri, 27 May 2016 08:12:58 +0000 (10:12 +0200)]
Remove internal functions OPENSSL_strcasecmp and OPENSSL_strncasecmp

Their only reason to exist was that they didn't exist in VMS before
version 7.0.  We do not support such old versions any more.

However, for the benefit of systems that don't get strings.h included
by string.h, we include the former in e_os.h.

RT#4458

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
7 years agoinclude/openssl/e_os2.h: fix 'noreturn' pre-processor logic.
Andy Polyakov [Thu, 26 May 2016 21:10:56 +0000 (23:10 +0200)]
include/openssl/e_os2.h: fix 'noreturn' pre-processor logic.

Newer gcc still recognizes e.g. -std=c9x in which case it wouldn't
have used 'noreturn' at all with original logic.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agocrypto/o_str.c: add _GNU_SOURCE strerror_r case.
Andy Polyakov [Fri, 27 May 2016 10:04:09 +0000 (12:04 +0200)]
crypto/o_str.c: add _GNU_SOURCE strerror_r case.

Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agocrypto/o_str.c: strerror_s is provided by specific compiler run-time,
Andy Polyakov [Thu, 26 May 2016 21:00:21 +0000 (23:00 +0200)]
crypto/o_str.c: strerror_s is provided by specific compiler run-time,
not by OS [as was implied by guarding #if condition].

Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agobn/bn_exp.c: explain 'volatile' in MOD_EXP_CTIME_COPY_FROM_PREBUF.
Andy Polyakov [Thu, 26 May 2016 19:40:09 +0000 (21:40 +0200)]
bn/bn_exp.c: explain 'volatile' in MOD_EXP_CTIME_COPY_FROM_PREBUF.

Reviewed-by: Tim Hudson <tjh@openssl.org>
7 years agobf/build.info: engage assembly module.
Andy Polyakov [Sun, 22 May 2016 07:47:15 +0000 (09:47 +0200)]
bf/build.info: engage assembly module.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoAvoid calling memcpy with lenght of 0
Kurt Roeckx [Thu, 26 May 2016 16:40:32 +0000 (18:40 +0200)]
Avoid calling memcpy with lenght of 0

We can call memcpy() with a pointer 1 past the last allocated byte and length
of 0 and you can argue that that's undefined behaviour.

Reported by tis-interpreter

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

7 years agoFix ssl_cert_set0_chain invalid pointer
Todd Short [Thu, 26 May 2016 00:56:48 +0000 (20:56 -0400)]
Fix ssl_cert_set0_chain invalid pointer

When setting the certificate chain, if a certificate doesn't pass
security checks, then chain may point to a freed STACK_OF(X509)

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoFix fmtstr for BIO_printf() et al
Richard Levitte [Sat, 21 May 2016 01:46:43 +0000 (03:46 +0200)]
Fix fmtstr for BIO_printf() et al

-   If we have a maximum amount of characters permitted to be printed
    (for example "%.2s", which allows for a maximum of 2 chars), we
    minimize the number of characters from the string to printed to
    that size.
-   If there is space for padding and there is a maximum amount of
    characters to print (for example "%3.2s", which shall give at
    least a 1 space padding), the amount of characters to pad with
    gets added to the maximum so the minimum field size (3 in this
    example) gets filled out.

Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agomake sure to put quotes around -config argument, in case of spaces
Richard Levitte [Wed, 25 May 2016 13:03:08 +0000 (15:03 +0200)]
make sure to put quotes around -config argument, in case of spaces

RT#4486

Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoperl glob: make sure to put quotes around the pattern, in case of spaces
Richard Levitte [Wed, 25 May 2016 13:02:20 +0000 (15:02 +0200)]
perl glob: make sure to put quotes around the pattern, in case of spaces

RT#4486

Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoWindows makefile: handle the case with space in source directory
Richard Levitte [Wed, 25 May 2016 09:58:19 +0000 (11:58 +0200)]
Windows makefile: handle the case with space in source directory

This applies when building out-of-source.

RT#4486

NOTE: we can't do the same for Unix, as Unix make doesn't handle this
type of issue.  Also, directory specs are much less likely to have
spaces on Unix...

Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoConfigure: handle spaces in source directory spec
Richard Levitte [Wed, 25 May 2016 09:57:23 +0000 (11:57 +0200)]
Configure: handle spaces in source directory spec

RT#4486

Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoAllow space in PERL spec (unix only)
Richard Levitte [Fri, 27 May 2016 15:18:57 +0000 (17:18 +0200)]
Allow space in PERL spec (unix only)

Someone wants to configure like this:

    PERL="/usr/bin/env perl" ./config

The end goal is to get that in the #! line of CA.pl and a few other
scripts.  That works well already, but in the Makefile, there were a
few lines looking like this:

    PERL=$(PERL) $(PERL) whatever.pl ...

Those need some quoting.

RT#4311

Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoAvoid msys name mangling
Matt Caswell [Fri, 20 May 2016 16:49:33 +0000 (17:49 +0100)]
Avoid msys name mangling

If using the msys console then msys attempts to "fix" command line
arguments to convert them from Unix style to Windows style. One of the
things it does is to look for arguments seperated by colons. This it
assumes is a list of file paths, so it replaces the colon with a semi-colon.
This was causing one of our tests to fail when calling the "req" command
line app. We were attempting to create a new DSA key and passing the
argument "dsa:../apps/dsa1024.pem". This is exactly what we intended but
Msys mangles it to "dsa;../apps/dsa1024.pem" and the command fails.
There doesn't seem to be a way to suppress Msys name mangling. Fortunately
we can work around this issue by generating the DSA key in a separate step
by calling "gendsa".

RT#4255

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoFix intermittent windows failures in TLSProxy tests
Matt Caswell [Fri, 20 May 2016 15:34:24 +0000 (16:34 +0100)]
Fix intermittent windows failures in TLSProxy tests

When closing down the socket in s_client Windows will close it immediately
even if there is data in the write buffer still waiting to be sent. This
was causing tests to fail in Msys/Mingw builds because TLSProxy doesn't see
the final CloseNotify.

I have experimented with various ways of doing this "properly" (e.g.
shutting down the socket before closing, setting SO_LINGER etc). I can't
seem to find the "magic" formula that will make Windows do this. Inserting
a short 50ms sleep seems to do the trick...but its not very "nice" so I've
inserted a TODO on this item. Perhaps someone else will have better luck
in figuring this out.

RT#4255

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoFix s_client/s_server waiting for stdin on Windows
Matt Caswell [Fri, 20 May 2016 10:53:26 +0000 (11:53 +0100)]
Fix s_client/s_server waiting for stdin on Windows

On Windows we were using the function _kbhit() to determine whether there
was input waiting in stdin for us to read. Actually all this does is work
out whether there is a keyboard press event waiting to be processed in the
input buffer. This only seems to work in a standard Windows console (not
Msys console) and also doesn't work if you redirect the input from some
other source (as we do in TLSProxy tests). This commit changes things to
work differently depending on whether we are on the Windows console or not.

RT#4255

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoFix some s_server issues on Windows
Matt Caswell [Fri, 20 May 2016 10:20:22 +0000 (11:20 +0100)]
Fix some s_server issues on Windows

In s_server we call BIO_sock_should_retry() to determine the state of the
socket and work out whether we should retry an operation on it or not.
However if you leave it too long to call this then other operations may
have occurred in the meantime which affect the result. Therefore we should
call it early and remember the result for when we need to use it. This fixes
a test problem on Windows.

Another issue with s_server on Windows is that some of output to stdout does
not get displayed immediately. Apparently more liberal use of BIO_flush is
required.

RT#4255

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoSilence some "may be uninitialized when used" warning
Matt Caswell [Fri, 27 May 2016 13:59:47 +0000 (14:59 +0100)]
Silence some "may be uninitialized when used" warning

Clang was complaining about some variables possibly being uninitialized
when used. The warnings are bogus, but clang can't figure that out. This
silences the warnings.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoAdd a test for printing floating point format specifiers
Matt Caswell [Thu, 26 May 2016 12:47:47 +0000 (13:47 +0100)]
Add a test for printing floating point format specifiers

Previous commits fixed the implementation of the %e and %g format
specifiers as well as other issues. This commit adds a test.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoPrevent an overflow when trying to print excessively big floats
Matt Caswell [Wed, 25 May 2016 15:20:48 +0000 (16:20 +0100)]
Prevent an overflow when trying to print excessively big floats

We convert the integer part of the float to a long. We should check it
fits first.

Issue reported by Guido Vranken.

GitHub Issue #1102

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoFix implementation of "e" and "g" formats for printing floating points
Matt Caswell [Wed, 25 May 2016 14:33:15 +0000 (15:33 +0100)]
Fix implementation of "e" and "g" formats for printing floating points

The previous commit which "fixed" the "e" and "g" floating point formats
just printed them in the same way as "f". This is wrong. This commit
provides the correct formatting.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoFix some issues in b_print.c code
Matt Caswell [Wed, 25 May 2016 14:37:11 +0000 (15:37 +0100)]
Fix some issues in b_print.c code

Convert assert to OPENSSL_assert(), add some documentation, add the calls
to fmtfp() for the "e" and "g" floating point formats which were missing.

Based on a patch provided by Ger Hobbelt <ger@hobbelt.com>.

RT#2270

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoUpdate the documentation of BN_hex2bn()
huangqinjin [Wed, 18 May 2016 10:07:10 +0000 (18:07 +0800)]
Update the documentation of BN_hex2bn()

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agofix BN_hex2bn()/BN_dec2bn() memory leak
huangqinjin [Fri, 6 May 2016 16:50:22 +0000 (00:50 +0800)]
fix BN_hex2bn()/BN_dec2bn() memory leak

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoFix some suspect warnings on Windows
Matt Caswell [Thu, 26 May 2016 13:47:17 +0000 (14:47 +0100)]
Fix some suspect warnings on Windows

Windows was complaining about a unary minus operator being applied to an
unsigned type. It did seem to go on and do the right thing anyway, but the
code does look a little suspect. This fixes it.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
7 years agoThe ssl3_digest_cached_records() function does not handle errors properly
Matt Caswell [Thu, 26 May 2016 14:45:14 +0000 (15:45 +0100)]
The ssl3_digest_cached_records() function does not handle errors properly

The ssl3_digest_cached_records() function was failing to handle errors
that might be returned from EVP_DigestSignInit() and
EVP_DigestSignUpdate().

RT#4180

Reviewed-by: Stephen Henson <steve@openssl.org>
7 years agoAdd rfc822Mailbox to string table.
Dr. Stephen Henson [Wed, 25 May 2016 15:29:47 +0000 (16:29 +0100)]
Add rfc822Mailbox to string table.

RT#2369

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoHandle Visual C warning about non-standard function names.
Richard Levitte [Wed, 25 May 2016 21:35:54 +0000 (23:35 +0200)]
Handle Visual C warning about non-standard function names.

Visual C version from version 2003 complain about certain function
names, for example:

    apps\apps.c(2572) : warning C4996: 'open': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _open. See online help for details.

This adds preprocessor aliases for them in e_os.h.

Additionally, crypto/conf/conf_lib.c needs to include e_os.h to catch
those aliases.

RT#4488
RT#4489

Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoConfigure: pull 'which' back.
Andy Polyakov [Fri, 20 May 2016 19:31:11 +0000 (21:31 +0200)]
Configure: pull 'which' back.

At earlier point 'which' was replaced with IPC::Cmd::can_run call.
Unfortunately on RPM-based systems it is a separate package and it's
not given that it's installed. Resurrected 'which' provides
poor-man fallback for IPC::Cmd::can_run.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoMakefile.shared: revert Haiku support commit.
Andy Polyakov [Fri, 20 May 2016 07:30:06 +0000 (09:30 +0200)]
Makefile.shared: revert Haiku support commit.

Configurations/50-haiku.conf reuses gnu-shared rules and doesn't
require dedicated targets.

Reviewed-by: Richard Levitte <levitte@openssl.org>