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

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

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

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

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

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

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

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

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

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

8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 years agoAvoid creating an illegal pointer
Kurt Roeckx [Tue, 24 May 2016 19:32:01 +0000 (21:32 +0200)]
Avoid creating an illegal pointer

Found by tis-interpreter

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

8 years agoDon't clean away headers generated by Configure
Richard Levitte [Wed, 25 May 2016 18:54:54 +0000 (20:54 +0200)]
Don't clean away headers generated by Configure

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoMake sure crypto-mdebug-backtrace must be enabled explicitely
Richard Levitte [Wed, 25 May 2016 13:42:15 +0000 (15:42 +0200)]
Make sure crypto-mdebug-backtrace must be enabled explicitely

As it was until now, crypto-mdebug-backtrace was enabled by default
and only disabled if crypto-mdebug was disabled.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agobuild.info files: add quotes around any spec that may contain spaces
Richard Levitte [Tue, 24 May 2016 15:41:56 +0000 (17:41 +0200)]
build.info files: add quotes around any spec that may contain spaces

RT#4492

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoConfigure: To allow file names with spaces, tokenize with respect for quotes
Richard Levitte [Tue, 24 May 2016 15:39:52 +0000 (17:39 +0200)]
Configure: To allow file names with spaces, tokenize with respect for quotes

For parsing build.info files.

RT#4492

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoComplete the list of files to clean up on Windows
Richard Levitte [Mon, 16 May 2016 12:58:33 +0000 (14:58 +0200)]
Complete the list of files to clean up on Windows

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoCommunicate Configure generated header files to build files
Richard Levitte [Mon, 16 May 2016 12:54:39 +0000 (14:54 +0200)]
Communicate Configure generated header files to build files

Add Configure generated header files to $unified_info{generate}.  This
makes sure the build files will pick them up with the rest for the
GENERATED macro, and thereby make sure they get cleaned away by 'make
clean'

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAvoid creating an illegal pointer
Kurt Roeckx [Mon, 23 May 2016 21:09:33 +0000 (23:09 +0200)]
Avoid creating an illegal pointer

Found by tis-interpreter

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

8 years agoGH919: Fix wrappers for two headers
Rich Salz [Tue, 24 May 2016 13:19:43 +0000 (09:19 -0400)]
GH919: Fix wrappers for two headers

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoFix braces in e_aes.c: aes_init_key
Todd Short [Tue, 24 May 2016 13:03:25 +0000 (09:03 -0400)]
Fix braces in e_aes.c: aes_init_key

This compiles correctly, but depending on what may be defined, it's
possible that this could fail compilation. The braces are mismatched,
and it's possible to end up with an else followed by another else.

This presumes the indentation is mostly correct and indicative of
intent. Found via static analysis.

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

8 years agoClean up RAND_bytes() calls
Todd Short [Tue, 24 May 2016 12:55:12 +0000 (08:55 -0400)]
Clean up RAND_bytes() calls

When RAND_pseudo_bytes() was replaced with RAND_bytes(), this case
was not reduced to a simple RAND_bytes() call.

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

8 years agoFix a mem leak on an error path in OBJ_NAME_add()
Matt Caswell [Mon, 9 May 2016 16:44:26 +0000 (17:44 +0100)]
Fix a mem leak on an error path in OBJ_NAME_add()

If lh_OBJ_NAME_insert() fails then the allocated |onp| value is leaked.

RT#2238

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFix error return value in SRP functions
Matt Caswell [Mon, 25 Apr 2016 15:22:31 +0000 (16:22 +0100)]
Fix error return value in SRP functions

The functions SRP_Calc_client_key() and SRP_Calc_server_key() were
incorrectly returning a valid pointer in the event of error.

Issue reported by Yuan Jochen Kang

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoAdd error return for OPENSSL_INIT_set_config_filename()
Matt Caswell [Mon, 23 May 2016 09:55:54 +0000 (10:55 +0100)]
Add error return for OPENSSL_INIT_set_config_filename()

