Accepting request 674737 from home:etamPL:branches:network:cryptocurrencies

Please add this package. It's a requirement of upcoming ethereum-cpp update.

OBS-URL: https://build.opensuse.org/request/show/674737
OBS-URL: https://build.opensuse.org/package/show/network:cryptocurrencies/libff?expand=0&rev=1
This commit is contained in:
Martin Pluskal 2019-02-14 08:04:34 +00:00 committed by Git OBS Bridge
commit f6964937cf
9 changed files with 711 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

209
00_no_bn128.patch Normal file
View File

@ -0,0 +1,209 @@
From: Adam Mizerski <adam@mizerski.pl>
Date: 2019-02-12 20:48:31
Upstream: no
References: https://github.com/scipr-lab/libff/issues/22
Subject: disable BN128
BN128 uses internally bundled dependencies, which would require more work to
package properly.
Index: libff-0~git63/CMakeLists.txt
===================================================================
--- libff-0~git63.orig/CMakeLists.txt
+++ libff-0~git63/CMakeLists.txt
@@ -9,10 +9,10 @@ endif()
set(
CURVE
- "BN128"
+ "ALT_BN128"
CACHE
STRING
- "Default curve: one of ALT_BN128, BN128, EDWARDS, MNT4, MNT6"
+ "Default curve: one of ALT_BN128, EDWARDS, MNT4, MNT6"
)
option(
@@ -135,12 +135,6 @@ add_definitions(
enable_testing()
-if(${CURVE} STREQUAL "BN128")
- add_definitions(
- -DBN_SUPPORT_SNARK=1
- )
-endif()
-
if("${DEBUG}")
add_definitions(-DDEBUG=1)
endif()
@@ -226,7 +220,5 @@ if ("${IS_LIBFF_PARENT}")
COMMAND ${CMAKE_COMMAND}
-E echo 'Built target finished'
)
-
- add_subdirectory(depends)
endif()
add_subdirectory(libff)
Index: libff-0~git63/libff/CMakeLists.txt
===================================================================
--- libff-0~git63.orig/libff/CMakeLists.txt
+++ libff-0~git63/libff/CMakeLists.txt
@@ -1,25 +1,3 @@
-set(FF_EXTRASRCS)
-set(FF_EXTRALIBS)
-if(${CURVE} STREQUAL "BN128")
- set(
- FF_EXTRASRCS
-
- ${FF_EXTRASRCS}
- algebra/curves/bn128/bn128_g1.cpp
- algebra/curves/bn128/bn128_g2.cpp
- algebra/curves/bn128/bn128_gt.cpp
- algebra/curves/bn128/bn128_init.cpp
- algebra/curves/bn128/bn128_pairing.cpp
- algebra/curves/bn128/bn128_pp.cpp
- )
- set(
- FF_EXTRALIBS
-
- ${FF_EXTRALIBS}
- zm
- )
-endif()
-
add_library(
ff
STATIC
@@ -48,15 +26,12 @@ add_library(
common/double.cpp
common/profiling.cpp
common/utils.cpp
-
- ${FF_EXTRASRCS}
)
target_link_libraries(
ff
GMP::gmp
${PROCPS_LIBRARIES}
- ${FF_EXTRALIBS}
)
target_include_directories(
ff
@@ -131,19 +106,4 @@ if ("${IS_LIBFF_PARENT}")
add_dependencies(check algebra_bilinearity_test)
add_dependencies(check algebra_groups_test)
add_dependencies(check algebra_fields_test)
-
- add_executable(
- multiexp_profile
- EXCLUDE_FROM_ALL
-
- algebra/scalar_multiplication/multiexp_profile.cpp
- )
- target_link_libraries(
- multiexp_profile
-
- ${OPENSSL_LIBRARIES}
- ff
- )
-
- add_dependencies(profile multiexp_profile)
endif()
Index: libff-0~git63/libff/algebra/curves/tests/test_bilinearity.cpp
===================================================================
--- libff-0~git63.orig/libff/algebra/curves/tests/test_bilinearity.cpp
+++ libff-0~git63/libff/algebra/curves/tests/test_bilinearity.cpp
@@ -6,9 +6,6 @@
*****************************************************************************/
#include <libff/algebra/curves/edwards/edwards_pp.hpp>
#include <libff/common/profiling.hpp>
-#ifdef CURVE_BN128
-#include <libff/algebra/curves/bn128/bn128_pp.hpp>
-#endif
#include <libff/algebra/curves/alt_bn128/alt_bn128_pp.hpp>
#include <libff/algebra/curves/mnt/mnt4/mnt4_pp.hpp>
#include <libff/algebra/curves/mnt/mnt6/mnt6_pp.hpp>
@@ -127,10 +124,4 @@ int main(void)
alt_bn128_pp::init_public_params();
pairing_test<alt_bn128_pp>();
double_miller_loop_test<alt_bn128_pp>();
-
-#ifdef CURVE_BN128 // BN128 has fancy dependencies so it may be disabled
- bn128_pp::init_public_params();
- pairing_test<bn128_pp>();
- double_miller_loop_test<bn128_pp>();
-#endif
}
Index: libff-0~git63/libff/algebra/curves/tests/test_groups.cpp
===================================================================
--- libff-0~git63.orig/libff/algebra/curves/tests/test_groups.cpp
+++ libff-0~git63/libff/algebra/curves/tests/test_groups.cpp
@@ -8,9 +8,6 @@
#include <libff/algebra/curves/mnt/mnt4/mnt4_pp.hpp>
#include <libff/algebra/curves/mnt/mnt6/mnt6_pp.hpp>
#include <libff/common/profiling.hpp>
-#ifdef CURVE_BN128
-#include <libff/algebra/curves/bn128/bn128_pp.hpp>
-#endif
#include <sstream>
#include <libff/algebra/curves/alt_bn128/alt_bn128_pp.hpp>
@@ -165,12 +162,4 @@ int main(void)
test_group<G2<alt_bn128_pp> >();
test_output<G2<alt_bn128_pp> >();
test_mul_by_q<G2<alt_bn128_pp> >();
-
-#ifdef CURVE_BN128 // BN128 has fancy dependencies so it may be disabled
- bn128_pp::init_public_params();
- test_group<G1<bn128_pp> >();
- test_output<G1<bn128_pp> >();
- test_group<G2<bn128_pp> >();
- test_output<G2<bn128_pp> >();
-#endif
}
Index: libff-0~git63/libff/algebra/fields/tests/test_fields.cpp
===================================================================
--- libff-0~git63.orig/libff/algebra/fields/tests/test_fields.cpp
+++ libff-0~git63/libff/algebra/fields/tests/test_fields.cpp
@@ -8,9 +8,6 @@
#include <libff/algebra/curves/mnt/mnt4/mnt4_pp.hpp>
#include <libff/algebra/curves/mnt/mnt6/mnt6_pp.hpp>
#include <libff/common/profiling.hpp>
-#ifdef CURVE_BN128
-#include <libff/algebra/curves/bn128/bn128_pp.hpp>
-#endif
#include <libff/algebra/curves/alt_bn128/alt_bn128_pp.hpp>
#include <libff/algebra/fields/fp12_2over3over2.hpp>
#include <libff/algebra/fields/fp6_3over2.hpp>
@@ -236,10 +233,4 @@ int main(void)
test_field<alt_bn128_Fq6>();
test_Frobenius<alt_bn128_Fq6>();
test_all_fields<alt_bn128_pp>();
-
-#ifdef CURVE_BN128 // BN128 has fancy dependencies so it may be disabled
- bn128_pp::init_public_params();
- test_field<Fr<bn128_pp> >();
- test_field<Fq<bn128_pp> >();
-#endif
}
Index: libff-0~git63/libff/common/default_types/ec_pp.hpp
===================================================================
--- libff-0~git63.orig/libff/common/default_types/ec_pp.hpp
+++ libff-0~git63/libff/common/default_types/ec_pp.hpp
@@ -23,14 +23,6 @@ typedef alt_bn128_pp default_ec_pp;
} // libff
#endif
-#ifdef CURVE_BN128
-#define LIBFF_DEFAULT_EC_PP_DEFINED
-#include <libff/algebra/curves/bn128/bn128_pp.hpp>
-namespace libff {
-typedef bn128_pp default_ec_pp;
-} // libff
-#endif
-
#ifdef CURVE_EDWARDS
#define LIBFF_DEFAULT_EC_PP_DEFINED
#include <libff/algebra/curves/edwards/edwards_pp.hpp>

