Skip to content

Commit 664b135

Browse files
authored
Merge pull request #346 from cfrg/revSD
Rev sd
2 parents 05cb350 + 00cbf7b commit 664b135

File tree

1 file changed

+34
-32
lines changed

1 file changed

+34
-32
lines changed

draft-irtf-cfrg-hash-to-curve.md

+34-32
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,8 @@ as "try-and-increment" or "hunt-and-peck," because the goal is to describe
11511151
algorithms that can plausibly be computed in constant time. Use of these rejection
11521152
methods is NOT RECOMMENDED, because they have been a perennial cause of
11531153
side-channel vulnerabilities. See Dragonblood {{VR20}} as one example of this
1154-
problem in practice.
1154+
problem in practice, and see {{related}} for a further description of
1155+
rejection sampling methods.
11551156

11561157
This document represents the consensus of the Crypto Forum Research Group (CFRG).
11571158

@@ -1272,7 +1273,7 @@ is not invertible. Thus, the encodings are also not invertible.
12721273
In some applications of hashing to elliptic curves, it is important that
12731274
encodings do not leak information through side channels.
12741275
{{VR20}} is one example of this type of leakage leading to a security vulnerability.
1275-
See {{security-considerations}} for further discussion.
1276+
See {{security-considerations-constant}} for further discussion.
12761277

12771278
### Random oracle encodings {#term-rom}
12781279

@@ -1286,7 +1287,7 @@ point on the curve, the other gives a point sampled from a nonuniform distributi
12861287

12871288
A random-oracle encoding with a uniform output distribution is suitable for use
12881289
in many cryptographic protocols proven secure in the random oracle model.
1289-
See {{security-considerations}} for further discussion.
1290+
See {{security-considerations-props}} for further discussion.
12901291

12911292
### Serialization {#term-serialization}
12921293

@@ -1333,7 +1334,7 @@ encoding for each oracle being simulated.
13331334
In the above example, "RO1" and "RO2" have the same length and thus
13341335
satisfy this requirement when used as prefixes.
13351336
The algorithms specified in this document take a different approach to ensuring
1336-
injectivity; see {{hashtofield-expand}} and {{security-considerations-domain-separation}}
1337+
injectivity; see {{hashtofield-expand}} and {{security-considerations-domain-separation-expmsg-var}}
13371338
for more details.
13381339

13391340
# Encoding byte strings to elliptic curves {#roadmap}
@@ -1415,7 +1416,7 @@ different distributions:
14151416
This function is suitable for most applications requiring a random oracle
14161417
returning points in G, when instantiated with any of the map\_to\_curve
14171418
functions described in {{mappings}}.
1418-
See {{security-considerations}} for further discussion.
1419+
See {{security-considerations-props}} for further discussion.
14191420

14201421
~~~ pseudocode
14211422
hash_to_curve(msg)
@@ -1505,7 +1506,7 @@ in brief, this means that execution time and memory access patterns SHOULD NOT
15051506
depend on the values of secret inputs, intermediate values, or outputs.
15061507
For such constant-time implementations, all arithmetic, comparisons, and
15071508
assignments MUST also be implemented in constant time.
1508-
{{security-considerations}} briefly discusses constant-time security issues.
1509+
{{security-considerations-constant}} briefly discusses constant-time security issues.
15091510

15101511
Guidance on implementing low-level operations (in constant time or otherwise)
15111512
is beyond the scope of this document; readers should consult standard reference
@@ -1673,11 +1674,10 @@ For example, when hashing to the scalar field for an elliptic curve (sub)group
16731674
with prime order r, it suffices to instantiate hash\_to\_field with target field
16741675
GF(r).
16751676

1676-
## Security considerations {#hashtofield-sec}
1677-
16781677
The hash\_to\_field function is designed to be indifferentiable from a
16791678
random oracle {{MRH04}} when expand\_message ({{hashtofield-expand}})
1680-
is modeled as a random oracle (see {{security-considerations-hash-to-field}}).
1679+
is modeled as a random oracle (see {{security-considerations-hash-to-field}}
1680+
for details about its indifferentiability).
16811681
Ensuring indifferentiability requires care; to see why, consider a prime
16821682
p that is close to 3/4 * 2^256.
16831683
Reducing a random 256-bit integer modulo this p yields a value that is in
@@ -1696,7 +1696,7 @@ L uniform bytes, where
16961696
L = ceil((ceil(log2(p)) + k) / 8)
16971697
~~~
16981698

1699-
These uniform bytes are then interpreted as an integer via OS2IP {{RFC8017}}.
1699+
These uniform bytes are then interpreted as an integer via OS2IP.
17001700
For example, for a 255-bit prime p, and k = 128-bit security,
17011701
L = ceil((255 + 128) / 8) = 48 bytes.
17021702