The OPENSSL_INIT_set_config_filename() function can fail so ensure that it
provides a suitable error code.

GitHub Issue #920

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoUse strerror_r()/strerror_s() instead of strerror() where possible
Matt Caswell [Mon, 23 May 2016 12:52:29 +0000 (13:52 +0100)]
Use strerror_r()/strerror_s() instead of strerror() where possible

The function strerror() is not thread safe. We should use strerror_r()
where possible, or strerror_s() on Windows.

RT#2267

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years ago#4342: few missing malloc return checks and free in error paths
J Mohan Rao Arisankala [Mon, 23 May 2016 18:07:47 +0000 (23:37 +0530)]
#4342: few missing malloc return checks and free in error paths

ossl_hmac_cleanup, pkey_hmac_cleanup:
 - allow to invoke with NULL data
 - using EVP_PKEY_CTX_[get|set]_data

EVP_DigestInit_ex:
 - remove additional check for ‘type’ and doing clear free instead of
free

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoWindows notes: add a few lines on gaining admin privs for installing
Richard Levitte [Mon, 23 May 2016 20:24:13 +0000 (22:24 +0200)]
Windows notes: add a few lines on gaining admin privs for installing

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoVMS: show the ossl_dataroot logical as well when doing "mms debug_logicals"
Richard Levitte [Mon, 23 May 2016 16:35:23 +0000 (18:35 +0200)]
VMS: show the ossl_dataroot logical as well when doing "mms debug_logicals"

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoInstall the scripts the same way on Windows and VMS as on Unix
Richard Levitte [Mon, 23 May 2016 14:46:45 +0000 (16:46 +0200)]
Install the scripts the same way on Windows and VMS as on Unix

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoMake sure tsget.pl and c_rehash.pl get installed on VMS and Windows.
Richard Levitte [Mon, 23 May 2016 13:51:19 +0000 (15:51 +0200)]
Make sure tsget.pl and c_rehash.pl get installed on VMS and Windows.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoMake sure tsget and c_rehash are named with .pl suffix on Windows and VMS
Richard Levitte [Mon, 23 May 2016 13:49:25 +0000 (15:49 +0200)]
Make sure tsget and c_rehash are named with .pl suffix on Windows and VMS

Especially on Windows, the .pl suffix is associated with the perl
interpreter, and therefore make those scripts usable as commands of
their own.  On VMS, it simply looks better.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoMake sure to initialize all CA.pl variables properly
Richard Levitte [Mon, 23 May 2016 13:47:43 +0000 (15:47 +0200)]
Make sure to initialize all CA.pl variables properly

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd buf-freelists to deprecated options
Todd Short [Mon, 23 May 2016 12:50:32 +0000 (08:50 -0400)]
Add buf-freelists to deprecated options

The buf-freelists option was removed in master. There may be some
things that try to disable it, so don't error out.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoRemove unused error/function codes.
Rich Salz [Mon, 23 May 2016 19:02:34 +0000 (15:02 -0400)]
Remove unused error/function codes.

Add script to find unused err/reason codes
Remove unused reason codes.
Remove entries for unused functions

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoSupport -no-CAfile -no-CApath in ctx2
Dr. Stephen Henson [Mon, 23 May 2016 17:13:16 +0000 (18:13 +0100)]
Support -no-CAfile -no-CApath in ctx2

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoremove encrypt then mac ifdefs
Dr. Stephen Henson [Mon, 23 May 2016 17:23:33 +0000 (18:23 +0100)]
remove encrypt then mac ifdefs

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoVMS: remove last VAX vestiges
Richard Levitte [Mon, 23 May 2016 17:11:39 +0000 (19:11 +0200)]
VMS: remove last VAX vestiges

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agomake update
Dr. Stephen Henson [Thu, 19 May 2016 16:59:17 +0000 (17:59 +0100)]
make update

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoSupport for traditional format private keys.
Dr. Stephen Henson [Tue, 17 May 2016 13:15:20 +0000 (14:15 +0100)]
Support for traditional format private keys.

