EVP_PKEY-FFC(7ossl)
๐ EVP_PKEY-FFC ๐
Okay bestie, so this is the EVP_PKEY-FFC(7ossl) page from OpenSSL, and it's literally all about the shared FFC parameters for DSA and DH/DHX. No cap, it's giving very niche crypto energy but we're gonna make it make sense. โจ
โจ DESCRIPTION โจ
So like, finite field cryptography (FFC) is this whole method of implementing discrete logarithm cryptography using finite field mathematics. DSA is the classic example of FFC, and honestly the Diffie-Hellman key establishment algorithms specified in SP800-56A can also be implemented as FFC. It's giving math girlie realness. ๐งฎ๐
The DSA, DH and DHX keytypes are implemented in OpenSSL's default and FIPS providers. The implementations support the basic DSA, DH and DHX keys, containing the public and private keys pub and priv as well as the three main domain parameters p, q and g. Slay. ๐
For DSA (and DH that is not a named group) the FIPS186-4 standard specifies that the values used for FFC parameter generation are also required for parameter validation. This means that optional FFC domain parameter values for seed, pcounter and gindex may need to be stored for validation purposes. For DH the seed and pcounter can be stored in ASN1 data (but the gindex is not). For DSA however, these fields are not stored in the ASN1 data so they need to be stored externally if validation is required. So like, keep your receipts, bestie. ๐งพ
The DH key type uses PKCS#3 format which saves p and g, but not the q value. The DHX key type uses X9.42 format which saves the value of q and this must be used for FIPS186-4. Periodt. ๐ฅ
๐ธ FFC parameters ๐ธ
In addition to the common parameters that all keytypes should support (see "Common parameters" in provider-keymgmt(7)), the DSA, DH and DHX keytype implementations support the following. Obsessed with how thorough this is. ๐ซถ
"pub"(OSSL_PKEY_PARAM_PUB_KEY) <unsigned integer> โ The public key value. Like, the one everyone can see. ๐"priv"(OSSL_PKEY_PARAM_PRIV_KEY) <unsigned integer> โ The private key value. Keep this one close to your chest, bestie. ๐คซ
๐ FFC DSA, DH and DHX domain parameters ๐
"p"(OSSL_PKEY_PARAM_FFC_P) <unsigned integer> โ A DSA or Diffie-Hellman prime"p"value. Big prime energy. ๐ข"g"(OSSL_PKEY_PARAM_FFC_G) <unsigned integer> โ A DSA or Diffie-Hellman generator"g"value. She generates. ๐
๐ฆ FFC DSA and DHX domain parameters ๐ฆ
"q"(OSSL_PKEY_PARAM_FFC_Q) <unsigned integer> โ A DSA or Diffie-Hellman prime"q"value. The other prime, not to be confused with"p". ๐"seed"(OSSL_PKEY_PARAM_FFC_SEED) <octet string> โ An optional domain parameter seed value used during generation and validation ofp,qand canonicalg. For validation this needs to set the seed that was produced during generation. Like, remember where you came from. ๐ฑ"gindex"(OSSL_PKEY_PARAM_FFC_GINDEX) <integer> โ Sets the index to use for canonical generation and verification of the generatorg. Set this to a positive value from0..FFto use this mode. Thisgindexcan then be reused during key validation to verify the value ofg. If this value is not set or is-1then unverifiable generation of the generatorgwill be used. So like,-1is giving "idk her" energy and positive values are giving "I know exactly who she is." ๐โโ๏ธ"pcounter"(OSSL_PKEY_PARAM_FFC_PCOUNTER) <integer> โ An optional domain parameter counter value that is output during generation ofp. This value must be saved if domain parameter validation is required. Save it like you save your streaks. ๐ฅ"hindex"(OSSL_PKEY_PARAM_FFC_H) <integer> โ For unverifiable generation of the generatorgthis value is output during generation ofg. Its value is the first integer larger than one that satisfiesg = h^j mod p(whereg != 1and"j"is the cofactor). Math math math, but make it iconic. ๐งฎ"j"(OSSL_PKEY_PARAM_FFC_COFACTOR) <unsigned integer> โ An optional informational cofactor parameter that should equal to(p - 1) / q. It's giving "should equal to" so like, don't come for me if it doesn't. ๐"validate-pq"(OSSL_PKEY_PARAM_FFC_VALIDATE_PQ) <unsigned integer>"validate-g"(OSSL_PKEY_PARAM_FFC_VALIDATE_G) <unsigned integer> โ These boolean values are used during FIPS186-4 or FIPS186-2 key validation checks (SeeEVP_PKEY_param_check(3)) to select validation options. By defaultvalidate-pqandvalidate-gare both set to1to check thatp,qandgare valid. Either of these may be set to0to skip a test, which is mainly useful for testing purposes. So like, you can turn them off but only if you're just testing, bestie. Don't skip the vibe check in prod. ๐จ"validate-legacy"(OSSL_PKEY_PARAM_FFC_VALIDATE_LEGACY) <unsigned integer> โ This boolean value is used during key validation checks (SeeEVP_PKEY_param_check(3)) to select the validation type. The default value of0selects FIPS186-4 validation. Setting this value to1selects FIPS186-2 validation. The old standard is giving legacy for a reason. ๐ต
๐ FFC key generation parameters ๐
The following key generation types are available for DSA and DHX algorithms. Genuinely so much range here. ๐
"type"(OSSL_PKEY_PARAM_FFC_TYPE) <UTF8 string> โ Sets the type of parameter generation. The shared valid values are:"fips186_4"โ The current standard. The main character. ๐"fips186_2"โ The old standard that should only be used for legacy purposes. She's retired but still shows up to the group chat. ๐"default"โ This can choose one of"fips186_4"or"fips186_2"depending on other parameters set for parameter generation. The "you decide" option. ๐
"pbits"(OSSL_PKEY_PARAM_FFC_PBITS) <unsigned integer> โ Sets the size (in bits) of the prime'p'. Size matters, okay? ๐"qbits"(OSSL_PKEY_PARAM_FFC_QBITS) <unsigned integer> โ Sets the size (in bits) of the prime'q'. For"fips186_4"this can be either224or256. For"fips186_2"this has a size of160. No cap, those are the exact numbers. ๐ข"digest"(OSSL_PKEY_PARAM_FFC_DIGEST) <UTF8 string> โ Sets the Digest algorithm to be used as part of the Key Generation Function associated with the given Key Generationctx. This must also be set for key validation. So like, don't forget it for validation too, bestie. ๐ง"properties"(OSSL_PKEY_PARAM_FFC_DIGEST_PROPS) <UTF8 string> โ Sets properties to be used upon look up of the implementation for the selected Digest algorithm for the Key Generation Function associated with the given key generationctx. This may also be set for key validation. It's giving "lookup vibes" and we respect it. ๐"seed"(OSSL_PKEY_PARAM_FFC_SEED) <octet string> โ For"fips186_4"or"fips186_2"generation this sets the seed data to use instead of generating a random seed internally. This should be used for testing purposes only. This will either produce fixed values for the generated parameters OR it will fail if the seed did not generate valid primes. Like, testing only, don't come crying to me if you use this in prod. ๐"gindex"(OSSL_PKEY_PARAM_FFC_GINDEX) <integer>"pcounter"(OSSL_PKEY_PARAM_FFC_PCOUNTER) <integer>"hindex"(OSSL_PKEY_PARAM_FFC_H) <integer> โ These types are described above. Just scroll up, bestie. โฌ๏ธ
๐ CONFORMING TO ๐
The following sections of SP800-56Ar3:
5.5.1.1 FFC Domain Parameter Selection/Generation
The following sections of FIPS186-4:
A.1.1.2 Generation of Probable Primes p and q Using an Approved Hash Function.A.2.3 Generation of canonical generator g.A.2.1 Unverifiable Generation of the Generator g.
She's standards-compliant and she knows it. ๐ ๐
๐ SEE ALSO ๐
EVP_PKEY-DSA(7), EVP_PKEY-DH(7), EVP_SIGNATURE-DSA(7), EVP_KEYEXCH-DH(7), EVP_KEYMGMT(3), EVP_PKEY(3), provider-keymgmt(7), OSSL_PROVIDER-default(7), OSSL_PROVIDER-FIPS(7)
Like, go read those too if you want the full lore. ๐โจ
๐ COPYRIGHT ๐
Copyright 2020-2025 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
Okay bestie, that's the whole page. Version 3.5.6, dated 2026-04-07, and it's literally the EVP_PKEY-FFC(7ossl) manual. You ate that. ๐
โจ๐ฆ
๐ฆ where this page comes from
- freebsd 15.1: base 15.1
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms