EVP_PKEY-FFC.7ossl 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. .\" -*- mode: troff; coding: utf-8 -*-
  2. .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
  3. .\"
  4. .\" Standard preamble:
  5. .\" ========================================================================
  6. .de Sp \" Vertical space (when we can't use .PP)
  7. .if t .sp .5v
  8. .if n .sp
  9. ..
  10. .de Vb \" Begin verbatim text
  11. .ft CW
  12. .nf
  13. .ne \\$1
  14. ..
  15. .de Ve \" End verbatim text
  16. .ft R
  17. .fi
  18. ..
  19. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
  20. .ie n \{\
  21. . ds C` ""
  22. . ds C' ""
  23. 'br\}
  24. .el\{\
  25. . ds C`
  26. . ds C'
  27. 'br\}
  28. .\"
  29. .\" Escape single quotes in literal strings from groff's Unicode transform.
  30. .ie \n(.g .ds Aq \(aq
  31. .el .ds Aq '
  32. .\"
  33. .\" If the F register is >0, we'll generate index entries on stderr for
  34. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  35. .\" entries marked with X<> in POD. Of course, you'll have to process the
  36. .\" output yourself in some meaningful fashion.
  37. .\"
  38. .\" Avoid warning from groff about undefined register 'F'.
  39. .de IX
  40. ..
  41. .nr rF 0
  42. .if \n(.g .if rF .nr rF 1
  43. .if (\n(rF:(\n(.g==0)) \{\
  44. . if \nF \{\
  45. . de IX
  46. . tm Index:\\$1\t\\n%\t"\\$2"
  47. ..
  48. . if !\nF==2 \{\
  49. . nr % 0
  50. . nr F 2
  51. . \}
  52. . \}
  53. .\}
  54. .rr rF
  55. .\" ========================================================================
  56. .\"
  57. .IX Title "EVP_PKEY-FFC 7ossl"
  58. .TH EVP_PKEY-FFC 7ossl 2025-01-17 3.4.0 OpenSSL
  59. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  60. .\" way too many mistakes in technical documents.
  61. .if n .ad l
  62. .nh
  63. .SH NAME
  64. EVP_PKEY\-FFC \- EVP_PKEY DSA and DH/DHX shared FFC parameters.
  65. .SH DESCRIPTION
  66. .IX Header "DESCRIPTION"
  67. Finite field cryptography (FFC) is a method of implementing discrete logarithm
  68. cryptography using finite field mathematics. DSA is an example of FFC and
  69. Diffie-Hellman key establishment algorithms specified in SP800\-56A can also be
  70. implemented as FFC.
  71. .PP
  72. The \fBDSA\fR, \fBDH\fR and \fBDHX\fR keytypes are implemented in OpenSSL's default and
  73. FIPS providers.
  74. The implementations support the basic DSA, DH and DHX keys, containing the public
  75. and private keys \fIpub\fR and \fIpriv\fR as well as the three main domain parameters
  76. \&\fIp\fR, \fIq\fR and \fIg\fR.
  77. .PP
  78. For \fBDSA\fR (and \fBDH\fR that is not a named group) the FIPS186\-4 standard
  79. specifies that the values used for FFC parameter generation are also required
  80. for parameter validation.
  81. This means that optional FFC domain parameter values for \fIseed\fR, \fIpcounter\fR
  82. and \fIgindex\fR may need to be stored for validation purposes.
  83. For \fBDH\fR the \fIseed\fR and \fIpcounter\fR can be stored in ASN1 data
  84. (but the \fIgindex\fR is not). For \fBDSA\fR however, these fields are not stored in
  85. the ASN1 data so they need to be stored externally if validation is required.
  86. .PP
  87. The \fBDH\fR key type uses PKCS#3 format which saves p and g, but not the 'q' value.
  88. The \fBDHX\fR key type uses X9.42 format which saves the value of 'q' and this
  89. must be used for FIPS186\-4.
  90. .SS "FFC parameters"
  91. .IX Subsection "FFC parameters"
  92. In addition to the common parameters that all keytypes should support (see
  93. "Common parameters" in \fBprovider\-keymgmt\fR\|(7)), the \fBDSA\fR, \fBDH\fR and \fBDHX\fR keytype
  94. implementations support the following.
  95. .IP """pub"" (\fBOSSL_PKEY_PARAM_PUB_KEY\fR) <unsigned integer>" 4
  96. .IX Item """pub"" (OSSL_PKEY_PARAM_PUB_KEY) <unsigned integer>"
  97. The public key value.
  98. .IP """priv"" (\fBOSSL_PKEY_PARAM_PRIV_KEY\fR) <unsigned integer>" 4
  99. .IX Item """priv"" (OSSL_PKEY_PARAM_PRIV_KEY) <unsigned integer>"
  100. The private key value.
  101. .SS "FFC DSA, DH and DHX domain parameters"
  102. .IX Subsection "FFC DSA, DH and DHX domain parameters"
  103. .IP """p"" (\fBOSSL_PKEY_PARAM_FFC_P\fR) <unsigned integer>" 4
  104. .IX Item """p"" (OSSL_PKEY_PARAM_FFC_P) <unsigned integer>"
  105. A DSA or Diffie-Hellman prime "p" value.
  106. .IP """g"" (\fBOSSL_PKEY_PARAM_FFC_G\fR) <unsigned integer>" 4
  107. .IX Item """g"" (OSSL_PKEY_PARAM_FFC_G) <unsigned integer>"
  108. A DSA or Diffie-Hellman generator "g" value.
  109. .SS "FFC DSA and DHX domain parameters"
  110. .IX Subsection "FFC DSA and DHX domain parameters"
  111. .IP """q"" (\fBOSSL_PKEY_PARAM_FFC_Q\fR) <unsigned integer>" 4
  112. .IX Item """q"" (OSSL_PKEY_PARAM_FFC_Q) <unsigned integer>"
  113. A DSA or Diffie-Hellman prime "q" value.
  114. .IP """seed"" (\fBOSSL_PKEY_PARAM_FFC_SEED\fR) <octet string>" 4
  115. .IX Item """seed"" (OSSL_PKEY_PARAM_FFC_SEED) <octet string>"
  116. An optional domain parameter \fIseed\fR value used during generation and validation
  117. of \fIp\fR, \fIq\fR and canonical \fIg\fR.
  118. For validation this needs to set the \fIseed\fR that was produced during generation.
  119. .IP """gindex"" (\fBOSSL_PKEY_PARAM_FFC_GINDEX\fR) <integer>" 4
  120. .IX Item """gindex"" (OSSL_PKEY_PARAM_FFC_GINDEX) <integer>"
  121. Sets the index to use for canonical generation and verification of the generator
  122. \&\fIg\fR.
  123. Set this to a positive value from 0..FF to use this mode. This \fIgindex\fR can
  124. then be reused during key validation to verify the value of \fIg\fR. If this value
  125. is not set or is \-1 then unverifiable generation of the generator \fIg\fR will be
  126. used.
  127. .IP """pcounter"" (\fBOSSL_PKEY_PARAM_FFC_PCOUNTER\fR) <integer>" 4
  128. .IX Item """pcounter"" (OSSL_PKEY_PARAM_FFC_PCOUNTER) <integer>"
  129. An optional domain parameter \fIcounter\fR value that is output during generation
  130. of \fIp\fR. This value must be saved if domain parameter validation is required.
  131. .IP """hindex"" (\fBOSSL_PKEY_PARAM_FFC_H\fR) <integer>" 4
  132. .IX Item """hindex"" (OSSL_PKEY_PARAM_FFC_H) <integer>"
  133. For unverifiable generation of the generator \fIg\fR this value is output during
  134. generation of \fIg\fR. Its value is the first integer larger than one that
  135. satisfies g = h^j mod p (where g != 1 and "j" is the cofactor).
  136. .IP """j"" (\fBOSSL_PKEY_PARAM_FFC_COFACTOR\fR) <unsigned integer>" 4
  137. .IX Item """j"" (OSSL_PKEY_PARAM_FFC_COFACTOR) <unsigned integer>"
  138. An optional informational cofactor parameter that should equal to (p \- 1) / q.
  139. .IP """validate-pq"" (\fBOSSL_PKEY_PARAM_FFC_VALIDATE_PQ\fR) <unsigned integer>" 4
  140. .IX Item """validate-pq"" (OSSL_PKEY_PARAM_FFC_VALIDATE_PQ) <unsigned integer>"
  141. .PD 0
  142. .IP """validate-g"" (\fBOSSL_PKEY_PARAM_FFC_VALIDATE_G\fR) <unsigned integer>" 4
  143. .IX Item """validate-g"" (OSSL_PKEY_PARAM_FFC_VALIDATE_G) <unsigned integer>"
  144. .PD
  145. These boolean values are used during FIPS186\-4 or FIPS186\-2 key validation checks
  146. (See \fBEVP_PKEY_param_check\fR\|(3)) to select validation options. By default
  147. \&\fIvalidate-pq\fR and \fIvalidate-g\fR are both set to 1 to check that p,q and g are
  148. valid. Either of these may be set to 0 to skip a test, which is mainly useful
  149. for testing purposes.
  150. .IP """validate-legacy"" (\fBOSSL_PKEY_PARAM_FFC_VALIDATE_LEGACY\fR) <unsigned integer>" 4
  151. .IX Item """validate-legacy"" (OSSL_PKEY_PARAM_FFC_VALIDATE_LEGACY) <unsigned integer>"
  152. This boolean value is used during key validation checks
  153. (See \fBEVP_PKEY_param_check\fR\|(3)) to select the validation type. The default
  154. value of 0 selects FIPS186\-4 validation. Setting this value to 1 selects
  155. FIPS186\-2 validation.
  156. .SS "FFC key generation parameters"
  157. .IX Subsection "FFC key generation parameters"
  158. The following key generation types are available for DSA and DHX algorithms:
  159. .IP """type"" (\fBOSSL_PKEY_PARAM_FFC_TYPE\fR) <UTF8 string>" 4
  160. .IX Item """type"" (OSSL_PKEY_PARAM_FFC_TYPE) <UTF8 string>"
  161. Sets the type of parameter generation. The shared valid values are:
  162. .RS 4
  163. .IP """fips186_4""" 4
  164. .IX Item """fips186_4"""
  165. The current standard.
  166. .IP """fips186_2""" 4
  167. .IX Item """fips186_2"""
  168. The old standard that should only be used for legacy purposes.
  169. .IP """default""" 4
  170. .IX Item """default"""
  171. This can choose one of "fips186_4" or "fips186_2" depending on other
  172. parameters set for parameter generation.
  173. .RE
  174. .RS 4
  175. .RE
  176. .IP """pbits"" (\fBOSSL_PKEY_PARAM_FFC_PBITS\fR) <unsigned integer>" 4
  177. .IX Item """pbits"" (OSSL_PKEY_PARAM_FFC_PBITS) <unsigned integer>"
  178. Sets the size (in bits) of the prime 'p'.
  179. .IP """qbits"" (\fBOSSL_PKEY_PARAM_FFC_QBITS\fR) <unsigned integer>" 4
  180. .IX Item """qbits"" (OSSL_PKEY_PARAM_FFC_QBITS) <unsigned integer>"
  181. Sets the size (in bits) of the prime 'q'.
  182. .Sp
  183. For "fips186_4" this can be either 224 or 256.
  184. For "fips186_2" this has a size of 160.
  185. .IP """digest"" (\fBOSSL_PKEY_PARAM_FFC_DIGEST\fR) <UTF8 string>" 4
  186. .IX Item """digest"" (OSSL_PKEY_PARAM_FFC_DIGEST) <UTF8 string>"
  187. Sets the Digest algorithm to be used as part of the Key Generation Function
  188. associated with the given Key Generation \fIctx\fR.
  189. This must also be set for key validation.
  190. .IP """properties"" (\fBOSSL_PKEY_PARAM_FFC_DIGEST_PROPS\fR) <UTF8 string>" 4
  191. .IX Item """properties"" (OSSL_PKEY_PARAM_FFC_DIGEST_PROPS) <UTF8 string>"
  192. Sets properties to be used upon look up of the implementation for the selected
  193. Digest algorithm for the Key Generation Function associated with the given key
  194. generation \fIctx\fR. This may also be set for key validation.
  195. .IP """seed"" (\fBOSSL_PKEY_PARAM_FFC_SEED\fR) <octet string>" 4
  196. .IX Item """seed"" (OSSL_PKEY_PARAM_FFC_SEED) <octet string>"
  197. For "fips186_4" or "fips186_2" generation this sets the \fIseed\fR data to use
  198. instead of generating a random seed internally. This should be used for
  199. testing purposes only. This will either produce fixed values for the generated
  200. parameters OR it will fail if the seed did not generate valid primes.
  201. .IP """gindex"" (\fBOSSL_PKEY_PARAM_FFC_GINDEX\fR) <integer>" 4
  202. .IX Item """gindex"" (OSSL_PKEY_PARAM_FFC_GINDEX) <integer>"
  203. .PD 0
  204. .IP """pcounter"" (\fBOSSL_PKEY_PARAM_FFC_PCOUNTER\fR) <integer>" 4
  205. .IX Item """pcounter"" (OSSL_PKEY_PARAM_FFC_PCOUNTER) <integer>"
  206. .IP """hindex"" (\fBOSSL_PKEY_PARAM_FFC_H\fR) <integer>" 4
  207. .IX Item """hindex"" (OSSL_PKEY_PARAM_FFC_H) <integer>"
  208. .PD
  209. These types are described above.
  210. .SH "CONFORMING TO"
  211. .IX Header "CONFORMING TO"
  212. The following sections of SP800\-56Ar3:
  213. .IP "5.5.1.1 FFC Domain Parameter Selection/Generation" 4
  214. .IX Item "5.5.1.1 FFC Domain Parameter Selection/Generation"
  215. .PP
  216. The following sections of FIPS186\-4:
  217. .IP "A.1.1.2 Generation of Probable Primes p and q Using an Approved Hash Function." 4
  218. .IX Item "A.1.1.2 Generation of Probable Primes p and q Using an Approved Hash Function."
  219. .PD 0
  220. .IP "A.2.3 Generation of canonical generator g." 4
  221. .IX Item "A.2.3 Generation of canonical generator g."
  222. .IP "A.2.1 Unverifiable Generation of the Generator g." 4
  223. .IX Item "A.2.1 Unverifiable Generation of the Generator g."
  224. .PD
  225. .SH "SEE ALSO"
  226. .IX Header "SEE ALSO"
  227. \&\fBEVP_PKEY\-DSA\fR\|(7),
  228. \&\fBEVP_PKEY\-DH\fR\|(7),
  229. \&\fBEVP_SIGNATURE\-DSA\fR\|(7),
  230. \&\fBEVP_KEYEXCH\-DH\fR\|(7)
  231. \&\fBEVP_KEYMGMT\fR\|(3),
  232. \&\fBEVP_PKEY\fR\|(3),
  233. \&\fBprovider\-keymgmt\fR\|(7),
  234. \&\fBOSSL_PROVIDER\-default\fR\|(7),
  235. \&\fBOSSL_PROVIDER\-FIPS\fR\|(7),
  236. .SH COPYRIGHT
  237. .IX Header "COPYRIGHT"
  238. Copyright 2020\-2021 The OpenSSL Project Authors. All Rights Reserved.
  239. .PP
  240. Licensed under the Apache License 2.0 (the "License"). You may not use
  241. this file except in compliance with the License. You can obtain a copy
  242. in the file LICENSE in the source distribution or at
  243. <https://www.openssl.org/source/license.html>.