diff --git a/README.md b/README.md index 0c803fc..31d9d39 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # mbedtls2 +Mbed TLS is a C library that implements cryptographic primitives, X.509 certificate manipulation and the SSL/TLS and DTLS protocols. Its small code footprint makes it suitable for embedded systems. + diff --git a/mbedtls2.spec b/mbedtls2.spec new file mode 100644 index 0000000..40aa9fe --- /dev/null +++ b/mbedtls2.spec @@ -0,0 +1,124 @@ +Name: mbedtls2 +Version: 2.28.6 +Release: 1mamba +Summary: A C library that implements cryptographic primitives, X.509 certificate manipulation and the SSL/TLS and DTLS protocols +Group: System/Libraries +Vendor: openmamba +Distribution: openmamba +Packager: Silvan Calarco +URL: https://www.trustedfirmware.org/projects/mbed-tls/ +Source: https://github.com/ARMmbed/mbedtls.git/v%{version}/mbedtls-%{version}.tar.bz2 +License: Apache License 2.0 +## AUTOBUILDREQ-BEGIN +BuildRequires: glibc-devel +## AUTOBUILDREQ-END +BuildRequires: cmake +Obsoletes: mbedtls13 < 2.28.6 +Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release} + +%description +Mbed TLS is a C library that implements cryptographic primitives, X.509 certificate manipulation and the SSL/TLS and DTLS protocols. Its small code footprint makes it suitable for embedded systems. + +%package -n lib%{name} +Group: System/Libraries +Summary: Shared libraries for %{name} +Obsoletes: libmbedtls13 < 2.28.6 + +%description -n lib%{name} +This package contains shared libraries for %{name}. + +%package -n lib%{name}-devel +Group: Development/Libraries +Summary: Development files for %{name} +Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release} +Obsoletes: libmbedtls13-devel < 2.28.6 + +%description -n lib%{name}-devel +This package contains libraries and header files for developing applications that use %{name}. + + +%debug_package + +%prep +%setup -q -n mbedtls-%{version} +sed -i -e "s|//#define MBEDTLS_SSL_DTLS_SRTP|#define MBEDTLS_SSL_DTLS_SRTP|" include/mbedtls/config.h + +## enable flags for non-embedded systems +#sed -i 's|//\(#define MBEDTLS_THREADING_C\)|\1|' include/mbedtls/config.h +#sed -i 's|//\(#define MBEDTLS_THREADING_PTHREAD\)|\1|' include/mbedtls/config.h + +## broken in 2.25.0 +#sed -i 's/thread_id, -ret/thread_id, (unsigned int)(-ret)/' programs/ssl/ssl_pthread_server.c +#sed -i 's/thread_id, ret/thread_id, (unsigned int)ret/' programs/ssl/ssl_pthread_server.c +#sed -i 's/ -ret );/ (unsigned int)(-ret) );/' programs/ssl/ssl_pthread_server.c +#sed -i 's/ -ret, error_buf/ (unsigned int)(-ret), error_buf/' programs/ssl/ssl_pthread_server.c +#sed -i 's/04x\\n", ret /04x\\n", (unsigned int)ret /' programs/ssl/ssl_pthread_server.c + +%build +export CC=/usr/bin/clang +export CXX=/usr/bin/clang++ + +%cmake -d build \ + -DUSE_SHARED_MBEDTLS_LIBRARY=ON \ + -DMBEDTLS_FATAL_WARNINGS=OFF \ + -DUSE_SHARED_MBEDTLS_LIBRARY=ON \ + -DUSE_STATIC_MBEDTLS_LIBRARY=OFF \ + -Wno-dev \ +%ifnarch x86_64 aarch64 + -DENABLE_TESTING=OFF +%endif + +%make + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +%makeinstall -C build + +chmod +x %{buildroot}%{_libdir}/lib*.so* + +rm -rf %{buildroot}%{_libdir}/{cmake,*.so} +install -d -m0755 %{buildroot}{%{_includedir},%{_libdir}}/mbedtls2 +mv %{buildroot}%{_includedir}/{mbedtls,psa} %{buildroot}%{_includedir}/mbedtls2/ +ln -s ../libmbedcrypto.so.7 %{buildroot}%{_libdir}/mbedtls2/libmbedcrypto.so +ln -s ../libmbedtls.so.14 %{buildroot}%{_libdir}/mbedtls2/libmbedtls.so +ln -s ../libmbedx509.so.1 %{buildroot}%{_libdir}/mbedtls2/libmbedx509.so + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%post -n lib%{name} -p /sbin/ldconfig +%postun -n lib%{name} -p /sbin/ldconfig + +%files +%defattr(-,root,root) +%{_bindir}/* + +%files -n lib%{name} +%defattr(-,root,root) +%{_libdir}/libmbedcrypto.so.* +%{_libdir}/libmbedtls.so.* +%{_libdir}/libmbedx509.so.* +%doc LICENSE + +%files -n lib%{name}-devel +%defattr(-,root,root) +%dir %{_includedir}/mbedtls2 +%{_includedir}/mbedtls2/* +%dir %{_libdir}/mbedtls2 +%{_libdir}/mbedtls2/libmbedcrypto.so +%{_libdir}/mbedtls2/libmbedtls.so +%{_libdir}/mbedtls2/libmbedx509.so +%doc ChangeLog README.md + +%changelog +* Thu Nov 23 2023 Silvan Calarco 2.28.6-1mamba +- update to 2.28.6 + +* Sat Sep 17 2022 Silvan Calarco 2.26.0-2mamba +- legacy package + +* Sat May 08 2021 Automatic Build System 2.26.0-1mamba +- automatic version update by autodist + +* Fri May 07 2021 Silvan Calarco 2.25.0-1mamba +- package created using the webbuild interface