Replace intrinsic ROTATE macros with an inline.

Without the cast/mask, the compiler is allowed to optimize this directly
to the correct CPU intrinsic for rotate.
Merge a patch that i successfully pushed to OpenSSL,
original OpenSSL commit message follows:

Fixed as shown; to be released post-1.0.2
commit bebbb11d132cc149f7713d6693703f8bfae10072
Author: Ingo Schwarze <schwarze@usta.de>
Date: Sat Jan 18 11:46:25 2014 +0100

RT3239: Extra comma in NAME lines of two manpages

In two OpenSSL manual pages, in the NAME section, the last word of the
name list is followed by a stray trailing comma. While this may seem
minor, it is worth fixing because it may confuse some makewhatis(8)
implementations.

While here, also add the missing word "size" to the one line
description in SSL_CTX_set_max_cert_list(3).

Reviewed by: Dr Stephen Henson <shenson@drh-consultancy.co.uk>
munmap correct object in (extremely unlikely, and effectively terminal)
case of failing to map the 2nd object.
found by Paul Maurers
fixed overrid(d)en typo

millert@ and jmc@ agree that "overriden" is wrong
XPG requires insque() and remque() to work with linear lists and not just
circular lists.  Amazingly, they managed to extend the requirements to no
longer match the behavior of the VAX instructions they were modeled after,
so the trivial VAX ASM versions have to go.  Nice job breaking it, X/Open!

Based on a diff from enh (at) google.com
ok miod@
getrandom(2) support for getentropy_linux

This enables support for the new getrandom(2) syscall in Linux 3.17.

If the call exists and fails, return a failure in getentropy(2) emulation as
well. This adds a EINTR check in case the urandom pool is not initialized.

Tested on Fedora Rawhide with 3.17rc0 and Ubuntu 14.04

ok deraadt@
use C rather than C++ array initialization syntax

this causes errors with stricter C compilers
only build the getrandom path if SYS_getrandom is defined.

like the sysctl path
replace sprintf/strdup with asprintf in engine test
a small tweak to improve malloc in multithreaded programs. we don't need
to hold the malloc lock across mmap syscalls in all cases. dropping it
allows another thread to access the existing chunk cache if necessary.
could be improved to be a bit more aggressive, but i've been testing this
simple diff for some time now with good results.
remove return value from HOST_c2l/l2c macros

These macros and asm inlines simulate a function returning a value, but
nothing ever uses this return value. Remove the pseudo-returns and
(void) casts discarding the unused values.

This, maybe unsurprisingly, speeds things up a bit. It also removes the
GCC 4.9 warnings about unused values.

ok miod@ deraadt@
replace more ROTATE macros with plain-old C code.

Let the compiler optimize these. Even older versions of gcc generate
equal or better quality code than the inline asm.

ok miod@
digests: *_LONG_LOG2 is not used, stop talking about it

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
md32_common: allow digest to override Final function

Define HASH_NO_FINAL to let digest implementation to provide Hash_Final
function on its own.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
SSL: Drop non-standard GOST ciphers

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Add GOST 28147-89 cipher implementation

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Add GOST 28147-89 MAC implementation

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Add GOSR R 34.11-94 message digest implementation

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Hook GOST 28147-89 cipher algorithms

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Add GOST 28147-89 ASN1 parameters support

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>