40
01_shared_lib.patch Normal file
View File

@ -0,0 +1,40 @@
From: Adam Mizerski <adam@mizerski.pl>
Date: 2019-02-12 20:48:31
Upstream: no
Subject: build as shared library
Index: libff-0~git63/libff/CMakeLists.txt
===================================================================
--- libff-0~git63.orig/libff/CMakeLists.txt
+++ libff-0~git63/libff/CMakeLists.txt
@@ -1,6 +1,6 @@
add_library(
ff
- STATIC
+ SHARED
algebra/curves/alt_bn128/alt_bn128_g1.cpp
algebra/curves/alt_bn128/alt_bn128_g2.cpp
@@ -48,7 +48,7 @@ install(
)
install(
- TARGETS ff DESTINATION lib
+ TARGETS ff DESTINATION lib${LIB_SUFFIX}
)
# Tests
@@ -102,6 +102,13 @@ if ("${IS_LIBFF_PARENT}")
NAME algebra_fields_test
COMMAND algebra_fields_test
)
+ set_tests_properties(
+ algebra_bilinearity_test
+ algebra_groups_test
+ algebra_fields_test
+ PROPERTIES
+ ENVIRONMENT LD_LIBRARY_PATH=.
+ )
add_dependencies(check algebra_bilinearity_test)
add_dependencies(check algebra_groups_test)