Add new function PEM_write_bio_PrivateKey_traditional() to enforce the
use of legacy "traditional" private key format. Add -traditional option
to pkcs8 and pkey utilities.

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoSlight cleanup of the collection of READMEs, INSTALLs and NOTES
Richard Levitte [Mon, 23 May 2016 13:11:04 +0000 (15:11 +0200)]
Slight cleanup of the collection of READMEs, INSTALLs and NOTES

README is a fairly independent document, and so is INSTALL.  NOTES are
merely addendums to INSTALL.  Therefore , INSTALL.DJGPP and
README.PERL get renamed to NOTES.DJGPP and NOTES.PERL.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRemove INSTALL.WCE and refs to it.
Rich Salz [Mon, 23 May 2016 12:55:57 +0000 (08:55 -0400)]
Remove INSTALL.WCE and refs to it.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoAdd text/x509aux to gitignore
Todd Short [Mon, 23 May 2016 12:48:22 +0000 (08:48 -0400)]
Add text/x509aux to gitignore

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoAdd checks on CRYPTO_set_ex_data return value
FdaSilvaYY [Sun, 14 Feb 2016 09:42:29 +0000 (10:42 +0100)]
Add checks on CRYPTO_set_ex_data return value
Fix possible leak in danetest.c

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoFix some malloc failure crashes on X509_STORE_CTX_set_ex_data
FdaSilvaYY [Sat, 13 Feb 2016 18:01:14 +0000 (19:01 +0100)]
Fix some malloc failure crashes on X509_STORE_CTX_set_ex_data

from BoringSSL 306ece31bcaaed49e0240a2e5555f8901ebb2d45

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoFix and simplify error handling in (RSA/EC_kmeth)_new_method()
FdaSilvaYY [Tue, 17 May 2016 19:21:46 +0000 (21:21 +0200)]
Fix and simplify error handling in (RSA/EC_kmeth)_new_method()

Inspired from PR #873.
Nearly same as 2bbf0ba.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoRemove useless NULL checks
FdaSilvaYY [Sat, 7 May 2016 16:54:01 +0000 (18:54 +0200)]
Remove useless NULL checks

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoWindows: shut DEL up
Richard Levitte [Mon, 23 May 2016 07:36:02 +0000 (09:36 +0200)]
Windows: shut DEL up

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoComplete the rename of LHASH functions and types
Richard Levitte [Sun, 22 May 2016 08:57:18 +0000 (10:57 +0200)]
Complete the rename of LHASH functions and types

LHASH_NODE was used internally, which doesn't work when configured
'no-deprecated'

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoutil/process_docs.pl: Add more debugging output
Richard Levitte [Sun, 22 May 2016 22:38:48 +0000 (00:38 +0200)]
util/process_docs.pl: Add more debugging output

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoImprove the checking of pod sections
Richard Levitte [Sun, 22 May 2016 22:36:37 +0000 (00:36 +0200)]
Improve the checking of pod sections

(i.e. remove some bugs)

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoHTML docs on Unix: Add a HTML title
Richard Levitte [Sat, 21 May 2016 18:51:18 +0000 (20:51 +0200)]
HTML docs on Unix: Add a HTML title

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoprocess_docs.pl: When starting to read a new head1 section, remove previous text
Richard Levitte [Sat, 21 May 2016 18:50:48 +0000 (20:50 +0200)]
process_docs.pl: When starting to read a new head1 section, remove previous text

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd a missing comma in OPENSSL_malloc.pod
Richard Levitte [Sat, 21 May 2016 18:49:58 +0000 (20:49 +0200)]
Add a missing comma in OPENSSL_malloc.pod

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd the missing NAME header in the OCSP docs
Richard Levitte [Sat, 21 May 2016 18:49:33 +0000 (20:49 +0200)]
Add the missing NAME header in the OCSP docs

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAvoid creating an illegal pointer
Kurt Roeckx [Sat, 21 May 2016 14:53:14 +0000 (16:53 +0200)]
Avoid creating an illegal pointer

