Hello community,

here is the log from the commit of package openssl.3643 for 
openSUSE:13.1:Update checked in at 2015-03-20 17:09:49
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:13.1:Update/openssl.3643 (Old)
 and      /work/SRC/openSUSE:13.1:Update/.openssl.3643.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "openssl.3643"

Changes:
--------
New Changes file:

--- /dev/null   2015-03-12 01:14:30.992027505 +0100
+++ /work/SRC/openSUSE:13.1:Update/.openssl.3643.new/openssl.changes    
2015-03-20 17:09:52.000000000 +0100
@@ -0,0 +1,1716 @@
+-------------------------------------------------------------------
+Mon Mar 16 17:49:12 UTC 2015 - [email protected]
+
+- security update:
+ * CVE-2015-0209 (bnc#919648)
+   - Fix a failure to NULL a pointer freed on error
+ * CVE-2015-0286 (bnc#922496)
+   - Segmentation fault in ASN1_TYPE_cmp
+ * CVE-2015-0287 (bnc#922499)
+   - ASN.1 structure reuse memory corruption
+ * CVE-2015-0288 x509: (bnc#920236)
+   - added missing public key is not NULL check
+ * CVE-2015-0289 (bnc#922500)
+   - PKCS7 NULL pointer dereferences
+ * CVE-2015-0293 (bnc#922488)
+   - Fix reachable assert in SSLv2 servers
+ * added patches:
+   openssl-CVE-2015-0209.patch
+   openssl-CVE-2015-0286.patch
+   openssl-CVE-2015-0287.patch
+   openssl-CVE-2015-0288.patch
+   openssl-CVE-2015-0289.patch
+   openssl-CVE-2015-0293.patch
+
+-------------------------------------------------------------------
+Thu Jan  8 17:42:27 UTC 2015 - [email protected]
+
+- Upgrade to 1.0.1k
+  bsc#912294 CVE-2014-3571: Fix DTLS segmentation fault in dtls1_get_record.
+  bsc#912292 CVE-2015-0206: Fix DTLS memory leak in dtls1_buffer_record.
+  bsc#911399 CVE-2014-3569: Fix issue where no-ssl3 configuration sets method 
to NULL.
+  bsc#912015 CVE-2014-3572: Abort handshake if server key exchange
+                            message is omitted for ephemeral ECDH ciphersuites.
+  bsc#912014 CVE-2015-0204: Remove non-export ephemeral RSA code on client and 
server.
+  bsc#912293 CVE-2015-0205: Fixed issue where DH client certificates are 
accepted without verification.
+  bsc#912018 CVE-2014-8275: Fix various certificate fingerprint issues.
+  bsc#912296 CVE-2014-3570: Correct Bignum squaring.
+  and other bugfixes.
+
+- refresh patches
+
+-------------------------------------------------------------------
+Thu Oct 16 12:54:38 UTC 2014 - [email protected]
+
+- upgrade to 1.0.1j
+  * fixes bnc#901277 and bnc#901223
+  *) SRTP Memory Leak.
+     A flaw in the DTLS SRTP extension parsing code allows an attacker, who
+     sends a carefully crafted handshake message, to cause OpenSSL to fail
+     to free up to 64k of memory causing a memory leak. This could be
+     exploited in a Denial Of Service attack. This issue affects OpenSSL
+     1.0.1 server implementations for both SSL/TLS and DTLS regardless of
+     whether SRTP is used or configured. Implementations of OpenSSL that
+     have been compiled with OPENSSL_NO_SRTP defined are not affected.
+     (CVE-2014-3513)
+  *) Session Ticket Memory Leak.
+     When an OpenSSL SSL/TLS/DTLS server receives a session ticket the
+     integrity of that ticket is first verified. In the event of a session
+     ticket integrity check failing, OpenSSL will fail to free memory
+     causing a memory leak. By sending a large number of invalid session
+     tickets an attacker could exploit this issue in a Denial Of Service
+     attack.
+     (CVE-2014-3567)
+  *) Build option no-ssl3 is incomplete.
+     When OpenSSL is configured with "no-ssl3" as a build option, servers
+     could accept and complete a SSL 3.0 handshake, and clients could be
+     configured to send them.
+     (CVE-2014-3568)
+  *) Add support for TLS_FALLBACK_SCSV.
+     Client applications doing fallback retries should call
+     SSL_set_mode(s, SSL_MODE_SEND_FALLBACK_SCSV).
+     (CVE-2014-3566)
+     [Adam Langley, Bodo Moeller]
+  *) Add additional DigestInfo checks.
+     Reencode DigestInto in DER and check against the original when
+     verifying RSA signature: this will reject any improperly encoded
+     DigestInfo structures.
+     Note: this is a precautionary measure and no attacks are currently known.
+
+-------------------------------------------------------------------
+Tue Aug 12 02:41:20 UTC 2014 - [email protected]
+
+- openssl 1.0.1i
+* Information leak in pretty printing functions (CVE-2014-3508)
+* Crash with SRP ciphersuite in Server Hello message (CVE-2014-5139)
+* Race condition in ssl_parse_serverhello_tlsext (CVE-2014-3509)
+* Double Free when processing DTLS packets (CVE-2014-3505)
+* DTLS memory exhaustion (CVE-2014-3506)
+* DTLS memory leak from zero-length fragments (CVE-2014-3507)
+* OpenSSL DTLS anonymous EC(DH) denial of service (CVE-2014-3510)
+* OpenSSL TLS protocol downgrade attack (CVE-2014-3511)
+* SRP buffer overrun (CVE-2014-3512)
+- 0005-libssl-Hide-library-private-symbols.patch Re-enable heartbleed
+  test and correctly refresh patch (issue fixed upstream)
+
+-------------------------------------------------------------------
+Thu Jun  5 11:45:02 UTC 2014 - [email protected]
+
+- Upgrade to 1.0.1h (bnc#880891):
+  - CVE-2014-0224: Fix for SSL/TLS MITM flaw. An attacker using a carefully 
crafted
+    handshake can force the use of weak keying material in OpenSSL
+    SSL/TLS clients and servers.
+  - CVE-2014-0221: Fix DTLS recursion flaw. By sending an invalid DTLS 
handshake to an
+    OpenSSL DTLS client the code can be made to recurse eventually crashing
+    in a DoS attack.
+  - CVE-2014-0195: Fix DTLS invalid fragment vulnerability. A buffer
+    overrun attack can be triggered by sending invalid DTLS fragments to
+    an OpenSSL DTLS client or server. This is potentially exploitable to
+    run arbitrary code on a vulnerable client or server.
+  - CVE-2014-3470: Fix bug in TLS code where clients enable anonymous
+    ECDH ciphersuites are subject to a denial of service attack.
+  - Harmonize version and its documentation. -f flag is used to display 
compilation flags.
+  - Fix eckey_priv_encode so it immediately returns an error upon a failure
+    in i2d_ECPrivateKey.
+  - Fix some double frees. These are not thought to be exploitable.
+
+- CVE-2014-0198.patch: upstreamed
+- CVE-2010-5298.patch: upstreamed
+- openssl-fix-pod-syntax.diff: refreshed as various fixes were done upstream
+
+- 0005-libssl-Hide-library-private-symbols.patch: This breaks compilation
+  of heartbleed testcase, disabled the test for now.
+
+-------------------------------------------------------------------
+Mon May  5 06:40:01 UTC 2014 - [email protected]
+
+- Fixed bug[ bnc#876282], CVE-2014-0198 openssl: OpenSSL NULL pointer 
dereference in do_ssl3_write
+  Add file: CVE-2014-0198.patch
+
+-------------------------------------------------------------------
+Wed Apr 23 06:11:35 UTC 2014 - [email protected]
+
+- Fixed bug[ bnc#873351] CVE-2010-5298: openssl: Use-after-free race 
condition,in OpenSSL's read buffer
+  Add file: CVE-2010-5298.patch
+
+-------------------------------------------------------------------
+Thu Apr 10 11:16:41 UTC 2014 - [email protected]
+
+- Upgrade to 1.0.1g:
+  * TLS heartbeat read overrun (CVE-2014-0160)
+  * Fixed: CVE-2013-4353, CVE-2013-6449, CVE-2013-6450, CVE-2014-0076, 
CVE-2014-0160
+
+  Add files: openssl-1.0.1g.tar.gz, openssl-1.0.1g.tar.gz.asc
+  Delete files: openssl-1.0.1e.tar.gz, openssl-1.0.1e.tar.gz.asc, 
CVE-2013-4353.patch, 
+  CVE-2013-6449.patch, CVE-2013-6450.patch, CVE-2014-0076.patch, 
bug-861384-crash_webrtc.patch, 
+  CVE-2014-0160.patch, SSL_get_certificate-broken.patch, 
openssl-1.0.1e-bnc822642.patch
+
+-------------------------------------------------------------------
+Tue Apr  8 05:20:52 UTC 2014 - [email protected]
+
+- Fixed bug[ bnc#872299] CVE-2014-0160: openssl: missing bounds checks for 
heartbeat messages
+  Add file: CVE-2014-0160.patch
+
+-------------------------------------------------------------------
+Tue Mar 25 05:18:20 UTC 2014 - [email protected]
+
+- Fix bug[ bnc#869945] CVE-2014-0076: openssl: Recovering OpenSSL ECDSA Nonces 
Using the FLUSH+RELOAD Cache Side-channel Attack
+  Add file: CVE-2014-0076.patch
+
+-------------------------------------------------------------------
+Sun Jan 26 14:20:30 UTC 2014 - [email protected]
+
+- Fixed bnc#861384, update to openssl-1.0.1e-11.14.1 broke WebRTC 
functionality in FreeSWITCH
+  Add file: bug-861384-crash_webrtc.patch
+-------------------------------------------------------------------
+Wed Jan  8 07:06:36 UTC 2014 - [email protected]
+
+- Fixed bnc#857640, openssl: TLS record tampering issue can lead to OpenSSL 
crash
+  Add file: CVE-2013-4353.patch
+
+-------------------------------------------------------------------
+Thu Jan  2 17:13:11 UTC 2014 - [email protected]
+
+- Fixed bnc#857203, openssl: crash in DTLS renegotiation after packet loss
+  Add file: CVE-2013-6450.patch 
+
+-------------------------------------------------------------------
+Sun Dec 22 08:16:16 UTC 2013 - [email protected]
+
+- Fixed bnc#856687, openssl: crash when using TLS 1.2
+  Add file: CVE-2013-6449.patch
+
+-------------------------------------------------------------------
+Tue Dec 17 13:57:40 UTC 2013 - [email protected]
+
+- compression_methods_switch.patch: setenv might not be successful
+  if a surrounding library or application filters it, like e.g. sudo.
+  As setenv() does not seem to be useful anyway, remove it.
+  bnc#849377
+
+-------------------------------------------------------------------
+Fri Sep 27 10:26:43 UTC 2013 - [email protected]
+
+- VPN openconnect problem (DTLS handshake failed)
+  (git 9fe4603b8, bnc#822642, openssl ticket#2984)
+
+-------------------------------------------------------------------
++++ 1519 more lines (skipped)
++++ between /dev/null
++++ and /work/SRC/openSUSE:13.1:Update/.openssl.3643.new/openssl.changes

New:
----
  0005-libssl-Hide-library-private-symbols.patch
  README.SuSE
  VIA_padlock_support_on_64systems.patch
  baselibs.conf
  bug610223.patch
  compression_methods_switch.patch
  merge_from_0.9.8k.patch
  openssl-1.0.0-c_rehash-compat.diff
  openssl-1.0.1c-default-paths.patch
  openssl-1.0.1e-truststore.diff
  openssl-1.0.1k.tar.gz
  openssl-1.0.1k.tar.gz.asc
  openssl-CVE-2015-0209.patch
  openssl-CVE-2015-0286.patch
  openssl-CVE-2015-0287.patch
  openssl-CVE-2015-0288.patch
  openssl-CVE-2015-0289.patch
  openssl-CVE-2015-0293.patch
  openssl-fix-pod-syntax.diff
  openssl-ocloexec.patch
  openssl-pkgconfig.patch
  openssl.changes
  openssl.spec
  openssl.test

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ openssl.spec ++++++
#
# spec file for package openssl
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           openssl
BuildRequires:  bc
BuildRequires:  ed
BuildRequires:  pkg-config
BuildRequires:  zlib-devel
%define ssletcdir %{_sysconfdir}/ssl
#%define num_version %(echo "%{version}" | sed -e "s+[a-zA-Z]++g; s+_.*++g")
%define num_version 1.0.0
Provides:       ssl
# bug437293
%ifarch ppc64
Obsoletes:      openssl-64bit
%endif
Version:        1.0.1k
Release:        0
Summary:        Secure Sockets and Transport Layer Security
License:        OpenSSL
Group:          Productivity/Networking/Security
Url:            http://www.openssl.org/
Source:         http://www.%{name}.org/source/%{name}-%{version}.tar.gz
Source42:       http://www.%{name}.org/source/%{name}-%{version}.tar.gz.asc
# to get mtime of file:
Source1:        openssl.changes
Source2:        baselibs.conf
Source10:       README.SuSE
Patch0:         merge_from_0.9.8k.patch
Patch1:         openssl-1.0.0-c_rehash-compat.diff
Patch2:         bug610223.patch
Patch3:         openssl-ocloexec.patch
Patch4:         VIA_padlock_support_on_64systems.patch
# PATCH-FIX-UPSTREAM http://rt.openssl.org/Ticket/Attachment/WithHeaders/20049
Patch5:         openssl-fix-pod-syntax.diff
Patch6:         openssl-1.0.1e-truststore.diff
Patch7:         compression_methods_switch.patch
Patch8:         0005-libssl-Hide-library-private-symbols.patch
Patch9:         openssl-1.0.1c-default-paths.patch
Patch10:        openssl-pkgconfig.patch
Patch12:        openssl-CVE-2015-0209.patch
Patch13:        openssl-CVE-2015-0286.patch
Patch14:        openssl-CVE-2015-0287.patch
Patch15:        openssl-CVE-2015-0288.patch
Patch16:        openssl-CVE-2015-0289.patch
Patch17:        openssl-CVE-2015-0293.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
The OpenSSL Project is a collaborative effort to develop a robust,
commercial-grade, full-featured, and open source toolkit implementing
the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS
v1) protocols with full-strength cryptography. The project is managed
by a worldwide community of volunteers that use the Internet to
communicate, plan, and develop the OpenSSL toolkit and its related
documentation.

Derivation and License

OpenSSL is based on the excellent SSLeay library developed by Eric A.
Young and Tim J. Hudson. The OpenSSL toolkit is licensed under an
Apache-style license, which basically means that you are free to get it
and to use it for commercial and noncommercial purposes.

%package -n libopenssl1_0_0
Summary:        Secure Sockets and Transport Layer Security
Group:          Productivity/Networking/Security
Recommends:     openssl-certs
# bug437293
%ifarch ppc64
Obsoletes:      openssl-64bit
%endif
#

%description -n libopenssl1_0_0
The OpenSSL Project is a collaborative effort to develop a robust,
commercial-grade, full-featured, and open source toolkit implementing
the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS
v1) protocols with full-strength cryptography. The project is managed
by a worldwide community of volunteers that use the Internet to
communicate, plan, and develop the OpenSSL toolkit and its related
documentation.

Derivation and License

OpenSSL is based on the excellent SSLeay library developed by Eric A.
Young and Tim J. Hudson. The OpenSSL toolkit is licensed under an
Apache-style license, which basically means that you are free to get it
and to use it for commercial and noncommercial purposes.

%package -n libopenssl-devel
Summary:        Include Files and Libraries mandatory for Development
Group:          Development/Libraries/C and C++
Obsoletes:      openssl-devel < %{version}
Requires:       %name = %version
Requires:       libopenssl1_0_0 = %{version}
Requires:       zlib-devel
Provides:       openssl-devel = %{version}
# bug437293
%ifarch ppc64
Obsoletes:      openssl-devel-64bit
%endif
#

%description -n libopenssl-devel
This package contains all necessary include files and libraries needed
to develop applications that require these.

%package doc
Summary:        Additional Package Documentation
Group:          Productivity/Networking/Security
%if 0%{?suse_version} >= 1140
BuildArch:      noarch
%endif

%description doc
This package contains optional documentation provided in addition to
this package's base documentation.

%prep
%setup -q 
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1

cp -p %{S:10} .
echo "adding/overwriting some entries in the 'table' hash in Configure"
# 
$dso_scheme:$shared_target:$shared_cflag:$shared_ldflag:$shared_extension:$ranlib:$arflags
export 
DSO_SCHEME='dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::'
cat <<EOF_ED | ed -s Configure 
/^);
-
i
#
# local configuration added from specfile
# ... MOST of those are now correct in openssl's Configure already, 
# so only add them for new ports!
#
#config-string,  
$cc:$cflags:$unistd:$thread_cflag:$sys_id:$lflags:$bn_ops:$cpuid_obj:$bn_obj:$des_obj:$aes_obj:$bf_obj:$md5_obj:$sha1_obj:$cast_obj:$rc4_obj:$rmd160_obj:$rc5_obj:$wp_obj:$cmll_obj:$dso_scheme:$shared_target:$shared_cflag:$shared_ldflag:$shared_extension:$ranlib:$arflags:$multilib
#"linux-elf",    "gcc:-DL_ENDIAN                        
::-D_REENTRANT::-ldl:BN_LLONG \${x86_gcc_des} 
\${x86_gcc_opts}:\${x86_elf_asm}:$DSO_SCHEME:",
#"linux-ia64",   "gcc:-DL_ENDIAN        
-DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK 
RC4_CHAR:\${ia64_asm}:               $DSO_SCHEME:",
#"linux-ppc",    "gcc:-DB_ENDIAN                        
::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_RISC1 
DES_UNROLL:\${no_asm}:               $DSO_SCHEME:",
#"linux-ppc64",  "gcc:-DB_ENDIAN -DMD32_REG_T=int::-D_REENTRANT::-ldl:RC4_CHAR 
RC4_CHUNK DES_RISC1 DES_UNROLL SIXTY_FOUR_BIT_LONG:\${no_asm}:   
$DSO_SCHEME:64",
"linux-elf-arm","gcc:-DL_ENDIAN                 
::-D_REENTRANT::-ldl:BN_LLONG:\${no_asm}:                                       
                $DSO_SCHEME:",
"linux-mips",   "gcc:-DB_ENDIAN                 ::-D_REENTRANT::-ldl:BN_LLONG 
RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:\${no_asm}:               $DSO_SCHEME:",
"linux-sparcv7","gcc:-DB_ENDIAN                 ::-D_REENTRANT::-ldl:BN_LLONG 
RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:\${no_asm}:                  $DSO_SCHEME:",
#"linux-sparcv8","gcc:-DB_ENDIAN -DBN_DIV2W -mv8        
::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL 
BF_PTR::asm/sparcv8.o:::::::::::::  $DSO_SCHEME:",
#"linux-x86_64", "gcc:-DL_ENDIAN -DNO_ASM 
-DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG:\${no_asm}:            
                              $DSO_SCHEME:64",
#"linux-s390",   "gcc:-DB_ENDIAN                        ::(unknown):   
:-ldl:BN_LLONG:\${no_asm}:                                                      
 $DSO_SCHEME:",
#"linux-s390x",  "gcc:-DB_ENDIAN -DNO_ASM 
-DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG:\${no_asm}:            
                      $DSO_SCHEME:64",
"linux-parisc", "gcc:-DB_ENDIAN                 ::-D_REENTRANT::-ldl:BN_LLONG 
RC4_CHAR DES_PTR DES_UNROLL DES_RISC1:\${no_asm}:                 $DSO_SCHEME:",
.
wq
EOF_ED
# fix ENGINESDIR path
sed -i 's,/lib/engines,/%_lib/engines,' Configure
# Record mtime of changes file instead of build time
CHANGES=`stat --format="%y" %SOURCE1`
sed -i -e "s|#define DATE \(.*\).LC_ALL.*date.|#define DATE \1$CHANGES|" 
crypto/Makefile

%build
%ifarch armv5el armv5tel
export MACHINE=armv5el
%endif
%ifarch armv6l armv6hl
export MACHINE=armv6l
%endif
./config --test-sanity 
#
config_flags="threads shared no-rc5 no-idea \
%ifarch x86_64 
enable-ec_nistp_64_gcc_128 \
%endif
enable-camellia \
zlib \
--prefix=%{_prefix} \
--libdir=%{_lib} \
--openssldir=%{ssletcdir} \
$RPM_OPT_FLAGS -std=gnu99 \
-Wa,--noexecstack \
-fomit-frame-pointer \
-DTERMIO \
-DPURIFY \
-DSSL_FORBID_ENULL \
-D_GNU_SOURCE \
$(getconf LFS_CFLAGS) \
%ifnarch hppa aarch64
-Wall \
-fstack-protector "
%else
-Wall "
%endif
#
#%{!?do_profiling:%define do_profiling 0}
#%if %do_profiling
#       # generate feedback
#       ./config $config_flags
#       make depend CC="gcc %cflags_profile_generate"
#       make CC="gcc %cflags_profile_generate"
#       LD_LIBRARY_PATH=`pwd` make rehash CC="gcc %cflags_profile_generate"
#       LD_LIBRARY_PATH=`pwd` make test CC="gcc %cflags_profile_generate"
#       LD_LIBRARY_PATH=`pwd` apps/openssl speed
#       make clean
#       # compile with feedback
#       # but not if it makes a cipher slower:
#       #find crypto/aes -name '*.da' | xargs -r rm
#       ./config $config_flags %cflags_profile_feedback
#       make depend
#       make
#       LD_LIBRARY_PATH=`pwd` make rehash
#       LD_LIBRARY_PATH=`pwd` make test
#%else
# OpenSSL relies on uname -m (not good). Thus that little sparc line.
        ./config \
%ifarch sparc64
                linux64-sparcv9 \
%endif
                $config_flags
        make depend
        make
        LD_LIBRARY_PATH=`pwd` make rehash
        %ifnarch armv4l
        LD_LIBRARY_PATH=`pwd` make test
        %endif
#%endif
# show settings
make TABLE
echo $RPM_OPT_FLAGS
eval $(egrep PLATFORM='[[:alnum:]]' Makefile)
grep -B1 -A22 "^\*\*\* $PLATFORM$" TABLE 

%install
rm -rf $RPM_BUILD_ROOT
make MANDIR=%{_mandir} INSTALL_PREFIX=$RPM_BUILD_ROOT install
install -d -m755 $RPM_BUILD_ROOT%{ssletcdir}/certs
ln -sf ./%{name} $RPM_BUILD_ROOT/%{_includedir}/ssl
mkdir $RPM_BUILD_ROOT/%{_datadir}/ssl
mv $RPM_BUILD_ROOT/%{ssletcdir}/misc $RPM_BUILD_ROOT/%{_datadir}/ssl/
# ln -s %{ssletcdir}/certs      $RPM_BUILD_ROOT/%{_datadir}/ssl/certs
# ln -s %{ssletcdir}/private    $RPM_BUILD_ROOT/%{_datadir}/ssl/private
# ln -s %{ssletcdir}/openssl.cnf        
$RPM_BUILD_ROOT/%{_datadir}/ssl/openssl.cnf
#

# avoid file conflicts with man pages from other packages
#
pushd $RPM_BUILD_ROOT/%{_mandir}
# some man pages now contain spaces. This makes several scripts go havoc, among 
them /usr/sbin/Check.
# replace spaces by underscores
#for i in man?/*\ *; do mv -v "$i" "${i// /_}"; done
which readlink &>/dev/null || function readlink { ( set +x; target=$(file $1 
2>/dev/null); target=${target//* }; test -f $target && echo $target; ) }
for i in man?/*; do 
        if test -L $i ; then
            LDEST=`readlink $i`
            rm -f $i ${i}ssl
            ln -sf ${LDEST}ssl ${i}ssl
        else
            mv $i ${i}ssl
        fi
        case `basename ${i%.*}` in 
            
asn1parse|ca|config|crl|crl2pkcs7|crypto|dgst|dhparam|dsa|dsaparam|enc|gendsa|genrsa|nseq|openssl|passwd|pkcs12|pkcs7|pkcs8|rand|req|rsa|rsautl|s_client|s_server|smime|spkac|ssl|verify|version|x509)
                # these are the pages mentioned in openssl(1). They go into the 
main package.
                echo %doc %{_mandir}/${i}ssl.gz >> $OLDPWD/filelist;;
            *)  
                # the rest goes into the openssl-doc package.
                echo %doc %{_mandir}/${i}ssl.gz >> $OLDPWD/filelist.doc;;
        esac
done
popd
#
# check wether some shared library has been installed
#
ls -l $RPM_BUILD_ROOT%{_libdir}
test -f $RPM_BUILD_ROOT%{_libdir}/libssl.so.%{num_version}
test -f $RPM_BUILD_ROOT%{_libdir}/libcrypto.so.%{num_version}
test -L $RPM_BUILD_ROOT%{_libdir}/libssl.so
test -L $RPM_BUILD_ROOT%{_libdir}/libcrypto.so
#
# see what we've got
#
cat > showciphers.c <<EOF
#include <openssl/err.h>
#include <openssl/ssl.h>
int main(){
unsigned int i;
SSL_CTX *ctx;
SSL *ssl;
SSL_METHOD *meth;
  meth = SSLv23_client_method();
  SSLeay_add_ssl_algorithms();
  ctx = SSL_CTX_new(meth);
  if (ctx == NULL) return 0;
  ssl = SSL_new(ctx);
  if (!ssl) return 0;
  for (i=0; ; i++) {
    int j, k;
    SSL_CIPHER *sc;
    sc = (meth->get_cipher)(i);
    if (!sc) break;
    k = SSL_CIPHER_get_bits(sc, &j);
    printf("%s\n", sc->name);
  }
  return 0;
};
EOF
gcc $RPM_OPT_FLAGS -I${RPM_BUILD_ROOT}%{_includedir} -c showciphers.c
gcc -o showciphers showciphers.o -L${RPM_BUILD_ROOT}%{_libdir} -lssl -lcrypto
LD_LIBRARY_PATH=${RPM_BUILD_ROOT}%{_libdir} ./showciphers > AVAILABLE_CIPHERS 
|| true
cat AVAILABLE_CIPHERS
# Do not install demo scripts executable under /usr/share/doc
find demos -type f -perm /111 -exec chmod 644 {} \;

#process openssllib
mkdir $RPM_BUILD_ROOT/%{_lib}
mv $RPM_BUILD_ROOT%{_libdir}/libssl.so.%{num_version} $RPM_BUILD_ROOT/%{_lib}/
mv $RPM_BUILD_ROOT%{_libdir}/libcrypto.so.%{num_version} 
$RPM_BUILD_ROOT/%{_lib}/
mv $RPM_BUILD_ROOT%{_libdir}/engines $RPM_BUILD_ROOT/%{_lib}/
cd $RPM_BUILD_ROOT%{_libdir}/
ln -sf /%{_lib}/libssl.so.%{num_version} ./libssl.so
ln -sf /%{_lib}/libcrypto.so.%{num_version} ./libcrypto.so

for engine in 4758cca atalla nuron sureware ubsec cswift chil aep; do
rm %{buildroot}/%{_lib}/engines/lib$engine.so
done

%ifnarch %{ix86} x86_64
rm %{buildroot}/%{_lib}/engines/libpadlock.so
%endif

%clean
if ! test -f /.buildenv; then rm -rf $RPM_BUILD_ROOT; fi

%post -n libopenssl1_0_0 -p /sbin/ldconfig

%postun -n libopenssl1_0_0 -p /sbin/ldconfig

%files -n libopenssl1_0_0
%defattr(-, root, root)
/%{_lib}/libssl.so.%{num_version}
/%{_lib}/libcrypto.so.%{num_version}
/%{_lib}/engines

%files -n libopenssl-devel
%defattr(-, root, root)
%{_includedir}/%{name}/
%{_includedir}/ssl
%exclude %{_libdir}/libcrypto.a
%exclude %{_libdir}/libssl.a
%{_libdir}/libssl.so
%{_libdir}/libcrypto.so
%_libdir/pkgconfig/libcrypto.pc
%_libdir/pkgconfig/libssl.pc
%_libdir/pkgconfig/openssl.pc

%files doc -f filelist.doc
%defattr(-, root, root)
%doc doc/* demos
%doc showciphers.c 

%files -f filelist
%defattr(-, root, root)
%doc CHANGE* INSTAL* AVAILABLE_CIPHERS
%doc LICENSE NEWS README README.SuSE
%dir %{ssletcdir}
%dir %{ssletcdir}/certs
%config (noreplace) %{ssletcdir}/openssl.cnf
%attr(700,root,root) %{ssletcdir}/private
%dir %{_datadir}/ssl
%{_datadir}/ssl/misc
%{_bindir}/c_rehash
%{_bindir}/%{name}

%changelog
++++++ 0005-libssl-Hide-library-private-symbols.patch ++++++
>From 89d5aecbc62842651cf22e48c405eb435feb0df3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= <[email protected]>
Date: Wed, 24 Jul 2013 23:29:05 -0400
Subject: [PATCH 5/5] libssl: Hide library private symbols

This patch only contains the libssl part (the easy one)
patch to libcrypto will follow after it is complete and good enough.

It hides all the library symbols that are not part of the public
API/ABI when GCC 4 or later is used.
---
 ssl/kssl_lcl.h | 9 +++++++++
 ssl/ssl_locl.h | 8 ++++++++
 2 files changed, 17 insertions(+)

--- openssl-1.0.1i.orig/ssl/kssl_lcl.h
+++ openssl-1.0.1i/ssl/kssl_lcl.h
@@ -61,6 +61,10 @@
 
 #include <openssl/kssl.h>
 
+#if defined(__GNUC__) && __GNUC__ >= 4
+#pragma GCC visibility push(hidden)
+#endif
+
 #ifndef OPENSSL_NO_KRB5
 
 #ifdef  __cplusplus
@@ -84,4 +88,9 @@ int kssl_tgt_is_available(KSSL_CTX *kssl
 }
 #endif
 #endif /* OPENSSL_NO_KRB5      */
+
+#if defined(__GNUC__) && __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
+
 #endif /* KSSL_LCL_H   */
--- openssl-1.0.1i.orig/ssl/ssl_locl.h
+++ openssl-1.0.1i/ssl/ssl_locl.h
@@ -165,6 +165,10 @@
 #include <openssl/ssl.h>
 #include <openssl/symhacks.h>
 
+#if defined(__GNUC__) && __GNUC__ >= 4
+#pragma GCC visibility push(hidden)
+#endif
+
 #ifdef OPENSSL_BUILD_SHLIBSSL
 # undef OPENSSL_EXTERN
 # define OPENSSL_EXTERN OPENSSL_EXPORT
@@ -1195,4 +1199,9 @@ int srp_verify_server_param(SSL *s, int
 #define dtls1_process_heartbeat SSL_test_functions()->p_dtls1_process_heartbeat
 
 #endif
+
+#if defined(__GNUC__) && __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
+
 #endif
++++++ README.SuSE ++++++
Please note that the man pages for the openssl libraries and tools
have been placed in a package on its own right: openssl-doc Please
install the openssl-doc package if you need the man pages, HTML
documentation or sample C programs.

The C header files and static libraries have also been extracted, they
can now be found in the openssl-devel package.

Your SuSE Team.
++++++ VIA_padlock_support_on_64systems.patch ++++++
--- openssl-1.0.1k.orig/engines/e_padlock.c
+++ openssl-1.0.1k/engines/e_padlock.c
@@ -101,7 +101,10 @@
    compiler choice is limited to GCC and Microsoft C. */
 #undef COMPILE_HW_PADLOCK
 #if !defined(I386_ONLY) && !defined(OPENSSL_NO_INLINE_ASM)
-# if (defined(__GNUC__) && (defined(__i386__) || defined(__i386))) || \
+# if (defined(__GNUC__) && __GNUC__>=2 && \
+       (defined(__i386__) || defined(__i386) || \
+        defined(__x86_64__) || defined(__x86_64)) \
+     ) || \
      (defined(_MSC_VER) && defined(_M_IX86))
 #  define COMPILE_HW_PADLOCK
 # endif
@@ -304,6 +307,7 @@ static volatile struct padlock_cipher_da
  * =======================================================
  */
 #if defined(__GNUC__) && __GNUC__>=2
+#if defined(__i386__) || defined(__i386)
 /*
  * As for excessive "push %ebx"/"pop %ebx" found all over.
  * When generating position-independent code GCC won't let
@@ -458,11 +462,136 @@ static inline void *name(size_t cnt,             \
        return iv;                              \
 }
 
+
+#endif
+
+#elif defined(__x86_64__) || defined(__x86_64)
+
+/* Load supported features of the CPU to see if
+   the PadLock is available. */
+       static int
+padlock_available(void)
+{
+       char vendor_string[16];
+       unsigned int eax, edx;
+       size_t  scratch;
+
+       /* Are we running on the Centaur (VIA) CPU? */
+       eax = 0x00000000;
+       vendor_string[12] = 0;
+       asm volatile (
+                       "movq   %%rbx,%1\n"
+                       "cpuid\n"
+                       "movl   %%ebx,(%2)\n"
+                       "movl   %%edx,4(%2)\n"
+                       "movl   %%ecx,8(%2)\n"
+                       "movq   %1,%%rbx"
+                       : "+a"(eax), "=&r"(scratch) : "r"(vendor_string) : 
"rcx", "rdx");
+       if (strcmp(vendor_string, "CentaurHauls") != 0)
+               return 0;
+
+       /* Check for Centaur Extended Feature Flags presence */
+       eax = 0xC0000000;
+       asm volatile ("movq %%rbx,%1; cpuid; movq %1,%%rbx"
+               : "+a"(eax), "=&r"(scratch) : : "rcx", "rdx");
+       if (eax < 0xC0000001)
+               return 0;
+
+       /* Read the Centaur Extended Feature Flags */
+       eax = 0xC0000001;
+       asm volatile ("movq %%rbx,%2; cpuid; movq %2,%%rbx"
+               : "+a"(eax), "=d"(edx), "=&r"(scratch) : : "rcx");
+
+       /* Fill up some flags */
+       padlock_use_ace = ((edx & (0x3<<6)) == (0x3<<6));
+       padlock_use_rng = ((edx & (0x3<<2)) == (0x3<<2));
+
+       return padlock_use_ace + padlock_use_rng;
+}
+
+/* Force key reload from memory to the CPU microcode.
+   Loading EFLAGS from the stack clears EFLAGS[30] 
+   which does the trick. */
+       static inline void
+padlock_reload_key(void)
+{
+       asm volatile ("pushfq; popfq");
+}
+
+#ifndef OPENSSL_NO_AES
+/*
+ * This is heuristic key context tracing. At first one
+ * believes that one should use atomic swap instructions,
+ * but it's not actually necessary. Point is that if
+ * padlock_saved_context was changed by another thread
+ * after we've read it and before we compare it with cdata,
+ * our key *shall* be reloaded upon thread context switch
+ * and we are therefore set in either case...
+ */
+       static inline void
+padlock_verify_context(struct padlock_cipher_data *cdata)
+{
+       asm volatile (
+                       "pushfq\n"
+                       "       btl     $30,(%%rsp)\n"
+                       "       jnc     1f\n"
+                       "       cmpq    %2,%1\n"
+                       "       je      1f\n"
+                       "       popfq\n"
+                       "       subq    $8,%%rsp\n"
+                       "1:     addq    $8,%%rsp\n"
+                       "       movq    %2,%0"
+                       :"+m"(padlock_saved_context)
+                       : "r"(padlock_saved_context), "r"(cdata) : "cc");
+}
+
+/* Template for padlock_xcrypt_* modes */
+/* BIG FAT WARNING: 
+ *     The offsets used with 'leal' instructions
+ *     describe items of the 'padlock_cipher_data'
+ *     structure.
+ */
+#define PADLOCK_XCRYPT_ASM(name,rep_xcrypt)    \
+       static inline void *name(size_t cnt,            \
+                       struct padlock_cipher_data *cdata,      \
+                       void *out, const void *inp)             \
+{      void *iv;                               \
+       size_t scratch;                         \
+       asm volatile ( "movq    %%rbx,%4\n"     \
+                       "       leaq    16(%0),%%rdx\n" \
+                       "       leaq    32(%0),%%rbx\n" \
+                       rep_xcrypt "\n"         \
+                       "       movq    %4,%%rbx"       \
+                       : "=a"(iv), "=c"(cnt), "=D"(out), "=S"(inp), 
"=&r"(scratch) \
+                       : "0"(cdata), "1"(cnt), "2"(out), "3"(inp)  \
+                       : "rdx", "cc", "memory");       \
+       return iv;                              \
+}
+#endif
+
+#endif /* cpu */
+
+#ifndef OPENSSL_NO_AES
+
+
 /* Generate all functions with appropriate opcodes */
 PADLOCK_XCRYPT_ASM(padlock_xcrypt_ecb, ".byte 0xf3,0x0f,0xa7,0xc8")    /* rep 
xcryptecb */
 PADLOCK_XCRYPT_ASM(padlock_xcrypt_cbc, ".byte 0xf3,0x0f,0xa7,0xd0")    /* rep 
xcryptcbc */
 PADLOCK_XCRYPT_ASM(padlock_xcrypt_cfb, ".byte 0xf3,0x0f,0xa7,0xe0")    /* rep 
xcryptcfb */
 PADLOCK_XCRYPT_ASM(padlock_xcrypt_ofb, ".byte 0xf3,0x0f,0xa7,0xe8")    /* rep 
xcryptofb */
+
+/* Our own htonl()/ntohl() */
+static inline void
+padlock_bswapl(AES_KEY *ks)
+{
+       size_t i = sizeof(ks->rd_key)/sizeof(ks->rd_key[0]);
+       unsigned int *key = ks->rd_key;
+
+       while (i--) {
+               asm volatile ("bswapl %0" : "+r"(*key));
+               key++;
+       }
+}
 #endif
 
 /* The RNG call itself */
@@ -493,8 +622,8 @@ padlock_xstore(void *addr, unsigned int
 static inline unsigned char *
 padlock_memcpy(void *dst,const void *src,size_t n)
 {
-       long       *d=dst;
-       const long *s=src;
+       size_t       *d=dst;
+       const size_t *s=src;
 
        n /= sizeof(*d);
        do { *d++ = *s++; } while (--n);
++++++ baselibs.conf ++++++
libopenssl1_0_0
  obsoletes "openssl-<targettype> <= <version>"
libopenssl-devel
  requires -libopenssl-<targettype>
  requires "libopenssl1_0_0-<targettype> = <version>"
++++++ bug610223.patch ++++++
Index: openssl-1.0.1g/Configure
===================================================================
--- openssl-1.0.1g.orig/Configure
+++ openssl-1.0.1g/Configure
@@ -1804,7 +1804,8 @@ while (<IN>)
                }
        elsif   (/^#define\s+ENGINESDIR/)
                {
-               my $foo = "$prefix/$libdir/engines";
+               #my $foo = "$prefix/$libdir/engines";
+               my $foo = "/$libdir/engines";
                $foo =~ s/\\/\\\\/g;
                print OUT "#define ENGINESDIR \"$foo\"\n";
                }
++++++ compression_methods_switch.patch ++++++
Index: openssl-1.0.1e/doc/ssl/SSL_COMP_add_compression_method.pod
===================================================================
--- openssl-1.0.1e.orig/doc/ssl/SSL_COMP_add_compression_method.pod
+++ openssl-1.0.1e/doc/ssl/SSL_COMP_add_compression_method.pod
@@ -41,6 +41,24 @@ of compression methods supported on a pe
 The OpenSSL library has the compression methods B<COMP_rle()> and (when
 especially enabled during compilation) B<COMP_zlib()> available.
 
+And, there is an environment variable to switch the compression
+methods off and on. In default the compression is off to mitigate 
+the so called CRIME attack ( CVE-2012-4929). If you want to enable 
+compression again set OPENSSL_NO_DEFAULT_ZLIB to "no".
+
+The variable can be switched on and off at runtime; when this variable
+is set "no" compression is enabled, otherwise no, for example:
+
+in shell 'export OPENSSL_NO_DEFAULT_ZLIB=no'
+or in C to call
+int setenv(const char *name, const char *value, int overwrite); and
+int unsetenv(const char *name);
+
+Note: This reverts the behavior of the variable as it was before!
+
+And pay attention that this freaure is temporary, it maybe changed by
+the following updates.
+
 =head1 WARNINGS
 
 Once the identities of the compression methods for the TLS protocol have
Index: openssl-1.0.1e/ssl/ssl_ciph.c
===================================================================
--- openssl-1.0.1e.orig/ssl/ssl_ciph.c
+++ openssl-1.0.1e/ssl/ssl_ciph.c
@@ -452,10 +452,16 @@ static void load_builtin_compressions(vo
                if (ssl_comp_methods == NULL)
                        {
                        SSL_COMP *comp = NULL;
+                       const char *nodefaultzlib;
 
                        MemCheck_off();
                        ssl_comp_methods=sk_SSL_COMP_new(sk_comp_cmp);
-                       if (ssl_comp_methods != NULL)
+
+                       /* The default is "no" compression to avoid CRIME/BEAST 
*/
+                       nodefaultzlib = getenv("OPENSSL_NO_DEFAULT_ZLIB");
+                       if (    ssl_comp_methods != NULL &&
+                               nodefaultzlib &&
+                               strncmp( nodefaultzlib, "no", 2) == 0)
                                {
                                comp=(SSL_COMP 
*)OPENSSL_malloc(sizeof(SSL_COMP));
                                if (comp != NULL)
++++++ merge_from_0.9.8k.patch ++++++
Index: openssl-1.0.1g/Configure
===================================================================
--- openssl-1.0.1g.orig/Configure
+++ openssl-1.0.1g/Configure
@@ -933,7 +933,7 @@ PROCESS_ARGS:
                        }
                else
                        {
-                       die "target already defined - $target (offending arg: 
$_)\n" if ($target ne "");
+                       warn "target already defined - $target (offending arg: 
$_)\n" if ($target ne "");
                        $target=$_;
                        }
 
@@ -1206,7 +1206,7 @@ if ($target =~ /^mingw/ && `$cc --target
 my $no_shared_warn=0;
 my $no_user_cflags=0;
 
-if ($flags ne "")      { $cflags="$flags$cflags"; }
+if ($flags ne "")      { $cflags="$cflags $flags"; }
 else                   { $no_user_cflags=1;       }
 
 # Kerberos settings.  The flavor must be provided from outside, either through
Index: openssl-1.0.1g/config
===================================================================
--- openssl-1.0.1g.orig/config
+++ openssl-1.0.1g/config
@@ -573,7 +573,8 @@ case "$GUESSOS" in
        options="$options -arch%20${MACHINE}"
        OUT="iphoneos-cross" ;;
   alpha-*-linux2)
-        ISA=`awk '/cpu model/{print$4;exit(0);}' /proc/cpuinfo`
+        #ISA=`awk '/cpu model/{print$4;exit(0);}' /proc/cpuinfo`
+       ISA=EV56
        case ${ISA:-generic} in
        *[678]) OUT="linux-alpha+bwx-$CC" ;;
        *)      OUT="linux-alpha-$CC" ;;
@@ -593,7 +594,8 @@ case "$GUESSOS" in
            echo "         You have about 5 seconds to press Ctrl-C to abort."
            (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) 
<&1
        fi
-       OUT="linux-ppc"
+       # we have the target and force it here
+       OUT="linux-ppc64"
        ;;
   ppc-*-linux2) OUT="linux-ppc" ;;
   ppc60x-*-vxworks*) OUT="vxworks-ppc60x" ;;
@@ -614,10 +616,10 @@ case "$GUESSOS" in
   sparc-*-linux2)
        KARCH=`awk '/^type/{print$3;exit(0);}' /proc/cpuinfo`
        case ${KARCH:-sun4} in
-       sun4u*) OUT="linux-sparcv9" ;;
-       sun4m)  OUT="linux-sparcv8" ;;
-       sun4d)  OUT="linux-sparcv8" ;;
-       *)      OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
+#      sun4u*) OUT="linux-sparcv9" ;;
+#      sun4m)  OUT="linux-sparcv8" ;;
+#      sun4d)  OUT="linux-sparcv8" ;;
+        *)      OUT="linux-sparcv8" ;;
        esac ;;
   parisc*-*-linux2)
        # 64-bit builds under parisc64 linux are not supported and
@@ -636,7 +638,11 @@ case "$GUESSOS" in
        #         PA8500   -> 8000   (2.0)
        #         PA8600   -> 8000   (2.0)
 
-       CPUSCHEDULE=`echo $CPUSCHEDULE|sed -e 's/7300LC/7100LC/' -e 
's/8.00/8000/'`
+       # CPUSCHEDULE=`echo $CPUSCHEDULE|sed -e 's/7300LC/7100LC/' -e 
's/8?00/8000/'`
+       # lets have CPUSCHEDULE for 1.1:
+       CPUSCHEDULE=7100LC
+       # we want to support 1.1 CPUs as well:
+       CPUARCH=1.1
        # Finish Model transformations
 
        options="$options -DB_ENDIAN -mschedule=$CPUSCHEDULE -march=$CPUARCH"
++++++ openssl-1.0.0-c_rehash-compat.diff ++++++
>From 83f318d68bbdab1ca898c94576a838cc97df4700 Mon Sep 17 00:00:00 2001
From: Ludwig Nussel <[email protected]>
Date: Wed, 21 Apr 2010 15:52:10 +0200
Subject: [PATCH] also create old hash for compatibility

---
 tools/c_rehash.in |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/tools/c_rehash.in b/tools/c_rehash.in
index bfc4a69..f8d0ce1 100644
--- a/tools/c_rehash.in
+++ b/tools/c_rehash.in
@@ -83,6 +83,7 @@ sub hash_dir {
                        next;
                }
                link_hash_cert($fname) if($cert);
+               link_hash_cert_old($fname) if($cert);
                link_hash_crl($fname) if($crl);
        }
 }
@@ -116,8 +117,9 @@ sub check_file {
 
 sub link_hash_cert {
                my $fname = $_[0];
+               my $hashopt = $_[1] || '-subject_hash';
                $fname =~ s/'/'\\''/g;
-               my ($hash, $fprint) = `"$openssl" x509 -hash -fingerprint 
-noout -in "$fname"`;
+               my ($hash, $fprint) = `"$openssl" x509 $hashopt -fingerprint 
-noout -in "$fname"`;
                chomp $hash;
                chomp $fprint;
                $fprint =~ s/^.*=//;
@@ -147,6 +149,10 @@ sub link_hash_cert {
                $hashlist{$hash} = $fprint;
 }
 
+sub link_hash_cert_old {
+               link_hash_cert($_[0], '-subject_hash_old');
+}
+
 # Same as above except for a CRL. CRL links are of the form <hash>.r<n>
 
 sub link_hash_crl {
-- 
1.6.4.2

++++++ openssl-1.0.1c-default-paths.patch ++++++
Index: openssl-1.0.1g/apps/s_client.c
===================================================================
--- openssl-1.0.1g.orig/apps/s_client.c
+++ openssl-1.0.1g/apps/s_client.c
@@ -1174,12 +1174,19 @@ bad:
        if (!set_cert_key_stuff(ctx,cert,key))
                goto end;
 
-       if ((!SSL_CTX_load_verify_locations(ctx,CAfile,CApath)) ||
-               (!SSL_CTX_set_default_verify_paths(ctx)))
+       if (CAfile == NULL && CApath == NULL)
                {
-               /* BIO_printf(bio_err,"error setting default verify 
locations\n"); */
-               ERR_print_errors(bio_err);
-               /* goto end; */
+               if (!SSL_CTX_set_default_verify_paths(ctx))
+                       {
+                       ERR_print_errors(bio_err);
+                       }
+               }
+       else
+               {
+               if (!SSL_CTX_load_verify_locations(ctx,CAfile,CApath))
+                       {
+                       ERR_print_errors(bio_err);
+                       }
                }
 
 #ifndef OPENSSL_NO_TLSEXT
Index: openssl-1.0.1g/apps/s_server.c
===================================================================
--- openssl-1.0.1g.orig/apps/s_server.c
+++ openssl-1.0.1g/apps/s_server.c
@@ -1572,13 +1572,21 @@ bad:
                }
 #endif
 
-       if ((!SSL_CTX_load_verify_locations(ctx,CAfile,CApath)) ||
-               (!SSL_CTX_set_default_verify_paths(ctx)))
+       if (CAfile == NULL && CApath == NULL)
                {
-               /* BIO_printf(bio_err,"X509_load_verify_locations\n"); */
-               ERR_print_errors(bio_err);
-               /* goto end; */
+               if (!SSL_CTX_set_default_verify_paths(ctx))
+                       {
+                       ERR_print_errors(bio_err);
+                       }
+               }
+       else
+               {
+               if (!SSL_CTX_load_verify_locations(ctx,CAfile,CApath))
+                       {
+                       ERR_print_errors(bio_err);
+                       }
                }
+
        if (vpm)
                SSL_CTX_set1_param(ctx, vpm);
 
@@ -1629,8 +1637,11 @@ bad:
                else
                        SSL_CTX_sess_set_cache_size(ctx2,128);
 
-               if ((!SSL_CTX_load_verify_locations(ctx2,CAfile,CApath)) ||
-                       (!SSL_CTX_set_default_verify_paths(ctx2)))
+               if (!SSL_CTX_load_verify_locations(ctx2,CAfile,CApath))
+                       {
+                       ERR_print_errors(bio_err);
+                       }
+               if (!SSL_CTX_set_default_verify_paths(ctx2))
                        {
                        ERR_print_errors(bio_err);
                        }
Index: openssl-1.0.1g/apps/s_time.c
===================================================================
--- openssl-1.0.1g.orig/apps/s_time.c
+++ openssl-1.0.1g/apps/s_time.c
@@ -373,12 +373,19 @@ int MAIN(int argc, char **argv)
 
        SSL_load_error_strings();
 
-       if ((!SSL_CTX_load_verify_locations(tm_ctx,CAfile,CApath)) ||
-               (!SSL_CTX_set_default_verify_paths(tm_ctx)))
+       if (CAfile == NULL && CApath == NULL)
                {
-               /* BIO_printf(bio_err,"error setting default verify 
locations\n"); */
-               ERR_print_errors(bio_err);
-               /* goto end; */
+               if (!SSL_CTX_set_default_verify_paths(tm_ctx))
+                       {
+                       ERR_print_errors(bio_err);
+                       }
+               }
+       else
+               {
+               if (!SSL_CTX_load_verify_locations(tm_ctx,CAfile,CApath))
+                       {
+                       ERR_print_errors(bio_err);
+                       }
                }
 
        if (tm_cipher == NULL)
++++++ openssl-1.0.1e-truststore.diff ++++++
Don't use the legacy /etc/ssl/certs directory anymore but rather the
p11-kit generated /var/lib/ca-certificates/openssl one (fate#314991)
Index: openssl-1.0.1e/crypto/cryptlib.h
===================================================================
--- openssl-1.0.1e.orig/crypto/cryptlib.h
+++ openssl-1.0.1e/crypto/cryptlib.h
@@ -81,7 +81,7 @@ extern "C" {
 
 #ifndef OPENSSL_SYS_VMS
 #define X509_CERT_AREA         OPENSSLDIR
-#define X509_CERT_DIR          OPENSSLDIR "/certs"
+#define X509_CERT_DIR          "/var/lib/ca-certificates/openssl"
 #define X509_CERT_FILE         OPENSSLDIR "/cert.pem"
 #define X509_PRIVATE_DIR       OPENSSLDIR "/private"
 #else
++++++ openssl-CVE-2015-0209.patch ++++++
commit 89117535f1bb3ea72a17933b703271587d7aaf0b
Author: Matt Caswell <[email protected]>
Date:   Mon Feb 9 11:38:41 2015 +0000

    Fix a failure to NULL a pointer freed on error.
    
    Inspired by BoringSSL commit 517073cd4b by Eric Roman <[email protected]>
    
    CVE-2015-0209
    
    Reviewed-by: Emilia Käsper <[email protected]>

Index: openssl-1.0.1k/crypto/ec/ec_asn1.c
===================================================================
--- openssl-1.0.1k.orig/crypto/ec/ec_asn1.c     2015-03-19 15:58:22.021039425 
+0100
+++ openssl-1.0.1k/crypto/ec/ec_asn1.c  2015-03-19 15:58:26.431103852 +0100
@@ -1142,8 +1142,6 @@ EC_KEY *d2i_ECPrivateKey(EC_KEY **a, con
                                  ERR_R_MALLOC_FAILURE);
                        goto err;
                        }
-               if (a)
-                       *a = ret;
                }
        else
                ret = *a;
@@ -1225,11 +1223,13 @@ EC_KEY *d2i_ECPrivateKey(EC_KEY **a, con
                ret->enc_flag |= EC_PKEY_NO_PUBKEY;
                }
 
+       if (a)
+               *a = ret;
        ok = 1;
 err:
        if (!ok)
                {
-               if (ret)
+               if (ret && (a == NULL || *a != ret))
                        EC_KEY_free(ret);
                ret = NULL;
                }
++++++ openssl-CVE-2015-0286.patch ++++++
commit ee5a1253285e5c9f406c8b57b0686319b70c07d8
Author: Dr. Stephen Henson <[email protected]>
Date:   Mon Mar 9 23:11:45 2015 +0000

    Fix ASN1_TYPE_cmp
    
    Fix segmentation violation when ASN1_TYPE_cmp is passed a boolean type. This
    can be triggered during certificate verification so could be a DoS attack
    against a client or a server enabling client authentication.
    
    CVE-2015-0286
    
    Reviewed-by: Richard Levitte <[email protected]>

Index: openssl-1.0.1i/crypto/asn1/a_type.c
===================================================================
--- openssl-1.0.1i.orig/crypto/asn1/a_type.c    2015-03-17 14:15:18.832332902 
+0100
+++ openssl-1.0.1i/crypto/asn1/a_type.c 2015-03-17 14:15:19.738346161 +0100
@@ -124,6 +124,9 @@ int ASN1_TYPE_cmp(const ASN1_TYPE *a, co
        case V_ASN1_OBJECT:
                result = OBJ_cmp(a->value.object, b->value.object);
                break;
+    case V_ASN1_BOOLEAN:
+        result = a->value.boolean - b->value.boolean;
+        break;
        case V_ASN1_NULL:
                result = 0;     /* They do not have content. */
                break;
++++++ openssl-CVE-2015-0287.patch ++++++
commit 1a87b757b9f755f687492f6b9f685be8e0cd82b0
Author: Dr. Stephen Henson <[email protected]>
Date:   Mon Feb 23 12:57:50 2015 +0000

    Free up passed ASN.1 structure if reused.
    
    Change the "reuse" behaviour in ASN1_item_d2i: if successful the old
    structure is freed and a pointer to the new one used. If it is not
    successful then the passed structure is untouched.
    
    Exception made for primitive types so ssl_asn1.c still works.
    
    Reviewed-by: Tim Hudson <[email protected]>
    Reviewed-by: Emilia K�sper <[email protected]>

commit a9f34a7aac5fd89f33a34fb71e954b85fbf35875
Author: Dr. Stephen Henson <[email protected]>
Date:   Mon Feb 23 02:32:44 2015 +0000

    Free up ADB and CHOICE if already initialised.
    
    CVE-2015-0287
    
    Reviewed-by: Tim Hudson <[email protected]>
    Reviewed-by: Emilia K�sper <[email protected]>

Index: openssl-1.0.1i/crypto/asn1/tasn_dec.c
===================================================================
--- openssl-1.0.1i.orig/crypto/asn1/tasn_dec.c  2015-03-17 13:18:26.732161376 
+0100
+++ openssl-1.0.1i/crypto/asn1/tasn_dec.c       2015-03-17 13:22:20.424576154 
+0100
@@ -311,9 +317,16 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval,
                if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL))
                                goto auxerr;
 
-               /* Allocate structure */
-               if (!*pval && !ASN1_item_ex_new(pval, it))
-                       {
+               if (*pval) {
+                   /* Free up and zero CHOICE value if initialised */
+                   i = asn1_get_choice_selector(pval, it);
+                   if ((i >= 0) && (i < it->tcount)) {
+                       tt = it->templates + i;
+                       pchptr = asn1_get_field_ptr(pval, tt);
+                       ASN1_template_free(pchptr, tt);
+                       asn1_set_choice_selector(pval, -1, it);
+                   }
+               } else if (!ASN1_item_ex_new(pval, it)) {
                        ASN1err(ASN1_F_ASN1_ITEM_EX_D2I,
                                                ERR_R_NESTED_ASN1_ERROR);
                        goto err;
@@ -407,6 +420,17 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval,
                if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL))
                                goto auxerr;
 
+        /* Free up and zero any ADB found */
+        for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
+            if (tt->flags & ASN1_TFLG_ADB_MASK) {
+                const ASN1_TEMPLATE *seqtt;
+                ASN1_VALUE **pseqval;
+                seqtt = asn1_do_adb(pval, tt, 1);
+                pseqval = asn1_get_field_ptr(pval, seqtt);
+                ASN1_template_free(pseqval, seqtt);
+            }
+        }
+
                /* Get each field entry */
                for (i = 0, tt = it->templates; i < it->tcount; i++, tt++)
                        {
Index: openssl-1.0.1i/doc/crypto/d2i_X509.pod
===================================================================
--- openssl-1.0.1i.orig/doc/crypto/d2i_X509.pod 2015-03-17 13:18:26.731161362 
+0100
+++ openssl-1.0.1i/doc/crypto/d2i_X509.pod      2015-03-17 13:18:52.046531518 
+0100
@@ -199,6 +199,12 @@ B<*px> is valid is broken and some parts
 persist if they are not present in the new one. As a result the use
 of this "reuse" behaviour is strongly discouraged.
 
+Current versions of OpenSSL will not modify B<*px> if an error occurs.
+If parsing succeeds then B<*px> is freed (if it is not NULL) and then
+set to the value of the newly decoded structure. As a result B<*px>
+B<must not> be allocated on the stack or an attempt will be made to
+free an invalid pointer.
+
 i2d_X509() will not return an error in many versions of OpenSSL,
 if mandatory fields are not initialized due to a programming error
 then the encoded structure may contain invalid data or omit the
++++++ openssl-CVE-2015-0288.patch ++++++
commit 51527f1e3564f210e984fe5b654c45d34e4f03d7
Author: Dr. Stephen Henson <[email protected]>
Date:   Wed Feb 18 00:34:59 2015 +0000

    Check public key is not NULL.
    
    CVE-2015-0288
    PR#3708
    
    Reviewed-by: Matt Caswell <[email protected]>
    (cherry picked from commit 28a00bcd8e318da18031b2ac8778c64147cd54f9)

Index: openssl-1.0.1i/crypto/x509/x509_req.c
===================================================================
--- openssl-1.0.1i.orig/crypto/x509/x509_req.c  2015-03-17 13:22:30.712726374 
+0100
+++ openssl-1.0.1i/crypto/x509/x509_req.c       2015-03-17 13:23:20.486453016 
+0100
@@ -92,6 +92,8 @@ X509_REQ *X509_to_X509_REQ(X509 *x, EVP_
                goto err;
 
        pktmp = X509_get_pubkey(x);
+       if (pktmp == NULL)
+               goto err;
        i=X509_REQ_set_pubkey(ret,pktmp);
        EVP_PKEY_free(pktmp);
        if (!i) goto err;
++++++ openssl-CVE-2015-0289.patch ++++++
commit d3d52c73544bba800c2a8f5ef3376358158cf2ca
Author: Emilia Kasper <[email protected]>
Date:   Fri Feb 27 16:52:23 2015 +0100

    PKCS#7: avoid NULL pointer dereferences with missing content
    
    In PKCS#7, the ASN.1 content component is optional.
    This typically applies to inner content (detached signatures),
    however we must also handle unexpected missing outer content
    correctly.
    
    This patch only addresses functions reachable from parsing,
    decryption and verification, and functions otherwise associated
    with reading potentially untrusted data.
    
    Correcting all low-level API calls requires further work.
    
    CVE-2015-0289
    
    Thanks to Michal Zalewski (Google) for reporting this issue.
    
    Reviewed-by: Steve Henson <[email protected]>

Index: openssl-1.0.1i/crypto/pkcs7/pk7_doit.c
===================================================================
--- openssl-1.0.1i.orig/crypto/pkcs7/pk7_doit.c 2015-03-17 13:23:33.961649688 
+0100
+++ openssl-1.0.1i/crypto/pkcs7/pk7_doit.c      2015-03-17 13:34:34.445347342 
+0100
@@ -272,6 +272,25 @@ BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio)
        PKCS7_RECIP_INFO *ri=NULL;
        ASN1_OCTET_STRING *os=NULL;
 
+    if (p7 == NULL) {
+        PKCS7err(PKCS7_F_PKCS7_DATAINIT, PKCS7_R_INVALID_NULL_POINTER);
+        return NULL;
+    }
+    /*
+     * The content field in the PKCS7 ContentInfo is optional, but that really
+     * only applies to inner content (precisely, detached signatures).
+     *
+     * When reading content, missing outer content is therefore treated as an
+     * error.
+     *
+     * When creating content, PKCS7_content_new() must be called before
+     * calling this method, so a NULL p7->d is always an error.
+     */
+    if (p7->d.ptr == NULL) {
+        PKCS7err(PKCS7_F_PKCS7_DATAINIT, PKCS7_R_NO_CONTENT);
+        return NULL;
+    }
+
        i=OBJ_obj2nid(p7->type);
        p7->state=PKCS7_S_HEADER;
 
@@ -433,6 +452,16 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKE
        unsigned char *ek = NULL, *tkey = NULL;
        int eklen = 0, tkeylen = 0;
 
+    if (p7 == NULL) {
+        PKCS7err(PKCS7_F_PKCS7_DATADECODE, PKCS7_R_INVALID_NULL_POINTER);
+        return NULL;
+    }
+
+    if (p7->d.ptr == NULL) {
+        PKCS7err(PKCS7_F_PKCS7_DATADECODE, PKCS7_R_NO_CONTENT);
+        return NULL;
+    }
+
        i=OBJ_obj2nid(p7->type);
        p7->state=PKCS7_S_HEADER;
 
@@ -752,6 +781,16 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio)
        STACK_OF(PKCS7_SIGNER_INFO) *si_sk=NULL;
        ASN1_OCTET_STRING *os=NULL;
 
+    if (p7 == NULL) {
+        PKCS7err(PKCS7_F_PKCS7_DATAFINAL, PKCS7_R_INVALID_NULL_POINTER);
+        return 0;
+    }
+
+    if (p7->d.ptr == NULL) {
+        PKCS7err(PKCS7_F_PKCS7_DATAFINAL, PKCS7_R_NO_CONTENT);
+        return 0;
+    }
+
        EVP_MD_CTX_init(&ctx_tmp);
        i=OBJ_obj2nid(p7->type);
        p7->state=PKCS7_S_HEADER;
@@ -796,6 +835,7 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio)
                /* If detached data then the content is excluded */
                if(PKCS7_type_is_data(p7->d.sign->contents) && p7->detached) {
                        M_ASN1_OCTET_STRING_free(os);
+            os = NULL;
                        p7->d.sign->contents->d.data = NULL;
                }
                break;
@@ -806,6 +846,7 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio)
                if(PKCS7_type_is_data(p7->d.digest->contents) && p7->detached)
                        {
                        M_ASN1_OCTET_STRING_free(os);
+            os = NULL;
                        p7->d.digest->contents->d.data = NULL;
                        }
                break;
@@ -878,24 +919,31 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio)
                M_ASN1_OCTET_STRING_set(p7->d.digest->digest, md_data, md_len);
                }
 
-       if (!PKCS7_is_detached(p7) && !(os->flags & ASN1_STRING_FLAG_NDEF))
-               {
-               char *cont;
-               long contlen;
-               btmp=BIO_find_type(bio,BIO_TYPE_MEM);
-               if (btmp == NULL)
-                       {
-                       
PKCS7err(PKCS7_F_PKCS7_DATAFINAL,PKCS7_R_UNABLE_TO_FIND_MEM_BIO);
-                       goto err;
-                       }
-               contlen = BIO_get_mem_data(btmp, &cont);
-               /* Mark the BIO read only then we can use its copy of the data
-                * instead of making an extra copy.
-                */
-               BIO_set_flags(btmp, BIO_FLAGS_MEM_RDONLY);
-               BIO_set_mem_eof_return(btmp, 0);
-               ASN1_STRING_set0(os, (unsigned char *)cont, contlen);
-               }
+    if (!PKCS7_is_detached(p7)) {
+       /*
+         * NOTE(emilia): I think we only reach os == NULL here because detached
+         * digested data support is broken.
+       */
+        if (os == NULL)
+            goto err;
+        if (!(os->flags & ASN1_STRING_FLAG_NDEF)) {
+            char *cont;
+            long contlen;
+            btmp = BIO_find_type(bio, BIO_TYPE_MEM);
+            if (btmp == NULL) {
+                PKCS7err(PKCS7_F_PKCS7_DATAFINAL, 
PKCS7_R_UNABLE_TO_FIND_MEM_BIO);
+                goto err;
+            }
+            contlen = BIO_get_mem_data(btmp, &cont);
+            /*
+             * Mark the BIO read only then we can use its copy of the data
+             * instead of making an extra copy.
+             */
+            BIO_set_flags(btmp, BIO_FLAGS_MEM_RDONLY);
+            BIO_set_mem_eof_return(btmp, 0);
+            ASN1_STRING_set0(os, (unsigned char *)cont, contlen);
+        }
+       }
        ret=1;
 err:
        EVP_MD_CTX_cleanup(&ctx_tmp);
@@ -971,6 +1019,16 @@ int PKCS7_dataVerify(X509_STORE *cert_st
        STACK_OF(X509) *cert;
        X509 *x509;
 
+    if (p7 == NULL) {
+        PKCS7err(PKCS7_F_PKCS7_DATAVERIFY, PKCS7_R_INVALID_NULL_POINTER);
+        return 0;
+    }
+
+    if (p7->d.ptr == NULL) {
+        PKCS7err(PKCS7_F_PKCS7_DATAVERIFY, PKCS7_R_NO_CONTENT);
+        return 0;
+    }
+
        if (PKCS7_type_is_signed(p7))
                {
                cert=p7->d.sign->cert;
Index: openssl-1.0.1i/crypto/pkcs7/pk7_lib.c
===================================================================
--- openssl-1.0.1i.orig/crypto/pkcs7/pk7_lib.c  2015-03-17 13:23:37.451700626 
+0100
+++ openssl-1.0.1i/crypto/pkcs7/pk7_lib.c       2015-03-17 13:36:01.708627632 
+0100
@@ -71,6 +71,7 @@ long PKCS7_ctrl(PKCS7 *p7, int cmd, long
 
        switch (cmd)
                {
+    /* NOTE(emilia): does not support detached digested data. */
        case PKCS7_OP_SET_DETACHED_SIGNATURE:
                if (nid == NID_pkcs7_signed)
                        {
@@ -459,6 +460,8 @@ int PKCS7_set_digest(PKCS7 *p7, const EV
 
 STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7)
        {
+       if (p7 == NULL || p7->d.ptr == NULL)
+               return NULL;
        if (PKCS7_type_is_signed(p7))
                {
                return(p7->d.sign->signer_info);
++++++ openssl-CVE-2015-0293.patch ++++++
commit a40c1bcb8c37fbad24d8f28f0fb0204d76f0fee2
Author: Emilia Kasper <[email protected]>
Date:   Wed Mar 4 09:05:02 2015 -0800

    Fix reachable assert in SSLv2 servers.
    
    This assert is reachable for servers that support SSLv2 and export ciphers.
    Therefore, such servers can be DoSed by sending a specially crafted
    SSLv2 CLIENT-MASTER-KEY.
    
    Also fix s2_srvr.c to error out early if the key lengths are malformed.
    These lengths are sent unencrypted, so this does not introduce an oracle.
    
    CVE-2015-0293
    
    This issue was discovered by Sean Burford (Google) and Emilia Käsper of
    the OpenSSL development team.
    
    Reviewed-by: Richard Levitte <[email protected]>
    Reviewed-by: Tim Hudson <[email protected]>

Index: openssl-1.0.1i/ssl/s2_lib.c
===================================================================
--- openssl-1.0.1i.orig/ssl/s2_lib.c    2015-03-17 14:05:13.745459798 +0100
+++ openssl-1.0.1i/ssl/s2_lib.c 2015-03-17 14:05:14.763474757 +0100
@@ -487,7 +487,7 @@ int ssl2_generate_key_material(SSL *s)
 
                OPENSSL_assert(s->session->master_key_length >= 0
                    && s->session->master_key_length
-                   < (int)sizeof(s->session->master_key));
+                   <= (int)sizeof(s->session->master_key));
                
EVP_DigestUpdate(&ctx,s->session->master_key,s->session->master_key_length);
                EVP_DigestUpdate(&ctx,&c,1);
                c++;
Index: openssl-1.0.1i/ssl/s2_srvr.c
===================================================================
--- openssl-1.0.1i.orig/ssl/s2_srvr.c   2015-03-17 14:05:13.721459445 +0100
+++ openssl-1.0.1i/ssl/s2_srvr.c        2015-03-17 14:07:43.262655766 +0100
@@ -446,9 +446,6 @@ static int get_client_master_key(SSL *s)
                SSLerr(SSL_F_GET_CLIENT_MASTER_KEY,SSL_R_NO_PRIVATEKEY);
                return(-1);
                }
-       i=ssl_rsa_private_decrypt(s->cert,s->s2->tmp.enc,
-               &(p[s->s2->tmp.clear]),&(p[s->s2->tmp.clear]),
-               (s->s2->ssl2_rollback)?RSA_SSLV23_PADDING:RSA_PKCS1_PADDING);
 
        is_export=SSL_C_IS_EXPORT(s->session->cipher);
        
@@ -467,21 +464,59 @@ static int get_client_master_key(SSL *s)
        else
                ek=5;
 
+    /*
+     * The format of the CLIENT-MASTER-KEY message is
+     * 1 byte message type
+     * 3 bytes cipher
+     * 2-byte clear key length (stored in s->s2->tmp.clear)
+     * 2-byte encrypted key length (stored in s->s2->tmp.enc)
+     * 2-byte key args length (IV etc)
+     * clear key
+     * encrypted key
+     * key args
+     *
+     * If the cipher is an export cipher, then the encrypted key bytes
+     * are a fixed portion of the total key (5 or 8 bytes). The size of
+     * this portion is in |ek|. If the cipher is not an export cipher,
+     * then the entire key material is encrypted (i.e., clear key length
+     * must be zero).
+     */
+    if ((!is_export && s->s2->tmp.clear != 0) ||
+        (is_export && s->s2->tmp.clear + ek != EVP_CIPHER_key_length(c))) {
+        ssl2_return_error(s, SSL2_PE_UNDEFINED_ERROR);
+        SSLerr(SSL_F_GET_CLIENT_MASTER_KEY,SSL_R_BAD_LENGTH);
+        return -1;
+    }
+    /*
+     * The encrypted blob must decrypt to the encrypted portion of the key.
+     * Decryption can't be expanding, so if we don't have enough encrypted
+     * bytes to fit the key in the buffer, stop now.
+     */
+    if ((is_export && s->s2->tmp.enc < ek) ||
+        (!is_export && s->s2->tmp.enc < EVP_CIPHER_key_length(c))) {
+        ssl2_return_error(s,SSL2_PE_UNDEFINED_ERROR);
+        SSLerr(SSL_F_GET_CLIENT_MASTER_KEY,SSL_R_LENGTH_TOO_SHORT);
+        return -1;
+    }
+
+    i = ssl_rsa_private_decrypt(s->cert, s->s2->tmp.enc,
+                                &(p[s->s2->tmp.clear]),
+                                &(p[s->s2->tmp.clear]),
+                                (s->s2->ssl2_rollback) ? RSA_SSLV23_PADDING :
+                                RSA_PKCS1_PADDING);
+
        /* bad decrypt */
 #if 1
        /* If a bad decrypt, continue with protocol but with a
         * random master secret (Bleichenbacher attack) */
-       if ((i < 0) ||
-               ((!is_export && (i != EVP_CIPHER_key_length(c)))
-               || (is_export && ((i != ek) || (s->s2->tmp.clear+(unsigned 
int)i !=
-                       (unsigned int)EVP_CIPHER_key_length(c))))))
-               {
+    if ((i < 0) || ((!is_export && i != EVP_CIPHER_key_length(c))
+                    || (is_export && i != ek))) {
                ERR_clear_error();
                if (is_export)
                        i=ek;
                else
                        i=EVP_CIPHER_key_length(c);
-               if (RAND_pseudo_bytes(p,i) <= 0)
+               if (RAND_pseudo_bytes(&p[s->s2->tmp.clear], i) <= 0)
                        return 0;
                }
 #else
@@ -505,7 +540,8 @@ static int get_client_master_key(SSL *s)
                }
 #endif
 
-       if (is_export) i+=s->s2->tmp.clear;
+       if (is_export)
+               i = EVP_CIPHER_key_length(c);
 
        if (i > SSL_MAX_MASTER_KEY_LENGTH)
                {
++++++ openssl-fix-pod-syntax.diff ++++++
>From [email protected]  Thu May 30 09:46:58 2013
CC: Jonathan Liu <[email protected]>
Resent-Date: Thu, 30 May 2013 09:46:58 +0200
X-Spam-Status: No, score=-2.3 required=5.0 tests=FREEMAIL_FROM, 
RCVD_IN_DNSWL_MED,T_DKIM_INVALID,T_TO_NO_BRKTS_FREEMAIL autolearn=ham 
version=3.3.2
X-Mailer: git-send-email 1.8.3
Message-ID: <[email protected]>
X-Received: by 10.68.65.134 with SMTP id x6mr5859535pbs.219.1369886755138; Wed, 
29 May 2013 21:05:55 -0700 (PDT)
Resent-To: [email protected]
Received: by openssl.net (Postfix, from userid 29209) id 1548C1E0128; Thu, 30 
May 2013 09:46:58 +0200 (CEST)
Received: by openssl.net (Postfix, from userid 65534) id 852471E12CB; Thu, 30 
May 2013 06:14:07 +0200 (CEST)
Received: by openssl.net (Postfix, from userid 30009) id 6FF4D1E12CF; Thu, 30 
May 2013 06:14:07 +0200 (CEST)
Received: from master.openssl.org (openssl.org [194.97.152.144]) by openssl.net 
(Postfix) with ESMTP id B4F491E12CB for <[email protected]>; Thu, 30 May 2013 
06:14:00 +0200 (CEST)
Received: by master.openssl.org (Postfix) id 53CEF1337D; Thu, 30 May 2013 
06:14:00 +0200 (CEST)
Received: from mail-pd0-f180.google.com (mail-pd0-f180.google.com 
[209.85.192.180]) by master.openssl.org (Postfix) with ESMTP id BD43A1337C for 
<[email protected]>; Thu, 30 May 2013 06:13:59 +0200 (CEST)
Received: by mail-pd0-f180.google.com with SMTP id 14so7525333pdc.39 for 
<[email protected]>; Wed, 29 May 2013 21:13:58 -0700 (PDT)
Received: from 60-242-179-244.static.tpgi.com.au 
(60-242-179-244.static.tpgi.com.au. [60.242.179.244]) by mx.google.com with 
ESMTPSA id gh9sm39937623pbc.37.2013.05.29.21.05.52 for <multiple recipients> 
(version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 May 2013 
21:05:54 -0700 (PDT)
Delivered-To: [email protected]
Subject: [PATCH] Fix POD errors with pod2man from Perl 5.18.
Resent-From: Lutz Jaenicke <[email protected]>
Return-Path: <[email protected]>
X-Original-To: [email protected]
X-Original-To: jaenicke@localhost
X-Original-To: [email protected]
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; 
h=from:to:cc:subject:date:message-id:x-mailer; 
bh=7+ASUI5nk0djFCejseoyvHdfe1CBnwkjfwtKd/NZiyk=; 
b=Z8nPd4yIaqDTqC2lMbn6p2B4+cFrVY1CLkKn7W9dJucX5NWdr9xJFx3uBZgzONU48L 
24eHjFUMScQtRepL0UbNbWOeUlLsTFicuSlx9FaEyK7ZY7zVzmdESmGeedInheWRaaz1 
A818XmhAGYTO09kxRTrt8lswyegygIMna7vvjV5vP7wdRPLBejxvtSj24xz+b6bEub51 
CvG+wjG+5SZt3XYdGtE3Rff49BaZg4zjpcH92H64bPsKClFx0dOYP849mEMuMzDsrcAO 
/2ZtXsPfkOHXSJAgGvvxEo7KQTUJol5+VtHzNjY7rRnrpKmS7U0+U8sasp4yetFIuXSZ U+eg==
Date: Thu, 30 May 2013 14:19:33 +1000
X-Spam-Level: 
X-Greylist: delayed 483 seconds by postgrey-1.33 at master.openssl.org; Thu, 30 
May 2013 06:13:59 CEST
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on openssl
Resent-Message-ID: <[email protected]>
To: [email protected]
From: Jonathan Liu <[email protected]>
X-RT-Original-Encoding: ascii
content-type: text/plain; charset="utf-8"
Content-Length: 12835

---
 doc/apps/cms.pod                            |   12 ++++++------
 doc/apps/smime.pod                          |   12 ++++++------
 doc/apps/ts.pod                             |    6 +++---
 doc/crypto/OPENSSL_ia32cap.pod              |    4 ++++
 doc/crypto/rand.pod                         |   14 +++++++-------
 doc/ssl/SSL_COMP_add_compression_method.pod |    4 ++--
 doc/ssl/SSL_CTX_add_session.pod             |    4 ++--
 doc/ssl/SSL_CTX_load_verify_locations.pod   |    4 ++--
 doc/ssl/SSL_CTX_set_client_CA_list.pod      |    4 ++--
 doc/ssl/SSL_CTX_set_session_id_context.pod  |    4 ++--
 doc/ssl/SSL_CTX_set_ssl_version.pod         |    4 ++--
 doc/ssl/SSL_CTX_use_psk_identity_hint.pod   |    2 +-
 doc/ssl/SSL_accept.pod                      |    4 ++--
 doc/ssl/SSL_clear.pod                       |    4 ++--
 doc/ssl/SSL_connect.pod                     |    4 ++--
 doc/ssl/SSL_do_handshake.pod                |    4 ++--
 doc/ssl/SSL_read.pod                        |    2 +-
 doc/ssl/SSL_session_reused.pod              |    4 ++--
 doc/ssl/SSL_set_fd.pod                      |    4 ++--
 doc/ssl/SSL_set_session.pod                 |    4 ++--
 doc/ssl/SSL_set_shutdown.pod                |    2 +-
 doc/ssl/SSL_shutdown.pod                    |    6 +++---
 doc/ssl/SSL_write.pod                       |    2 +-
 23 files changed, 59 insertions(+), 55 deletions(-)

Index: openssl-1.0.1h/doc/apps/ts.pod
===================================================================
--- openssl-1.0.1h.orig/doc/apps/ts.pod
+++ openssl-1.0.1h/doc/apps/ts.pod
@@ -58,19 +58,19 @@ time. Here is a brief description of the
 
 =over 4
 
-=item 1.
+=item Z<>1.
 
 The TSA client computes a one-way hash value for a data file and sends
 the hash to the TSA.
 
-=item 2.
+=item Z<>2.
 
 The TSA attaches the current date and time to the received hash value,
 signs them and sends the time stamp token back to the client. By
 creating this token the TSA certifies the existence of the original
 data file at the time of response generation.
 
-=item 3.
+=item Z<>3.
 
 The TSA client receives the time stamp token and verifies the
 signature on it. It also checks if the token contains the same hash
Index: openssl-1.0.1h/doc/crypto/OPENSSL_ia32cap.pod
===================================================================
--- openssl-1.0.1h.orig/doc/crypto/OPENSSL_ia32cap.pod
+++ openssl-1.0.1h/doc/crypto/OPENSSL_ia32cap.pod
@@ -20,6 +20,8 @@ toolkit initialization, but can be manip
 crypto library behaviour. For the moment of this writing six bits are
 significant, namely:
 
+=over 4
+
 1. bit #28 denoting Hyperthreading, which is used to distiguish
    cores with shared cache;
 2. bit #26 denoting SSE2 support;
@@ -29,6 +31,8 @@ significant, namely:
    pathes;
 6. bit #4 denoting presence of Time-Stamp Counter.
 
+=back
+
 For example, clearing bit #26 at run-time disables high-performance
 SSE2 code present in the crypto library. You might have to do this if
 target OpenSSL application is executed on SSE2 capable CPU, but under
Index: openssl-1.0.1h/doc/crypto/rand.pod
===================================================================
--- openssl-1.0.1h.orig/doc/crypto/rand.pod
+++ openssl-1.0.1h/doc/crypto/rand.pod
@@ -74,16 +74,16 @@ First up I will state the things I belie
 
 =over 4
 
-=item 1
+=item Z<>1
 
 A good hashing algorithm to mix things up and to convert the RNG 'state'
 to random numbers.
 
-=item 2
+=item Z<>2
 
 An initial source of random 'state'.
 
-=item 3
+=item Z<>3
 
 The state should be very large.  If the RNG is being used to generate
 4096 bit RSA keys, 2 2048 bit random strings are required (at a minimum).
@@ -93,13 +93,13 @@ carried away on this last point but it d
 a bad idea to keep quite a lot of RNG state.  It should be easier to
 break a cipher than guess the RNG seed data.
 
-=item 4
+=item Z<>4
 
 Any RNG seed data should influence all subsequent random numbers
 generated.  This implies that any random seed data entered will have
 an influence on all subsequent random numbers generated.
 
-=item 5
+=item Z<>5
 
 When using data to seed the RNG state, the data used should not be
 extractable from the RNG state.  I believe this should be a
@@ -108,12 +108,12 @@ data would be a private key or a passwor
 not be disclosed by either subsequent random numbers or a
 'core' dump left by a program crash.
 
-=item 6
+=item Z<>6
 
 Given the same initial 'state', 2 systems should deviate in their RNG state
 (and hence the random numbers generated) over time if at all possible.
 
-=item 7
+=item Z<>7
 
 Given the random number output stream, it should not be possible to determine
 the RNG state or the next random number.
++++++ openssl-ocloexec.patch ++++++
--- crypto/bio/b_sock.c.orig
+++ crypto/bio/b_sock.c
@@ -735,7 +735,7 @@ int BIO_get_accept_socket(char *host, in
                }
 
 again:
-       s=socket(server.sa.sa_family,SOCK_STREAM,SOCKET_PROTOCOL);
+       s=socket(server.sa.sa_family,SOCK_STREAM|SOCK_CLOEXEC,SOCKET_PROTOCOL);
        if (s == INVALID_SOCKET)
                {
                SYSerr(SYS_F_SOCKET,get_last_socket_error());
@@ -784,7 +784,7 @@ again:
                                        }
                                else    goto err;
                                }
-                       
cs=socket(client.sa.sa_family,SOCK_STREAM,SOCKET_PROTOCOL);
+                       
cs=socket(client.sa.sa_family,SOCK_STREAM|SOCK_CLOEXEC,SOCKET_PROTOCOL);
                        if (cs != INVALID_SOCKET)
                                {
                                int ii;
--- crypto/bio/bss_conn.c.orig
+++ crypto/bio/bss_conn.c
@@ -209,7 +209,7 @@ static int conn_state(BIO *b, BIO_CONNEC
                        c->them.sin_addr.s_addr=htonl(l);
                        c->state=BIO_CONN_S_CREATE_SOCKET;
 
-                       ret=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL);
+                       
ret=socket(AF_INET,SOCK_STREAM|SOCK_CLOEXEC,SOCKET_PROTOCOL);
                        if (ret == INVALID_SOCKET)
                                {
                                SYSerr(SYS_F_SOCKET,get_last_socket_error());
--- crypto/bio/bss_dgram.c.orig
+++ crypto/bio/bss_dgram.c
@@ -1101,7 +1101,7 @@ static int dgram_sctp_read(BIO *b, char
                        msg.msg_control = cmsgbuf;
                        msg.msg_controllen = 512;
                        msg.msg_flags = 0;
-                       n = recvmsg(b->num, &msg, 0);
+                       n = recvmsg(b->num, &msg, MSG_CMSG_CLOEXEC);
 
                        if (n <= 0)
                                {
@@ -1688,7 +1688,7 @@ int BIO_dgram_sctp_wait_for_dry(BIO *b)
        msg.msg_controllen = 0;
        msg.msg_flags = 0;
 
-       n = recvmsg(b->num, &msg, MSG_PEEK);
+       n = recvmsg(b->num, &msg, MSG_PEEK| MSG_CMSG_CLOEXEC);
        if (n <= 0)
                {
                if ((n < 0) && (get_last_socket_error() != EAGAIN) && 
(get_last_socket_error() != EWOULDBLOCK))
@@ -1711,7 +1711,7 @@ int BIO_dgram_sctp_wait_for_dry(BIO *b)
                msg.msg_controllen = 0;
                msg.msg_flags = 0;
 
-               n = recvmsg(b->num, &msg, 0);
+               n = recvmsg(b->num, &msg, MSG_CMSG_CLOEXEC);
                if (n <= 0)
                        {
                        if ((n < 0) && (get_last_socket_error() != EAGAIN) && 
(get_last_socket_error() != EWOULDBLOCK))
@@ -1772,7 +1772,7 @@ int BIO_dgram_sctp_wait_for_dry(BIO *b)
                        fcntl(b->num, F_SETFL, O_NONBLOCK);
                        }
 
-               n = recvmsg(b->num, &msg, MSG_PEEK);
+               n = recvmsg(b->num, &msg, MSG_PEEK | MSG_CMSG_CLOEXEC);
 
                if (is_dry)
                        {
@@ -1816,7 +1816,7 @@ int BIO_dgram_sctp_msg_waiting(BIO *b)
 
                sockflags = fcntl(b->num, F_GETFL, 0);
                fcntl(b->num, F_SETFL, O_NONBLOCK);
-               n = recvmsg(b->num, &msg, MSG_PEEK);
+               n = recvmsg(b->num, &msg, MSG_PEEK | MSG_CMSG_CLOEXEC);
                fcntl(b->num, F_SETFL, sockflags);
 
                /* if notification, process and try again */
@@ -1837,7 +1837,7 @@ int BIO_dgram_sctp_msg_waiting(BIO *b)
                        msg.msg_control = NULL;
                        msg.msg_controllen = 0;
                        msg.msg_flags = 0;
-                       n = recvmsg(b->num, &msg, 0);
+                       n = recvmsg(b->num, &msg, MSG_CMSG_CLOEXEC);
 
                        if (data->handle_notifications != NULL)
                                data->handle_notifications(b, 
data->notification_context, (void*) &snp);
--- crypto/bio/bss_file.c.orig
+++ crypto/bio/bss_file.c
@@ -120,6 +120,10 @@ BIO *BIO_new_file(const char *filename,
        {
        BIO  *ret;
        FILE *file=NULL;
+    size_t modelen = strlen (mode);
+    char newmode[modelen + 2];
+
+    memcpy (mempcpy (newmode, mode, modelen), "e", 2);
 
 #if defined(_WIN32) && defined(CP_UTF8)
        int sz, len_0 = (int)strlen(filename)+1;
@@ -162,7 +166,7 @@ BIO *BIO_new_file(const char *filename,
                file = fopen(filename,mode);
                }
 #else
-       file=fopen(filename,mode);      
+       file=fopen(filename,newmode);   
 #endif
        if (file == NULL)
                {
@@ -275,7 +279,7 @@ static long MS_CALLBACK file_ctrl(BIO *b
        long ret=1;
        FILE *fp=(FILE *)b->ptr;
        FILE **fpp;
-       char p[4];
+       char p[5];
 
        switch (cmd)
                {
@@ -392,6 +396,8 @@ static long MS_CALLBACK file_ctrl(BIO *b
                else
                        strcat(p,"t");
 #endif
+               strcat(p, "e");
+
                fp=fopen(ptr,p);
                if (fp == NULL)
                        {
--- crypto/rand/rand_unix.c.orig
+++ crypto/rand/rand_unix.c
@@ -262,7 +262,7 @@ int RAND_poll(void)
        for (i = 0; (i < sizeof(randomfiles)/sizeof(randomfiles[0])) &&
                        (n < ENTROPY_NEEDED); i++)
                {
-               if ((fd = open(randomfiles[i], O_RDONLY
+               if ((fd = open(randomfiles[i], O_RDONLY | O_CLOEXEC
 #ifdef O_NONBLOCK
                        |O_NONBLOCK
 #endif
--- crypto/rand/randfile.c.orig
+++ crypto/rand/randfile.c
@@ -137,7 +137,7 @@ int RAND_load_file(const char *file, lon
 #ifdef OPENSSL_SYS_VMS
        in=vms_fopen(file,"rb",VMS_OPEN_ATTRS);
 #else
-       in=fopen(file,"rb");
+       in=fopen(file,"rbe");
 #endif
        if (in == NULL) goto err;
 #if defined(S_IFBLK) && defined(S_IFCHR) && !defined(OPENSSL_NO_POSIX_IO)
@@ -210,7 +210,7 @@ int RAND_write_file(const char *file)
 #endif
        /* chmod(..., 0600) is too late to protect the file,
         * permissions should be restrictive from the start */
-       int fd = open(file, O_WRONLY|O_CREAT|O_BINARY, 0600);
+       int fd = open(file, O_WRONLY|O_CREAT|O_BINARY|O_CLOEXEC, 0600);
        if (fd != -1)
                out = fdopen(fd, "wb");
        }
@@ -241,7 +241,7 @@ int RAND_write_file(const char *file)
                out = vms_fopen(file,"wb",VMS_OPEN_ATTRS);
 #else
        if (out == NULL)
-               out = fopen(file,"wb");
+               out = fopen(file,"wbe");
 #endif
        if (out == NULL) goto err;
 
++++++ openssl-pkgconfig.patch ++++++
Index: openssl-1.0.1g/Makefile.org
===================================================================
--- openssl-1.0.1g.orig/Makefile.org
+++ openssl-1.0.1g/Makefile.org
@@ -367,7 +367,7 @@ libcrypto.pc: Makefile
            echo 'Requires: '; \
            echo 'Libs: -L$${libdir} -lcrypto'; \
            echo 'Libs.private: $(EX_LIBS)'; \
-           echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libcrypto.pc
+           echo 'Cflags: -DOPENSSL_LOAD_CONF -I$${includedir} 
$(KRB5_INCLUDES)' ) > libcrypto.pc
 
 libssl.pc: Makefile
        @ ( echo 'prefix=$(INSTALLTOP)'; \
@@ -381,7 +381,7 @@ libssl.pc: Makefile
            echo 'Requires: '; \
            echo 'Libs: -L$${libdir} -lssl -lcrypto'; \
            echo 'Libs.private: $(EX_LIBS)'; \
-           echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libssl.pc
+           echo 'Cflags: -DOPENSSL_LOAD_CONF -I$${includedir} 
$(KRB5_INCLUDES)' ) > libssl.pc
 
 openssl.pc: Makefile
        @ ( echo 'prefix=$(INSTALLTOP)'; \
@@ -395,7 +395,7 @@ openssl.pc: Makefile
            echo 'Requires: '; \
            echo 'Libs: -L$${libdir} -lssl -lcrypto'; \
            echo 'Libs.private: $(EX_LIBS)'; \
-           echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > openssl.pc
+           echo 'Cflags: -DOPENSSL_LOAD_CONF -I$${includedir} 
$(KRB5_INCLUDES)' ) > openssl.pc
 
 Makefile: Makefile.org Configure config
        @echo "Makefile is older than Makefile.org, Configure or config."
++++++ openssl.test ++++++

openssl autmatically tests iteslf, no further testing needed

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to