Longfellow ZK 0290cb32
Loading...
Searching...
No Matches
p256.h
1// Copyright 2025 Google LLC.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef PRIVACY_PROOFS_ZK_LIB_EC_P256_H_
16#define PRIVACY_PROOFS_ZK_LIB_EC_P256_H_
17
18/*
19This file declares the one instance of the P256 curve and its related fields.
20There should be only one instance of this curve in any program due to the
21typing conventions.
22
23This curve is also known as secp256r1 and prime256v1.
24
25It is defined over the base field F_p for
26p = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff
27= 115792089210356248762697446949407573530086143415290314195533631308867097853951
28
29and has an order of
300xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551
31115792089210356248762697446949407573529996955224135760342422259061068512044369
32
33
34*/
35
36#include "algebra/fp.h"
37#include "algebra/fp_p256.h"
38#include "ec/elliptic_curve.h"
39
40namespace proofs {
41
42using Fp256Base = Fp256<true>;
43using Fp256Scalar = Fp<4, true>;
44using Fp256Nat = Fp256Base::N;
45
46// This is the base field of the curve.
47extern const Fp256Base p256_base;
48
49// Order of the curve.
50extern const Fp256Nat n256_order;
51
52// This field allows operations mod the order of the curve.
53extern const Fp256Scalar p256_scalar;
54
56
57extern const P256 p256;
58} // namespace proofs
59
60#endif // PRIVACY_PROOFS_ZK_LIB_EC_P256_H_
Definition elliptic_curve.h:34