Found by tis-interpreter

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

8 years agoAvoid creating an illegal pointer
Kurt Roeckx [Sat, 21 May 2016 14:32:15 +0000 (16:32 +0200)]
Avoid creating an illegal pointer

Found by tis-interpreter

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

8 years agoHave doc-nit-check look for mandatory manual sections
Richard Levitte [Sat, 21 May 2016 23:26:45 +0000 (01:26 +0200)]
Have doc-nit-check look for mandatory manual sections

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoConstify stack and lhash macros.
Dr. Stephen Henson [Sat, 21 May 2016 15:31:09 +0000 (16:31 +0100)]
Constify stack and lhash macros.

RT#4471

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoIndent and dead code cleanup
FdaSilvaYY [Fri, 20 May 2016 21:36:18 +0000 (23:36 +0200)]
Indent and dead code cleanup

tofree pointer  is no more used...

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

8 years agoAdd OpenSSL copyright to .pl files
Rich Salz [Sat, 21 May 2016 12:23:39 +0000 (08:23 -0400)]
Add OpenSSL copyright to .pl files

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoDoc nits cleanup, round 2
Rich Salz [Sat, 21 May 2016 00:52:46 +0000 (20:52 -0400)]
Doc nits cleanup, round 2

Fix some code examples, trailing whitespace
Fix TBA sections in verify, remove others.
Remove empty sections
Use Mixed Case not ALL CAPS in head2
Enhance doc-nits script.
Remove extra =cut line

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFix Windows 64 bit crashes
Matt Caswell [Thu, 19 May 2016 19:11:09 +0000 (20:11 +0100)]
Fix Windows 64 bit crashes

The function InitOnceExceuteOnce is the best way to support the
implementation of CRYPTO_THREAD_run_once() on Windows. Unfortunately
WinXP doesn't have it. To get around that we had two different
implementations: one for WinXP and one for later versions. Which one was
used was based on the value of _WIN32_WINNT.

This approach was starting to cause problems though because other parts of
OpenSSL assume _WIN32_WINNT is going to be 0x0501 and crashes were
occurring dependant on include file ordering. In addition a conditional
based on _WIN32_WINNT had made its way into a public header file through
commit 5c4328f. This is problematic because the value of this macro can
vary between OpenSSL build time and application build time.

The simplest solution to this mess is just to always use the WinXP version
of CRYPTO_THREAD_run_once(). Its perhaps slightly sub-optimal but probably
not noticably.

GitHub Issue #1086

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoRename lh_xxx,sk_xxx tp OPENSSL_{LH,SK}_xxx
Rich Salz [Fri, 20 May 2016 14:46:29 +0000 (10:46 -0400)]
Rename lh_xxx,sk_xxx tp OPENSSL_{LH,SK}_xxx

Rename sk_xxx to OPENSSL_sk_xxx and _STACK to OPENSSL_STACK
Rename lh_xxx API to OPENSSL_LH_xxx and LHASH_NODE to OPENSSL_LH_NODE
Make lhash stuff opaque.
Use typedefs for function pointers; makes the code simpler.
Remove CHECKED_xxx macros.
Add documentation; remove old X509-oriented doc.
Add API-compat names for entire old API

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
8 years agoClean up the VMS hacks in crypto/rand/randfile.c
Richard Levitte [Fri, 20 May 2016 13:18:22 +0000 (15:18 +0200)]
Clean up the VMS hacks in crypto/rand/randfile.c

Reviewed-by: Andy Polyakov <appro@openssl.org>