mirror of https://github.com/zcash/libsnark.git
Update license and README to account for merging of our pairing precomputation code in ate-pairing upstream.
This commit is contained in:
parent
7bf95fe074
commit
d2238de313
42
LICENSE
42
LICENSE
|
@ -22,45 +22,3 @@ All files, with the exceptions below, are released under the MIT License:
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
|
|
||||||
********************************************************************************
|
|
||||||
|
|
||||||
EXCEPTIONS:
|
|
||||||
|
|
||||||
The following file includes code portions from the ate-pairing library
|
|
||||||
<https://github.com/herumi/ate-pairing> by MITSUNARI Shigeo and TERUYA Tadanori:
|
|
||||||
- src/algebra/curves/bn128/bn128_pairing.cpp
|
|
||||||
They are therefore licensed under the same license as ate-pairing, namely
|
|
||||||
"modified new BSD License <http://opensource.org/licenses/BSD-3-Clause>".
|
|
||||||
That referenced web page specifies the following license:
|
|
||||||
|
|
||||||
Copyright (c) <YEAR>, <OWNER>
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions
|
|
||||||
are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
3. Neither the name of the copyright holder nor the names of its
|
|
||||||
contributors may be used to endorse or promote products derived from
|
|
||||||
this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
|
@ -116,9 +116,6 @@ options:
|
||||||
run `sudo setsebool -P allow_execheap 1` to allow execution,
|
run `sudo setsebool -P allow_execheap 1` to allow execution,
|
||||||
or use `make CURVE=ALT_BN128` instead.
|
or use `make CURVE=ALT_BN128` instead.
|
||||||
|
|
||||||
* The \[ate-pairing] code is licensed under a "modified new BSD
|
|
||||||
License", as opposed to libsnark's MIT license.
|
|
||||||
|
|
||||||
* "alt_bn128":
|
* "alt_bn128":
|
||||||
an alternative to "bn128", somewhat slower but avoids dynamic code generation.
|
an alternative to "bn128", somewhat slower but avoids dynamic code generation.
|
||||||
|
|
||||||
|
|
|
@ -2,58 +2,12 @@
|
||||||
********************************************************************************
|
********************************************************************************
|
||||||
Implements functions for computing Ate pairings over the bn128 curves, split into a
|
Implements functions for computing Ate pairings over the bn128 curves, split into a
|
||||||
offline and online stages.
|
offline and online stages.
|
||||||
|
|
||||||
This code is based on the ate-pairing pairing code (https://github.com/herumi/ate-pairing),
|
|
||||||
split into offline and online stages.
|
|
||||||
********************************************************************************
|
********************************************************************************
|
||||||
* @author This file is part of libsnark, developed by SCIPR Lab
|
* @author This file is part of libsnark, developed by SCIPR Lab
|
||||||
* and contributors (see AUTHORS).
|
* and contributors (see AUTHORS).
|
||||||
* Uses portions of ate-pairing <https://github.com/herumi/ate-pairing> by
|
* @copyright MIT license (see LICENSE file)
|
||||||
* MITSUNARI Shigeo and TERUYA Tadanori
|
|
||||||
* @copyright modified new BSD License (http://opensource.org/licenses/BSD-3-Clause)
|
|
||||||
* (see LICENSE file)
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
/*
|
|
||||||
The "bn128" curve choice included in libsnark is based on the ate-pairing library by
|
|
||||||
MITSUNARI Shigeo and TERUYA Tadanori [https://github.com/herumi/ate-pairing].
|
|
||||||
|
|
||||||
The ate-pairing library is licensed under "modified new BSD License"
|
|
||||||
[http://opensource.org/licenses/BSD-3-Clause].
|
|
||||||
|
|
||||||
While the ate-pairing library does not include explicit license text, the license
|
|
||||||
template at the link above is:
|
|
||||||
|
|
||||||
Copyright (c) <YEAR>, <OWNER>
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are
|
|
||||||
met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
3. Neither the name of the copyright holder nor the names of its
|
|
||||||
contributors may be used to endorse or promote products derived from
|
|
||||||
this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
#include "algebra/curves/bn128/bn128_pairing.hpp"
|
#include "algebra/curves/bn128/bn128_pairing.hpp"
|
||||||
#include "common/profiling.hpp"
|
#include "common/profiling.hpp"
|
||||||
#include "algebra/curves/bn128/bn128_init.hpp"
|
#include "algebra/curves/bn128/bn128_init.hpp"
|
||||||
|
@ -195,18 +149,6 @@ std::istream& operator>>(std::istream &in, bn128_ate_G2_precomp &prec_Q)
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
|
||||||
void doubling_step_for_flipped_miller_loop(Fp2 *current, bn128_ate_ell_coeffs &l)
|
|
||||||
{
|
|
||||||
Fp6::pointDblLineEvalWithoutP(l, current);
|
|
||||||
}
|
|
||||||
|
|
||||||
void mixed_addition_step_for_flipped_miller_loop(const Fp2* Q,
|
|
||||||
Fp2 *R,
|
|
||||||
bn128_ate_ell_coeffs &l)
|
|
||||||
{
|
|
||||||
Fp6::pointAddLineEvalWithoutP(l, R, Q);
|
|
||||||
}
|
|
||||||
|
|
||||||
bn128_ate_G1_precomp bn128_ate_precompute_G1(const bn128_G1& P)
|
bn128_ate_G1_precomp bn128_ate_precompute_G1(const bn128_G1& P)
|
||||||
{
|
{
|
||||||
enter_block("Call to bn128_ate_precompute_G1");
|
enter_block("Call to bn128_ate_precompute_G1");
|
||||||
|
@ -223,7 +165,7 @@ bn128_ate_G2_precomp bn128_ate_precompute_G2(const bn128_G2& Q)
|
||||||
enter_block("Call to bn128_ate_precompute_G2");
|
enter_block("Call to bn128_ate_precompute_G2");
|
||||||
|
|
||||||
bn128_ate_G2_precomp result;
|
bn128_ate_G2_precomp result;
|
||||||
bn::experimental::precomputeG2(result.coeffs, result.Q, Q.coord);
|
bn::experimental::precomputeG2(result.coeffs, result.Q, Q.coord);
|
||||||
|
|
||||||
leave_block("Call to bn128_ate_precompute_G2");
|
leave_block("Call to bn128_ate_precompute_G2");
|
||||||
return result;
|
return result;
|
||||||
|
@ -233,8 +175,8 @@ bn128_Fq12 bn128_ate_miller_loop(const bn128_ate_G1_precomp &prec_P,
|
||||||
const bn128_ate_G2_precomp &prec_Q)
|
const bn128_ate_G2_precomp &prec_Q)
|
||||||
{
|
{
|
||||||
bn128_Fq12 f;
|
bn128_Fq12 f;
|
||||||
bn::experimental::millerLoop(f.elem, prec_Q.coeffs, prec_P.P);
|
bn::experimental::millerLoop(f.elem, prec_Q.coeffs, prec_P.P);
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
bn128_Fq12 bn128_double_ate_miller_loop(const bn128_ate_G1_precomp &prec_P1,
|
bn128_Fq12 bn128_double_ate_miller_loop(const bn128_ate_G1_precomp &prec_P1,
|
||||||
|
@ -243,8 +185,8 @@ bn128_Fq12 bn128_double_ate_miller_loop(const bn128_ate_G1_precomp &prec_P1,
|
||||||
const bn128_ate_G2_precomp &prec_Q2)
|
const bn128_ate_G2_precomp &prec_Q2)
|
||||||
{
|
{
|
||||||
bn128_Fq12 f;
|
bn128_Fq12 f;
|
||||||
bn::experimental::millerLoop2(f.elem, prec_Q1.coeffs, prec_P1.P, prec_Q2.coeffs, prec_P2.P);
|
bn::experimental::millerLoop2(f.elem, prec_Q1.coeffs, prec_P1.P, prec_Q2.coeffs, prec_P2.P);
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
bn128_GT bn128_final_exponentiation(const bn128_Fq12 &elt)
|
bn128_GT bn128_final_exponentiation(const bn128_Fq12 &elt)
|
||||||
|
|
|
@ -2,58 +2,12 @@
|
||||||
********************************************************************************
|
********************************************************************************
|
||||||
Declares functions for computing Ate pairings over the bn128 curves, split into a
|
Declares functions for computing Ate pairings over the bn128 curves, split into a
|
||||||
offline and online stages.
|
offline and online stages.
|
||||||
|
|
||||||
This code is based on the ate-pairing pairing code <https://github.com/herumi/ate-pairing>,
|
|
||||||
split into offline and online stages.
|
|
||||||
********************************************************************************
|
********************************************************************************
|
||||||
* @author This file is part of libsnark, developed by SCIPR Lab
|
* @author This file is part of libsnark, developed by SCIPR Lab
|
||||||
* and contributors (see AUTHORS).
|
* and contributors (see AUTHORS).
|
||||||
* Uses portions of ate-pairing <https://github.com/herumi/ate-pairing> by
|
* @copyright MIT license (see LICENSE file)
|
||||||
* MITSUNARI Shigeo and TERUYA Tadanori
|
|
||||||
* @copyright modified new BSD License (http://opensource.org/licenses/BSD-3-Clause)
|
|
||||||
* (see LICENSE file)
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
/*
|
|
||||||
The "bn128" curve choice included in libsnark is based on the ate-pairing library by
|
|
||||||
MITSUNARI Shigeo and TERUYA Tadanori [https://github.com/herumi/ate-pairing].
|
|
||||||
|
|
||||||
The ate-pairing library is licensed under "modified new BSD License"
|
|
||||||
[http://opensource.org/licenses/BSD-3-Clause].
|
|
||||||
|
|
||||||
While the ate-pairing library does not include explicit license text, the license
|
|
||||||
template at the link above is:
|
|
||||||
|
|
||||||
Copyright (c) <YEAR>, <OWNER>
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are
|
|
||||||
met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
3. Neither the name of the copyright holder nor the names of its
|
|
||||||
contributors may be used to endorse or promote products derived from
|
|
||||||
this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
#ifndef BN128_PAIRING_HPP_
|
#ifndef BN128_PAIRING_HPP_
|
||||||
#define BN128_PAIRING_HPP_
|
#define BN128_PAIRING_HPP_
|
||||||
#include "algebra/curves/bn128/bn128_g1.hpp"
|
#include "algebra/curves/bn128/bn128_g1.hpp"
|
||||||
|
|
Loading…
Reference in New Issue