You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
: Denotes the element of array `X` at index `i`. Note that arrays in this document are considered "zero-indexed", meaning that element indexing starts from 0 rather than 1. For example, if `X = [a, b, c, d]` then `X[0] = a`, `X[1] = b`, `X[2] = c` and `X[3] = d`.
187
187
188
-
Terms specific to pairing-friendly elliptic curves that are relevant to this document are restated below, originally defined in [@!I-D.irtf-cfrg-pairing-friendly-curves].
188
+
Terms specific to pairing-friendly elliptic curves that are relevant to this document are restated below, originally defined in [@I-D.irtf-cfrg-pairing-friendly-curves].
189
189
190
190
E1, E2
191
191
: elliptic curve groups defined over finite fields. This document assumes that E1 has a more compact representation than E2, i.e., because E1 is defined over a smaller field than E2. For a pairing-friendly curve, this document denotes operations in E1 and E2 in additive notation, i.e., P + Q denotes point addition and x \* P denotes scalar multiplication.
@@ -572,7 +572,8 @@ The operations of this section make use of functions and sub-routines defined in
572
572
573
573
-`hash_to_scalar` is defined in (#hash-to-scalar)
574
574
-`calculate_domain` and `calculate_challenge` are defined in (#domain-calculation) and (#challenge-calculation) correspondingly.
575
-
-`serialize`, `signature_to_octets`, `octets_to_signature`, `proof_to_octets`, `octets_to_proof` and `octets_to_pubkey` are defined in (#serialization)
575
+
-`serialize`, `signature_to_octets`, `octets_to_signature`, `proof_to_octets`, `octets_to_proof` and `octets_to_pubkey` are defined in (#serialization).
576
+
-`e` is the pairing operation used (see (#notation)), defined as part of the ciphersuite.
576
577
577
578
Each core operation will accept a vector of generators (points of G1) and optionally, a vector of messages. The generators MUST be unique and pseudo-random i.e., with no known relationship to each other. See (#defining-new-generators) for more details. Each message is represented as a scalar value. See (#messages-to-scalars) for ways to map a message to a scalar and the corresponding security requirements.
578
579
@@ -1707,7 +1708,7 @@ In any case, the privacy considerations described in (#privacy-considerations) M
1707
1708
1708
1709
# Ciphersuites
1709
1710
1710
-
This section defines the format for a BBS ciphersuite. It also gives concrete ciphersuites based on the BLS12-381 pairing-friendly elliptic curve [@!I-D.irtf-cfrg-pairing-friendly-curves].
1711
+
This section defines the format for a BBS ciphersuite. It also gives concrete ciphersuites based on the BLS12-381 pairing-friendly elliptic curve [@I-D.irtf-cfrg-pairing-friendly-curves].
1711
1712
1712
1713
## Ciphersuite Format
1713
1714
@@ -1742,6 +1743,8 @@ The parameters that each ciphersuite needs to define are generally divided into
1742
1743
1743
1744
- P1: A fixed point in the G1 subgroup, different from the point BP1 (i.e., the base point of G1, see (#terminology)). This leaves the base point "free", to be used with other protocols, like key commitment and proof of possession schemes (for example, like the one described in Section 3.3 of [@I-D.irtf-cfrg-bls-signature]).
1744
1745
1746
+
- e: The pairing operation used.
1747
+
1745
1748
**Serialization functions**:
1746
1749
1747
1750
- point\_to\_octets\_E1:
@@ -1758,7 +1761,7 @@ a function that returns the point P in the elliptic curve E2 corresponding to th
1758
1761
1759
1762
## BLS12-381 Ciphersuites
1760
1763
1761
-
The following two ciphersuites are based on the BLS12-381 elliptic curves defined in Section 4.2.1 of [@!I-D.irtf-cfrg-pairing-friendly-curves]. The targeted security level of both suites in bits is `k = 128`. The number of bits of the order `r`, of the G1 and G2 subgroups, is `log2(r) = 255`. The base points `BP1` and `BP2` of G1 and G2 are the points `BP` and `BP'` correspondingly, as defined in Section 4.2.1 of [@!I-D.irtf-cfrg-pairing-friendly-curves].
1764
+
The following two ciphersuites are based on the BLS12-381 elliptic curves defined in Section 4.2.1 of [@I-D.irtf-cfrg-pairing-friendly-curves]. The targeted security level of both suites in bits is `k = 128` (the actual security leven is closer to 126 bits). The number of bits of the order `r`, of the G1 and G2 subgroups, is `log2(r) = 255`. The base points `BP1` and `BP2` of G1 and G2 are the points `BP` and `BP'` correspondingly, as defined in Section 4.2.1 of [@I-D.irtf-cfrg-pairing-friendly-curves]. For completeness, BLS12-381 and the relevant functionality (base points `BP1` and `BP2`, the pairing `e` as well as the point encoding and decoding operations) are defined in (#the-bls12-381-curve).
1762
1765
1763
1766
The first ciphersuite uses the hash-to-curve suite `BLS12381G1_XOF:SHAKE-256_SSWU_RO_`, defined by this document in [Appendix A.1](#bls12-381-hash_to_curve-def), which is based on the SHAKE-256 extendable output function, as defined in Section 6.2 of [@!SHA3].
1764
1767
@@ -1801,15 +1804,17 @@ Note that these two ciphersuites differ only in the hash-to-curve suites used. T
- e: the optimal Ate pairing (Appendix A.2 of [@I-D.irtf-cfrg-pairing-friendly-curves]), defined in (#optimal-ate-pairing).
1808
+
1804
1809
**Serialization functions**:
1805
1810
1806
-
- point\_to\_octets\_E1: follows the format documented in Appendix C section 1 of [@!I-D.irtf-cfrg-pairing-friendly-curves] for the E1 elliptic curve, using compression (i.e., setting C\_bit = 1).
1811
+
- point\_to\_octets\_E1: as defined in (#point-serialization) for points of the curve `E1` (which follows the format documented in Appendix C.1 of [@I-D.irtf-cfrg-pairing-friendly-curves] for the `E1` elliptic curve, using compression).
1807
1812
1808
-
- point\_to\_octets\_E2: follows the format documented in Appendix C section 1 of [@!I-D.irtf-cfrg-pairing-friendly-curves] for the E2 elliptic curve, using compression (i.e., setting C\_bit = 1).
1813
+
- point\_to\_octets\_E2: as defined in (#point-serialization) for points of the curve `E2` (which follows the format documented in Appendix C.1 of [@I-D.irtf-cfrg-pairing-friendly-curves] for the `E2` elliptic curve, using compression).
1809
1814
1810
-
- octets\_to\_point\_E1: follows the format documented in Appendix C section 2 of [@!I-D.irtf-cfrg-pairing-friendly-curves] for the E1 elliptic curve.
1815
+
- octets\_to\_point\_E1: as defined in (#point-de-serialization) (which follows the format documented in Appendix C.2 of [@I-D.irtf-cfrg-pairing-friendly-curves]), returning INVALID if the resulting point is not in `E1`.
1811
1816
1812
-
- octets\_to\_point\_E2: follows the format documented in Appendix C section 2 of [@!I-D.irtf-cfrg-pairing-friendly-curves] for the E2 elliptic curve.
1817
+
- octets\_to\_point\_E2: as defined in (#point-de-serialization) (which follows the format documented in Appendix C.2 of [@I-D.irtf-cfrg-pairing-friendly-curves]), returning INVALID if the resulting point is not in `E2`.
1813
1818
1814
1819
### BLS12-381-SHA-256
1815
1820
@@ -1830,15 +1835,17 @@ Note that these two ciphersuites differ only in the hash-to-curve suites used. T
- e: the optimal Ate pairing (Appendix A.2 of [@I-D.irtf-cfrg-pairing-friendly-curves]), defined in (#optimal-ate-pairing).
1839
+
1833
1840
**Serialization functions**:
1834
1841
1835
-
- point\_to\_octets\_E1: follows the format documented in Appendix C section 1 of [@!I-D.irtf-cfrg-pairing-friendly-curves] for the E1 elliptic curve, using compression (i.e., setting C\_bit = 1).
1842
+
- point\_to\_octets\_E1: as defined in (#point-serialization) for points of the curve `E1` (which follows the format documented in Appendix C.1 of [@I-D.irtf-cfrg-pairing-friendly-curves] for the `E1` elliptic curve, using compression).
1836
1843
1837
-
- point\_to\_octets\_E2: follows the format documented in Appendix C section 1 of [@!I-D.irtf-cfrg-pairing-friendly-curves] for the E2 elliptic curve, using compression (i.e., setting C\_bit = 1).
1844
+
- point\_to\_octets\_E2: as defined in (#point-serialization) for points of the curve `E2` (which follows the format documented in Appendix C.1 of [@I-D.irtf-cfrg-pairing-friendly-curves] for the `E2` elliptic curve, using compression).
1838
1845
1839
-
- octets\_to\_point\_E1: follows the format documented in Appendix C section 2 of [@!I-D.irtf-cfrg-pairing-friendly-curves] for the E1 elliptic curve.
1846
+
- octets\_to\_point\_E1: as defined in (#point-de-serialization) (which follows the format documented in Appendix C.2 of [@I-D.irtf-cfrg-pairing-friendly-curves]), returning INVALID if the resulting point is not in `E1`.
1840
1847
1841
-
- octets\_to\_point\_E2: follows the format documented in Appendix C section 2 of [@!I-D.irtf-cfrg-pairing-friendly-curves] for the E2 elliptic curve.
1848
+
- octets\_to\_point\_E2: as defined in (#point-de-serialization) (which follows the format documented in Appendix C.2 of [@I-D.irtf-cfrg-pairing-friendly-curves]), returning INVALID if the resulting point is not in `E2`.
1842
1849
1843
1850
# Test Vectors
1844
1851
@@ -2486,6 +2493,191 @@ Note that the h_eff values for this suite are copied from that defined for the `
2486
2493
2487
2494
An optimized example implementation of the Simplified SWU mapping to the curve E' isogenous to BLS12-381 G1 is given in Appendix F.2 [@!I-D.irtf-cfrg-hash-to-curve].
2488
2495
2496
+
# The BLS12-381 Curve
2497
+
2498
+
This section defines BLS12-381. The definitions of this section have been originally described in [@I-D.irtf-cfrg-pairing-friendly-curves], where they are discussed in greater detail.
2499
+
2500
+
BLS12-381 are Barreto-Lynn-Scott curves, defined by two elliptic curves `E1` and `E2`, parameterized by an integer `t`. In the case of BLS12-381, `t` is defined as,
2501
+
2502
+
```
2503
+
t = -2^63 - 2^62 - 2^60 - 2^57 - 2^48 - 2^16
2504
+
```
2505
+
2506
+
The curves `E1` and `E2` are defined over the finite fields `GF(p)` and `GF(p^2)` correspondingly, where `p` is defined as,
2507
+
2508
+
```
2509
+
p = (t - 1)^2 * (t^4 - t^2 + 1) / 3 + t
2510
+
```
2511
+
2512
+
Let `(1, I)` be the bases of the finite field `GF(p^2)`, where `I ^ 2 + 1 = 0` in `GF(p^2)`. We will denote an element `y` of `GF(p^2)` as a tuple `y = (y_0, y_1)`, where `y_0` and `y_1` elements of `GF(p)` for which it holds `y = y_0 * 1 + y_1 * I`. The two elliptic curves are defined by the following equations,
2513
+
2514
+
```
2515
+
E1: y ^ 2 = x ^ 3 + 4
2516
+
E2: y ^ 2 = x ^ 3 + 4 * (I + 1)
2517
+
```
2518
+
2519
+
The group `G1` and `G2` are defined as the the order `r` subgroup of `E1` defined over `GF(p)` and `E2` defined over `GF(p^2)` correspondingly, where `r` is defined as,
2520
+
2521
+
```
2522
+
r = 0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001
2523
+
```
2524
+
2525
+
Note that `r` is a prime factor of `p`. The target group `G_T` is defined as the finite group `GF(p^12)` minus the element `0`.
2526
+
2527
+
The base points of BLS12-381, encoded to octets using the procedure defined in (#point-serialization) and then represented in hexadecimal format, are defined as,
This section describes the optimal Ate pairing for BLS12-381. The pairing computation uses the following utility function.
2540
+
2541
+
```
2542
+
res = Line_function(Q1, Q2, P)
2543
+
2544
+
Inputs:
2545
+
2546
+
- Q1 (REQUIRED), point of G2.
2547
+
- Q2 (REQUIRED), point of G2.
2548
+
- P (REQUIRED), point of G1.
2549
+
2550
+
Outputs:
2551
+
2552
+
- res: an element on the target group G_T.
2553
+
2554
+
Procedure:
2555
+
2556
+
1. (x_1, y_1) = Q1
2557
+
2. (x_2, y_2) = Q2
2558
+
3. (x, y) = P
2559
+
4. if Q1 = Q2, set l = (3 * x_1^2) / (2 * y_1)
2560
+
5. else if Q1 = - Q2, return x - x_1
2561
+
6. else set l = (y_2 - y_1) / (x_2 - x_1)
2562
+
7. return (l * (x - x_1) + y_1 - y)
2563
+
```
2564
+
2565
+
Let `c = t` for `t` as defined above ((#the-bls12-381-curve)) and `c_0, c_1, ... , c_L` in `(-1, 0, 1)` such that the sum of `c_i * 2^i` for `i = 0, 1, ..., L` equals `c`.
2566
+
2567
+
Given a point `P` of `G1`, and a point `Q` of `G2`, the output `e(P, Q)` where `e` the Ate pairing for BLS12-381 is calculated as follows,
2568
+
2569
+
```
2570
+
1. set f = 1 and T = Q
2571
+
2. if c_L = -1, set T = -T
2572
+
3. for i in (L-1, L-2, ..., 1, 0)
2573
+
4. f = f^2 * Line_function(T, T, P)
2574
+
5. T = T + T
2575
+
6. if c_i = 1,
2576
+
7. f = f * Line_function(T, Q, P)
2577
+
8. T = T + Q
2578
+
9. else if c_i = -1,
2579
+
10. f = f * Line_function(T, -Q, P)
2580
+
11. T = T - Q
2581
+
12. f = f ^ ((p ^ 12 - 1) / r)
2582
+
13. return f
2583
+
```
2584
+
2585
+
## Point Encoding
2586
+
2587
+
This section defines point encoding and decoding procedures for BLS12-381. Although more flexible point encoding procedures may exist (for example [@I-D.ietf-lwig-curve-representations]), the vast majority of current libraries implementing BLS12-381 use (most of them explicitly) the encoding method defined in Appendix C of [@I-D.irtf-cfrg-pairing-friendly-curves]. For this reason, the ciphersuites defined in (#bls12-381-ciphersuites), use those encoding and decoding procedures. For completeness, those operations are defined in this section as well. See [@I-D.irtf-cfrg-pairing-friendly-curves] for a more detailed explanation of the encoding and decoding steps. Note also that we will only consider compressed point encoding (in contrast to [@I-D.irtf-cfrg-pairing-friendly-curves], which supports both compressed and uncompressed point encoding).
2588
+
2589
+
In this section we will use the following notation,
2590
+
2591
+
- For an octet string `x`, `x[0]` will denote the first octet (i.e., 8 most significant bits) of `x`.
2592
+
- On input an element `y` of `GF(p)` or `GF(p^2)`, `sqrt(y)` will return the square root of that element in the respective group, i.e., an element `a` such that `a^2 = y`, or INVALID.
2593
+
- For clarity, we will use `Identity_E1`, `Identity_E2` to denote the identity points of `E1` and `E2` correspondingly (note that `Identity_E1` is the same point as `Identity_G1` and `Identity_E2` is the same point as `Identity_G2`).
2594
+
2595
+
We first have to define the following utility operations.
2596
+
2597
+
The following procedure returns one bit corresponding to the sign of an element of `GF(p)`.
2598
+
2599
+
```
2600
+
res = sign_GF_p(y)
2601
+
2602
+
Inputs:
2603
+
2604
+
- y (REQUIRED), point of the GF(p) group
2605
+
2606
+
Outputs:
2607
+
2608
+
- res, either 0 or 1
2609
+
2610
+
Procedure:
2611
+
2612
+
1. if y > (p - 1) / 2, return 1
2613
+
2. return 0
2614
+
```
2615
+
2616
+
The following procedure returns one bit corresponding to the sign of an element in `GF(p^2)`.
2617
+
2618
+
```
2619
+
res = sign_GF_p^2(y)
2620
+
2621
+
Inputs:
2622
+
2623
+
- y (REQUIRED), point of the GF(p^2) group
2624
+
2625
+
Outputs:
2626
+
2627
+
- res, either 0 or 1
2628
+
2629
+
Procedure:
2630
+
2631
+
1. (y_0, y_1) = y
2632
+
2. if y_1 is 0, return sign_GF_p(y_0)
2633
+
3. if y_1 > (p - 1) / 2, return 1
2634
+
4. return 0
2635
+
```
2636
+
2637
+
### Point Serialization
2638
+
2639
+
Let `P = (x, y)` the point to be serialized.
2640
+
2641
+
Compute three metadata bits `C_bit`, `I_bit`, and `S_bit`, as follows,
2642
+
2643
+
1. `C_bit` is set to 1 (indicating that point compression is used).
2644
+
2. `I_bit` is 1 if `P` is either the `Identity_E1` or `Identity_E2` points, otherwise it is 0.
2645
+
3. `S_bit` is 0 if `I_bit` is 1 (again note that the ciphersuites described in this document always use point compression). Otherwise (i.e., when point compression is used and `P` is not the identity point of its respective curve), if `P` is a point on `E1`, set `S_bit = sign_GF_p(y)`, else if `P` is a point on `E2`, `S_bit = sign_GF_p^2(y)`.
2646
+
2647
+
Let `m = (C_bit * 2^7) + (I_bit * 2^6) + (S_bit * 2^5)` and set `m_byte = I2OSP(m, 1)`. Define `x_string` as follows,
2648
+
2649
+
1. If `P = Identity_E1`, set `x_string = I2OSP(0, 48)`.
2650
+
2. If `P` is a point on `E1` and `P != Identity_E1`, set `x_string = I2OSP(x, 48)`.
2651
+
3. If `P = Identity_E2`, set `x_string = I2OSP(0, 96)`.
2652
+
4. If `P` is a point on `E2` and `P != Identity_E2`, then let `x_0` and `x_1` elements of `GF(p)` such that `x = (x_0, x_1)` and set `x_string = I2OSP(x_1, 48) || I2OSP(x_0, 48)`.
2653
+
2654
+
Let `s_string = x_string`. Set `s_string[0] = x_string[0] OR m_byte`, where `OR` is computed for each bit. Output `s_string` as the serialization result of the point `P`.
2655
+
2656
+
### Point De-serialization
2657
+
2658
+
Let `m_byte = s_string[0] AND 0xE0`, where `AND` is computed bitwise. If `m_byte` equals `0x20` or `0x60` or `0xE0`, output INVALID and abort the operation. Otherwise, let `C_bit` equal the most significant bit of `m_byte`, `I_bit` equal the second most significant bit of `m_byte`, and `S_bit` equal the third most significant bit of `m_byte`. If `C_bit` is 0 return INVALID and abort the operation (note again that we only consider compressed encoding).
2659
+
2660
+
1. Determine the curve of the encoded point as follows,
2661
+
- If `s_string` has length 48 octets, the encoded point is on the curve `E1`.
2662
+
- If `s_string` has length 96 octets, the encoded point is on the curve `E2`.
2663
+
- If `s_string` has any other length, output INVALID and abort the operation.
2664
+
2665
+
2666
+
2. Let `s_string[0] = s_string[0] AND 0x1F`, where `AND` is computed bitwise (this will set the three most significant bits of `s_string[0]` to 0).
2667
+
2668
+
3. If `I_bit` is 1, then the encoded point must be the Identity point of the curve determined on step 1. If `s_string` is not the all zeros string, output INVALID and abort the operation. Otherwise, output the Identity point of the curve that was determined in step 1 (i.e., either `Identity_E1` or `Identity_E2`).
2669
+
2670
+
4. Let `x = OS2IP(s_string)`.
2671
+
5. If the curve that was determined in step 1 is `E1`,
2672
+
- Let `y2 = x^3 + 4` in `GF(p)`.
2673
+
- If `y2` is not square in `GF(p)`, output INVALID and abort the operation. Otherwise, let `y = sqrt(y2)` in `GF(p)` and set `Y_bit = sign_GF_p(y)`.
2674
+
2675
+
6. If the curve that was determined in step 1 is `E2`,
2676
+
- Let `y2 = x^3 + 4 * (I + 1)` in `GF(p^2)`.
2677
+
- If `y2` is not square in `GF(p^2)`, output INVALID and abort the operation. Otherwise, let `y = sqrt(y2)` in `GF(p^2)` and set `Y_bit = sign_GF_p^2(y)`.
0 commit comments