Skip to content

Commit 12a6ba4

Browse files
Clarify deterministic generation by re-drawing
For DH, ECC (Weierstrass curves) and DSA, specify that the re-drawing method is the one defined by NIST as "key-pair generation by testing candidates", and describe it unambiguously. Also specify DES explicitly.
1 parent fa4486d commit 12a6ba4

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

include/psa/crypto.h

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2924,12 +2924,25 @@ psa_status_t psa_generator_read(psa_crypto_generator_t *generator,
29242924
* for the output produced by psa_export_key().
29252925
* The following key types defined in this specification follow this scheme:
29262926
*
2927-
* - #PSA_KEY_TYPE_DES;
2928-
* - #PSA_KEY_TYPE_DH_KEYPAIR;
2929-
* - #PSA_KEY_TYPE_DSA_KEYPAIR;
2930-
* - ECC keys on a Weierstrass elliptic curve, i.e.
2931-
* #PSA_KEY_TYPE_ECC_KEYPAIR(\c curve) where \c curve designates a
2932-
* Weierstrass curve.
2927+
* - #PSA_KEY_TYPE_DES. Force-set the parity bits, but discard
2928+
* forbidden weak keys.
2929+
* - Finite-field Diffie-Hellman keys (#PSA_KEY_TYPE_DH_KEYPAIR),
2930+
* DSA keys (#PSA_KEY_TYPE_DSA_KEYPAIR), and
2931+
* ECC keys on a Weierstrass elliptic curve
2932+
* (#PSA_KEY_TYPE_ECC_KEYPAIR(\c curve) where \c curve designates a
2933+
* Weierstrass curve).
2934+
* For these key types, interpret the byte string as integer
2935+
* in big-endian order. Discard it if it is not in the range
2936+
* [0, *N* - 2] where *N* is the boundary of the private key domain
2937+
* (the prime *p* for Diffie-Hellman, the subprime *q* for DSA,
2938+
* or the order of the curve's coordinate field for ECC).
2939+
* Add 1 to the resulting integer and use this as the private key *x*.
2940+
* This is the method described as
2941+
* "key-pair generation by testing candidates"
2942+
* in NIST SP 800-56A §5.6.1.1.4 for Diffie-Hellman,
2943+
* in FIPS 186-4 §B.1.2 for DSA, and
2944+
* in NIST SP 800-56A §5.6.1.2.2 or
2945+
* FIPS 186-4 §B.4.2 for elliptic curve keys.
29332946
*
29342947
* - For other key types, including #PSA_KEY_TYPE_RSA_KEYPAIR,
29352948
* the way in which the generator output is consumed is

0 commit comments

Comments
 (0)