@@ -1713,7 +1713,7 @@ field GF(p^m), hash\_to\_field requires expanding msg into m * L bytes (for L as
17131713
For extension fields where log2(p) is significantly smaller than the security
17141714
level k, this approach is inefficient: it requires expand\_message to output
17151715
roughly m * log2(p) + m * k bits, whereas m * log2(p) + k bytes suffices to
1716-
generate an element of GF(p^m) with bias at most 2^-k. In such cases, an
1716+
generate an element of GF(p^m) with bias at most 2^-k. In such cases,
17171717
applications MAY use an alternative hash\_to\_field function, provided it
17181718
meets the following security requirements:
17191719

@@ -1748,7 +1748,7 @@ Parameters:
17481748
parameter of the suite (e.g., k = 128).
17491749
- expand_message, a function that expands a byte string and
17501750
domain separation tag into a uniformly random byte string
1751-
(see Section 5.4).
1751+
(see Section 5.3).
17521752

17531753
Inputs:
17541754
- msg, a byte string containing the message to hash.
@@ -2435,7 +2435,7 @@ When a curve admits a fast cofactor clearing method, clear\_cofactor
24352435
MAY be evaluated either via that method or via scalar multiplication
24362436
by the equivalent h\_eff; these two methods give the same result.
24372437
Note that in this case scalar multiplication by the cofactor h does not
2438-
generally give the same result as the fast method, and SHOULD NOT be used.
2438+
generally give the same result as the fast method, and MUST NOT be used.
24392439

24402440
# Suites for hashing {#suites}
24412441

@@ -2465,7 +2465,7 @@ A hash-to-curve suite comprises the following parameters:
24652465
the polynomial basis used to represent extension field elements.
24662466
- k, the target security level of the suite in bits.
24672467
(See {{security-considerations-targets}} for discussion.)
2468-
- L, the length parameter for hash\_to\_field ({{hashtofield-sec}}).
2468+
- L, the length parameter for hash\_to\_field ({{hashtofield}}).
24692469
- expand\_message, one of the variants specified in {{hashtofield-expand}}
24702470
plus any parameters required for the specified variant (for example, H,
24712471
the underlying hash function).
@@ -2604,7 +2604,7 @@ to P-521 is given in {{straightline-sswu}}.
26042604
## Suites for curve25519 and edwards25519 {#suites-25519}
26052605

26062606
This section defines ciphersuites for curve25519 and edwards25519 {{!RFC7748}}.
2607-
Note that these ciphersuites SHOULD NOT be used when hashing to ristretto255
2607+
Note that these ciphersuites MUST NOT be used when hashing to ristretto255
26082608
{{?I-D.irtf-cfrg-ristretto255-decaf448}}.
26092609
See {{appx-ristretto255}} for information on how to hash to that group.
26102610

@@ -2646,7 +2646,7 @@ Optimized example implementations of the above mappings are given in
26462646
## Suites for curve448 and edwards448 {#suites-448}
26472647

26482648
This section defines ciphersuites for curve448 and edwards448 {{!RFC7748}}.
2649-
Note that these ciphersuites SHOULD NOT be used when hashing to decaf448
2649+
Note that these ciphersuites MUST NOT be used when hashing to decaf448
26502650
{{I-D.irtf-cfrg-ristretto255-decaf448}}.
26512651
See {{appx-decaf448}} for information on how to hash to that group.
26522652

@@ -2783,7 +2783,8 @@ to the curve E' isogenous to BLS12-381 G2 is given in {{straightline-sswu}}.
27832783

27842784
## Defining a new hash-to-curve suite {#new-suite}
27852785

2786-
The RECOMMENDED way to define a new hash-to-curve suite is:
2786+
For elliptic curves not listed elsewhere in {{suites}}, a new hash-to-curve
2787+
suite can be defined by:
27872788

27882789
1. E, F, p, and m are determined by the elliptic curve and its base field.
27892790

@@ -2794,7 +2795,7 @@ The RECOMMENDED way to define a new hash-to-curve suite is:
27942795

27952796
3. Choose encoding type, either hash\_to\_curve or encode\_to\_curve ({{roadmap}}).
27962797

2797-
4. Compute L as described in {{hashtofield-sec}}.
2798+
4. Compute L as described in {{hashtofield}}.
27982799

27992800
5. Choose an expand\_message variant from {{hashtofield-expand}} plus any
28002801
underlying cryptographic primitives (e.g., a hash function H).
@@ -2808,9 +2809,6 @@ The RECOMMENDED way to define a new hash-to-curve suite is:
28082809

28092810
8. Construct a Suite ID following the guidelines in {{suiteIDformat}}.
28102811

2811-
When hashing to an elliptic curve not listed in this section, corresponding
2812-
hash-to-curve suites SHOULD be fully specified as described above.
2813-
28142812
## Suite ID naming conventions {#suiteIDformat}
28152813

28162814
Suite IDs MUST be constructed as follows:
@@ -2886,12 +2884,10 @@ This document has no IANA actions.
28862884

28872885
# Security considerations {#security-considerations}
28882886

2889-
{{domain-separation}} describes considerations related to domain separation.
2890-
See {{security-considerations-domain-separation}} for further discussion.
2887+
This section contains additional security considerations about the hash-to-curve mechanisms
2888+
described in this document.
28912889

2892-
{{hashtofield}} describes considerations for uniformly hashing to field elements;
2893-
see {{security-considerations-hash-to-field}} and {{security-considerations-expand-xmd}}
2894-
for further discussion.
2890+
## Properties of encodings {#security-considerations-props}
28952891

28962892
Each encoding type ({{roadmap}}) accepts an arbitrary byte string and maps
28972893
it to a point on the curve sampled from a distribution that depends on the
@@ -2928,6 +2924,8 @@ by indifferentiable functionalities.
29282924
This limitation should be considered when analyzing the security of protocols
29292925
relying on the hash\_to\_curve function.
29302926

2927+
## Hashing passwords {#security-considerations-passwords}
2928+
29312929
When hashing passwords using any function described in this document, an adversary
29322930
who learns the output of the hash function (or potentially any intermediate value,
29332931
e.g., the output of hash\_to\_field) may be able to carry out a dictionary attack.
@@ -2938,6 +2936,8 @@ function to the target elliptic curve.
29382936
For collision resistance, the hash underlying the key derivation function
29392937
should be chosen according to the guidelines listed in {{hashtofield-expand-xmd}}.
29402938

2939+
## Constant-time requirements {#security-considerations-constant}
2940+
29412941
Constant-time implementations of all functions in this document are STRONGLY
29422942
RECOMMENDED for all uses, to avoid leaking information via side channels.
29432943
It is especially important to use a constant-time implementation when inputs to
@@ -3055,12 +3055,13 @@ function meeting one of the above criteria.
30553055
Applications that use expand\_message\_xmd outside of hash\_to\_field should
30563056
ensure domain separation by picking a distinct value for DST.
30573057

3058-
## Domain separation recommendations {#security-considerations-domain-separation}
3058+
## Domain separation for expand\_message variants {#security-considerations-domain-separation-expmsg-var}
30593059

30603060
As discussed in {{term-domain-separation}}, the purpose of domain separation
30613061
is to ensure that security analyses of cryptographic protocols that query
30623062
multiple independent random oracles remain valid even if all of these random
30633063
oracles are instantiated based on one underlying function H.
3064+
30643065
The expand\_message variants in this document ({{hashtofield-expand}}) ensure
30653066
domain separation by appending a suffix-free-encoded domain separation tag
30663067
DST\_prime to all strings hashed by H, an underlying hash or
@@ -3246,9 +3247,10 @@ If x is the x-coordinate of a point on the elliptic curve, output that
32463247
point. Otherwise, generate a new value x in F and try again.
32473248
Since a random value x in F has probability about 1/2 of corresponding to
32483249
a point on the curve, the expected number of tries is just two.
3249-
However, the running time of this method depends on the input string,
3250-
which means that it is not safe to use in protocols sensitive to timing
3251-
side channels.
3250+
However, the running time of this method, which is generally referred
3251+
to as a probabilistic try-and-increment algorithm, depends on the input string.
3252+
As such, it is not safe to use in protocols sensitive to timing
3253+
side channels, as was exemplified by the Dragonblood attack {{VR20}}.
32523254

32533255
Schinzel and Skalba {{SS04}} introduce a method of constructing
32543256
elliptic curve points deterministically, for a restricted class of curves
@@ -3325,7 +3327,7 @@ The hash\_to\_ristretto255 function MUST be instantiated with an expand\_message
33253327
function that conforms to the requirements given in {{hashtofield-expand}}.
33263328
In addition, it MUST use a domain separation tag constructed as described
33273329
in {{domain-separation}}, and all domain separation recommendations given
3328-
in {{security-considerations-domain-separation}} apply when implementing
3330+
in {{security-considerations-domain-separation-expmsg-var}} apply when implementing
33293331
protocols that use hash\_to\_ristretto255.
33303332

33313333
~~~ pseudocode
@@ -3378,7 +3380,7 @@ The hash\_to\_decaf448 function MUST be instantiated with an expand\_message
33783380
function that conforms to the requirements given in {{hashtofield-expand}}.
33793381
In addition, it MUST use a domain separation tag constructed as described
33803382
in {{domain-separation}}, and all domain separation recommendations given
3381-
in {{security-considerations-domain-separation}} apply when implementing
3383+
in {{security-considerations-domain-separation-expmsg-var}} apply when implementing
33823384
protocols that use hash\_to\_decaf448.
33833385

33843386
~~~ pseudocode

0 commit comments

Comments
 (0)