File bearssl.spec of Package bearssl

#
# spec file for package bearssl
#
# Copyright (c) 2022 SUSE LLC
#
# 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/
#

%global _lto_cflags %{?_lto_cflags} -ffat-lto-objects
Name:           bearssl
Version:        0.6
Release:        0
Summary:        Smaller SSL/TLS
License:        MIT
Group:          Productivity/Networking/Security
URL:            https://bearssl.org
Source0:        https://bearssl.org/%{name}-%{version}.tar.gz
Patch0:         %{name}-compile_flags.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
BearSSL is an implementation of the SSL/TLS protocol (RFC 5246) written
in C. It aims at offering the following features:

 * Be correct and secure. In particular, insecure protocol versions and
   choices of algorithms are not supported, by design; cryptographic
   algorithm implementations are constant-time by default.

 * Be small, both in RAM and code footprint. For instance, a minimal
   server implementation may fit in about 20 kilobytes of compiled code
   and 25 kilobytes of RAM.

 * Be highly portable. BearSSL targets not only “big” operating systems
   like Linux and Windows, but also small embedded systems and even
   special contexts like bootstrap code.

 * Be feature-rich and extensible. SSL/TLS has many defined cipher
   suites and extensions; BearSSL should implement most of them, and
   allow extra algorithm implementations to be added afterwards,
   possibly from third parties.

%package        devel
Summary:        Development files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}

%description    devel
BearSSL is an implementation of the SSL/TLS protocol (RFC 5246) written
in C. It aims at offering the following features:

 * Be correct and secure. In particular, insecure protocol versions and
   choices of algorithms are not supported, by design; cryptographic
   algorithm implementations are constant-time by default.

 * Be small, both in RAM and code footprint. For instance, a minimal
   server implementation may fit in about 20 kilobytes of compiled code
   and 25 kilobytes of RAM.

 * Be highly portable. BearSSL targets not only “big” operating systems
   like Linux and Windows, but also small embedded systems and even
   special contexts like bootstrap code.

 * Be feature-rich and extensible. SSL/TLS has many defined cipher
   suites and extensions; BearSSL should implement most of them, and
   allow extra algorithm implementations to be added afterwards,
   possibly from third parties.

%prep
%setup -q
%patch0 -p1

%build
%ifarch %ix86 x86_64
export CFLAGS="-fPIC -mssse3 -maes %{optflags}"
%else
export CFLAGS="-fPIC %{optflags}"
%endif
make %{?_smp_mflags}

%install
mkdir -p %{buildroot}%{_libdir} %{buildroot}%{_includedir} %{buildroot}%{_bindir}
install -m0644 build/libbearssl.a -t %{buildroot}%{_libdir}
install -m0644 inc/* -t %{buildroot}%{_includedir}
install -m0755 build/brssl -t %{buildroot}%{_bindir}

%files devel
%defattr(-,root,root,-)
%doc README.txt LICENSE.txt
%{_bindir}/brssl
%{_includedir}/*
%{_libdir}/libbearssl.a

%changelog
openSUSE Build Service is sponsored by