326
02_config_hpp.patch Normal file
View File

@ -0,0 +1,326 @@
From: Adam Mizerski <adam@mizerski.pl>
Date: 2019-02-12 20:48:31
Upstream: yes
References: https://github.com/scipr-lab/libff/issues/21
Subject: add a configuration header
Index: libff-0~git63/CMakeLists.txt
===================================================================
--- libff-0~git63.orig/CMakeLists.txt
+++ libff-0~git63/CMakeLists.txt
@@ -124,13 +124,14 @@ if("${WITH_PROCPS}")
libprocps
)
else()
+ set(NO_PROCPS)
add_definitions(
-DNO_PROCPS
)
endif()
add_definitions(
- -DCURVE_${CURVE}
+ -DCURVE=${CURVE}
)
enable_testing()
@@ -156,6 +157,7 @@ if("${MONTGOMERY_OUTPUT}")
endif()
if(NOT "${USE_PT_COMPRESSION}")
+ set(NO_PT_COMPRESSION)
add_definitions(-DNO_PT_COMPRESSION=1)
endif()
Index: libff-0~git63/libff/CMakeLists.txt
===================================================================
--- libff-0~git63.orig/libff/CMakeLists.txt
+++ libff-0~git63/libff/CMakeLists.txt
@@ -1,3 +1,5 @@
+configure_file(config.hpp.in config.hpp)
+
add_library(
ff
SHARED
@@ -36,6 +38,7 @@ target_link_libraries(
target_include_directories(
ff
PUBLIC ..
+ ${CMAKE_CURRENT_BINARY_DIR}/..
)
install(
@@ -48,6 +51,10 @@ install(
)
install(
+ FILES "${CMAKE_CURRENT_BINARY_DIR}/config.hpp" DESTINATION "include/libff"
+)
+
+install(
TARGETS ff DESTINATION lib${LIB_SUFFIX}
)
Index: libff-0~git63/libff/config.hpp.in
===================================================================
--- /dev/null
+++ libff-0~git63/libff/config.hpp.in
@@ -0,0 +1,22 @@
+#ifndef LIBFF_CONFIG_HPP_
+#define LIBFF_CONFIG_HPP_
+
+#cmakedefine NO_PROCPS
+
+#define ALT_BN128 1
+#define EDWARDS 2
+#define MNT4 3
+#define MNT6 4
+#cmakedefine CURVE ${CURVE}
+
+#cmakedefine DEBUG
+#cmakedefine LOWMEM
+#cmakedefine MULTICORE
+#cmakedefine BINARY_OUTPUT
+#cmakedefine MONTGOMERY_OUTPUT
+#cmakedefine NO_PT_COMPRESSION
+#cmakedefine PROFILE_OP_COUNTS
+#cmakedefine USE_MIXED_ADDITION
+#cmakedefine USE_ASM
+
+#endif // LIBFF_CONFIG_HPP_
Index: libff-0~git63/libff/common/default_types/ec_pp.hpp
===================================================================
--- libff-0~git63.orig/libff/common/default_types/ec_pp.hpp
+++ libff-0~git63/libff/common/default_types/ec_pp.hpp
@@ -13,9 +13,11 @@
#ifndef EC_PP_HPP_
#define EC_PP_HPP_
+#include <libff/config.hpp>
+
/************************ Pick the elliptic curve ****************************/
-#ifdef CURVE_ALT_BN128
+#if CURVE == ALT_BN128
#define LIBFF_DEFAULT_EC_PP_DEFINED
#include <libff/algebra/curves/alt_bn128/alt_bn128_pp.hpp>
namespace libff {
@@ -23,7 +25,7 @@ typedef alt_bn128_pp default_ec_pp;
} // libff
#endif
-#ifdef CURVE_EDWARDS
+#if CURVE == EDWARDS
#define LIBFF_DEFAULT_EC_PP_DEFINED
#include <libff/algebra/curves/edwards/edwards_pp.hpp>
namespace libff {
@@ -31,7 +33,7 @@ typedef edwards_pp default_ec_pp;
} // libff
#endif
-#ifdef CURVE_MNT4
+#if CURVE == MNT4
#define LIBFF_DEFAULT_EC_PP_DEFINED
#include <libff/algebra/curves/mnt/mnt4/mnt4_pp.hpp>
namespace libff {
@@ -39,7 +41,7 @@ typedef mnt4_pp default_ec_pp;
} // libff
#endif
-#ifdef CURVE_MNT6
+#if CURVE == MNT6
#define LIBFF_DEFAULT_EC_PP_DEFINED
#include <libff/algebra/curves/mnt/mnt6/mnt6_pp.hpp>
namespace libff {
@@ -48,7 +50,7 @@ typedef mnt6_pp default_ec_pp;
#endif
#ifndef LIBFF_DEFAULT_EC_PP_DEFINED
-#error You must define one of the CURVE_* symbols to pick a curve for pairings.
+#error You must define the CURVE symbol to pick a curve for pairings.
#endif
#endif // EC_PP_HPP_
Index: libff-0~git63/libff/algebra/curves/alt_bn128/alt_bn128_g1.hpp
===================================================================
--- libff-0~git63.orig/libff/algebra/curves/alt_bn128/alt_bn128_g1.hpp
+++ libff-0~git63/libff/algebra/curves/alt_bn128/alt_bn128_g1.hpp
@@ -9,6 +9,7 @@
#define ALT_BN128_G1_HPP_
#include <vector>
+#include <libff/config.hpp>
#include <libff/algebra/curves/alt_bn128/alt_bn128_init.hpp>
#include <libff/algebra/curves/curve_utils.hpp>
Index: libff-0~git63/libff/algebra/curves/alt_bn128/alt_bn128_g2.hpp
===================================================================
--- libff-0~git63.orig/libff/algebra/curves/alt_bn128/alt_bn128_g2.hpp
+++ libff-0~git63/libff/algebra/curves/alt_bn128/alt_bn128_g2.hpp
@@ -9,6 +9,7 @@
#define ALT_BN128_G2_HPP_
#include <vector>
+#include <libff/config.hpp>
#include <libff/algebra/curves/alt_bn128/alt_bn128_init.hpp>
#include <libff/algebra/curves/curve_utils.hpp>
Index: libff-0~git63/libff/algebra/curves/edwards/edwards_g1.hpp
===================================================================
--- libff-0~git63.orig/libff/algebra/curves/edwards/edwards_g1.hpp
+++ libff-0~git63/libff/algebra/curves/edwards/edwards_g1.hpp
@@ -9,6 +9,7 @@
#define EDWARDS_G1_HPP_
#include <vector>
+#include <libff/config.hpp>
#include <libff/algebra/curves/curve_utils.hpp>
#include <libff/algebra/curves/edwards/edwards_init.hpp>
Index: libff-0~git63/libff/algebra/curves/edwards/edwards_g2.hpp
===================================================================
--- libff-0~git63.orig/libff/algebra/curves/edwards/edwards_g2.hpp
+++ libff-0~git63/libff/algebra/curves/edwards/edwards_g2.hpp
@@ -10,6 +10,7 @@
#include <iostream>
#include <vector>
+#include <libff/config.hpp>
#include <libff/algebra/curves/curve_utils.hpp>
#include <libff/algebra/curves/edwards/edwards_init.hpp>
Index: libff-0~git63/libff/algebra/curves/mnt/mnt4/mnt4_g1.hpp
===================================================================
--- libff-0~git63.orig/libff/algebra/curves/mnt/mnt4/mnt4_g1.hpp
+++ libff-0~git63/libff/algebra/curves/mnt/mnt4/mnt4_g1.hpp
@@ -14,6 +14,7 @@
#include <vector>
+#include <libff/config.hpp>
#include <libff/algebra/curves/curve_utils.hpp>
#include <libff/algebra/curves/mnt/mnt4/mnt4_init.hpp>
Index: libff-0~git63/libff/algebra/curves/mnt/mnt4/mnt4_g2.hpp
===================================================================
--- libff-0~git63.orig/libff/algebra/curves/mnt/mnt4/mnt4_g2.hpp
+++ libff-0~git63/libff/algebra/curves/mnt/mnt4/mnt4_g2.hpp
@@ -14,6 +14,7 @@
#include <vector>
+#include <libff/config.hpp>
#include <libff/algebra/curves/curve_utils.hpp>
#include <libff/algebra/curves/mnt/mnt4/mnt4_init.hpp>
Index: libff-0~git63/libff/algebra/curves/mnt/mnt6/mnt6_g1.hpp
===================================================================
--- libff-0~git63.orig/libff/algebra/curves/mnt/mnt6/mnt6_g1.hpp
+++ libff-0~git63/libff/algebra/curves/mnt/mnt6/mnt6_g1.hpp
@@ -14,6 +14,7 @@
#include <vector>
+#include <libff/config.hpp>
#include <libff/algebra/curves/curve_utils.hpp>
#include <libff/algebra/curves/mnt/mnt6/mnt6_init.hpp>
Index: libff-0~git63/libff/algebra/curves/mnt/mnt6/mnt6_g2.hpp
===================================================================
--- libff-0~git63.orig/libff/algebra/curves/mnt/mnt6/mnt6_g2.hpp
+++ libff-0~git63/libff/algebra/curves/mnt/mnt6/mnt6_g2.hpp
@@ -14,6 +14,7 @@
#include <vector>
+#include <libff/config.hpp>
#include <libff/algebra/curves/curve_utils.hpp>
#include <libff/algebra/curves/mnt/mnt6/mnt6_init.hpp>
Index: libff-0~git63/libff/algebra/fields/fp2.tcc
===================================================================
--- libff-0~git63.orig/libff/algebra/fields/fp2.tcc
+++ libff-0~git63/libff/algebra/fields/fp2.tcc
@@ -10,6 +10,7 @@
#ifndef FP2_TCC_
#define FP2_TCC_
+#include <libff/config.hpp>
#include <libff/algebra/fields/field_utils.hpp>
namespace libff {
Index: libff-0~git63/libff/algebra/fields/fp3.tcc
===================================================================
--- libff-0~git63.orig/libff/algebra/fields/fp3.tcc
+++ libff-0~git63/libff/algebra/fields/fp3.tcc
@@ -10,6 +10,7 @@
#ifndef FP3_TCC_
#define FP3_TCC_
+#include <libff/config.hpp>
#include <libff/algebra/fields/field_utils.hpp>
namespace libff {
Index: libff-0~git63/libff/algebra/scalar_multiplication/multiexp.tcc
===================================================================
--- libff-0~git63.orig/libff/algebra/scalar_multiplication/multiexp.tcc
+++ libff-0~git63/libff/algebra/scalar_multiplication/multiexp.tcc
@@ -18,6 +18,7 @@
#include <cassert>
#include <type_traits>
+#include <libff/config.hpp>
#include <libff/algebra/fields/bigint.hpp>
#include <libff/algebra/fields/fp_aux.tcc>
#include <libff/algebra/scalar_multiplication/multiexp.hpp>
Index: libff-0~git63/libff/common/utils.hpp
===================================================================
--- libff-0~git63.orig/libff/common/utils.hpp
+++ libff-0~git63/libff/common/utils.hpp
@@ -16,6 +16,8 @@
#include <string>
#include <vector>
+#include <libff/config.hpp>
+
namespace libff {
typedef std::vector<bool> bit_vector;
Index: libff-0~git63/libff/algebra/fields/bigint.tcc
===================================================================
--- libff-0~git63.orig/libff/algebra/fields/bigint.tcc
+++ libff-0~git63/libff/algebra/fields/bigint.tcc
@@ -13,6 +13,8 @@
#include <cstring>
#include <random>
+#include <libff/config.hpp>
+
namespace libff {
template<mp_size_t n>
Index: libff-0~git63/libff/algebra/fields/fp.hpp
===================================================================
--- libff-0~git63.orig/libff/algebra/fields/fp.hpp
+++ libff-0~git63/libff/algebra/fields/fp.hpp
@@ -10,6 +10,7 @@
#ifndef FP_HPP_
#define FP_HPP_
+#include <libff/config.hpp>
#include <libff/algebra/exponentiation/exponentiation.hpp>
#include <libff/algebra/fields/bigint.hpp>
Index: libff-0~git63/libff/common/serialization.hpp
===================================================================
--- libff-0~git63.orig/libff/common/serialization.hpp
+++ libff-0~git63/libff/common/serialization.hpp
@@ -18,6 +18,8 @@
#include <set>
#include <vector>
+#include <libff/config.hpp>
+
namespace libff {
/*

3
libff-0~git63.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:323114b1e62ea3729c0916c149f606ceb86e517802577090a016e5e888dfa0e8
size 68264

8
libff.changes Normal file
View File

@ -0,0 +1,8 @@
-------------------------------------------------------------------
Mon Jan 21 21:26:14 UTC 2019 - Adam Mizerski <adam@mizerski.pl>
- new package; version 0~git63
- added patches:
* 00_no_bn128.patch
* 01_shared_lib.patch
* 02_config_hpp.patch

78
libff.spec Normal file
View File

@ -0,0 +1,78 @@
#
# spec file for package libff
#
# Copyright (c) 2019 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 https://bugs.opensuse.org/
#
Name: libff
Version: 0~git63
Release: 0
Summary: C++ library for Finite Fields and Elliptic Curves
License: MIT
Group: System/Libraries
URL: https://github.com/scipr-lab/libff
Source0: %{name}-%{version}.tar.xz
Source99: prepare_source.sh
Patch0: 00_no_bn128.patch
Patch1: 01_shared_lib.patch
Patch2: 02_config_hpp.patch
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: gmp-devel
BuildRequires: libopenssl-1_1-devel
%description
libff is a C++ library for finite fields and elliptic curves.
%package devel
Summary: Development files for libff
Group: Development/Libraries/C and C++
Requires: libff = %{version}
%description devel
The %{name}-devel package contains libraries and header files for developing applications that use libff.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%build
%cmake \
-DWITH_PROCPS=OFF
%if %suse_version > 1500
%cmake_build
%else
%make_jobs
%endif
%check
cd build
make %{?_smp_mflags} check
%install
%cmake_install
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%{_libdir}/libff.so
%files devel
%{_includedir}/libff/
%changelog

23
prepare_source.sh Normal file
View File

@ -0,0 +1,23 @@
#!/bin/bash
# Use this script to make source tarball.
git clone https://github.com/scipr-lab/libff.git
cd libff
# https://en.opensuse.org/openSUSE:Package_naming_guidelines#SCM_snapshots
version="0~git$(git rev-list master | wc -l)"
rm -rf .git*
# see 00_no_bn128.patch
rm -r depends
rm -r libff/algebra/curves/bn128
rm libff/algebra/scalar_multiplication/multiexp_profile.cpp
find . -type f -exec chmod -x {} +
cd ..
mv libff "libff-${version}"
tar -caf "libff-${version}.tar.xz" "libff-${version}"
rm -r "libff-${version}"