It's pretty simple. You have to create a .rpm package from the latest .tar.gz file (stunnel 5.40 in our case). You will need rpmbuild tool and also compilers and other stuff installed.
1) yum -y install glibc-devel kernel-headers kernel-devel gcc gcc-c++ autoconf automake make
2) yum -y install rpm-build
3) wget https://www.stunnel.org/downloads/stunnel-5.40.tar.gz
Since the spec file used for the build will search for some missing files, you have to create them manually otherwise the build will fail
4) touch stunnel.logrotate; touch stunnel.init
5) ln -s /usr/share/doc/stunnel-4.29 /usr/share/doc/stunnel
6) rpmbuild -ta stunnel-5.40.tar.gz
7) rpm -Uhv /root/rpmbuild/RPMS/x86_64/stunnel*
In case the rpmbuild fails you could do this:
cd /root/rpmbuild/BUILD/stunnel-5.40/
make
make install
Issue a stunnel -version at the end just to be sure that you have the latest stunnel version up & running like in my case:
root@zira /root/rpmbuild/BUILD/stunnel-5.40 (33 entries, 1 hidden)
56/23483# stunnel -version
stunnel 5.40 on x86_64-redhat-linux-gnu platform
Compiled/running with OpenSSL 1.0.1e-fips 11 Feb 2013