From 96bb4ff9b8473d01d9ac9301ec0f796898c8f459 Mon Sep 17 00:00:00 2001 From: Shane Lontis Date: Fri, 11 Sep 2020 14:38:22 +1000 Subject: [PATCH] Fix EVP_PKEY_CTX_ctrl() documentation Remove references to 'macro' from EVP_PKEY_CTX_ctrl() as they are all functions now, and update the HISTORY section. Reviewed-by: Nicola Tuveri Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/12853) --- doc/man3/EVP_PKEY_CTX_ctrl.pod | 209 +++++++++++++++------------------ 1 file changed, 95 insertions(+), 114 deletions(-) diff --git a/doc/man3/EVP_PKEY_CTX_ctrl.pod b/doc/man3/EVP_PKEY_CTX_ctrl.pod index 3e0b35ffa1..794ad2053a 100644 --- a/doc/man3/EVP_PKEY_CTX_ctrl.pod +++ b/doc/man3/EVP_PKEY_CTX_ctrl.pod @@ -176,9 +176,9 @@ EVP_PKEY_CTX_set1_id, EVP_PKEY_CTX_get1_id, EVP_PKEY_CTX_get1_id_len =head1 DESCRIPTION -The function EVP_PKEY_CTX_ctrl() sends a control operation to the context -I. The key type used must match I if it is not -1. The parameter -I is a mask indicating which operations the control can be applied to. +EVP_PKEY_CTX_ctrl() sends a control operation to the context I. The key +type used must match I if it is not -1. The parameter I is a +mask indicating which operations the control can be applied to. The control command is indicated in I and any additional arguments in I and I. @@ -186,39 +186,37 @@ For I = B, I is the length of the MAC key, and I is the MAC key. This is used by Poly1305, SipHash, HMAC and CMAC. Applications will not normally call EVP_PKEY_CTX_ctrl() directly but will -instead call one of the algorithm specific macros below. +instead call one of the algorithm specific functions below. -The function EVP_PKEY_CTX_ctrl_uint64() is a wrapper that directly passes a +EVP_PKEY_CTX_ctrl_uint64() is a wrapper that directly passes a uint64 value as I to EVP_PKEY_CTX_ctrl(). -The function EVP_PKEY_CTX_ctrl_str() allows an application to send an algorithm +EVP_PKEY_CTX_ctrl_str() allows an application to send an algorithm specific control operation to a context I in string form. This is intended to be used for options specified on the command line or in text files. The commands supported are documented in the openssl utility command line pages for the option I<-pkeyopt> which is supported by the I, I and I commands. -The function EVP_PKEY_CTX_md() sends a message digest control operation -to the context I. The message digest is specified by its name I. +EVP_PKEY_CTX_md() sends a message digest control operation to the context +I. The message digest is specified by its name I. -The EVP_PKEY_CTX_set_signature_md() function sets the message digest type used +EVP_PKEY_CTX_set_signature_md() sets the message digest type used in a signature. It can be used in the RSA, DSA and ECDSA algorithms. -The EVP_PKEY_CTX_get_signature_md() function gets the message digest type used +EVP_PKEY_CTX_get_signature_md()gets the message digest type used in a signature. It can be used in the RSA, DSA and ECDSA algorithms. -All the remaining "functions" are implemented as macros. - Key generation typically involves setting up parameters to be used and generating the private and public key data. Some algorithm implementations -allow private key data to be set explicitly using the EVP_PKEY_CTX_set_mac_key() -macro. In this case key generation is simply the process of setting up the -parameters for the key and then setting the raw key data to the value explicitly -provided by that macro. Normally applications would call -L or similar functions instead of this macro. +allow private key data to be set explicitly using EVP_PKEY_CTX_set_mac_key(). +In this case key generation is simply the process of setting up the +parameters for the key and then setting the raw key data to the value explicitly. +Normally applications would call L or similar +functions instead. -The EVP_PKEY_CTX_set_mac_key() macro can be used with any of the algorithms -supported by the L function. +EVP_PKEY_CTX_set_mac_key() can be used with any of the algorithms supported by +the L function. EVP_PKEY_CTX_set_group_name() sets the group name to I for parameter and key generation. For example for EC keys this will set the curve name and for @@ -231,7 +229,7 @@ terminating NUL byte. =head2 RSA parameters -The EVP_PKEY_CTX_set_rsa_padding() function sets the RSA padding mode for I. +EVP_PKEY_CTX_set_rsa_padding() sets the RSA padding mode for I. The I parameter can take the value B for PKCS#1 padding, B for SSLv23 padding, B for no padding, B for OAEP padding (encrypt and @@ -241,7 +239,7 @@ B for TLS RSA ClientKeyExchange message padding (decryption only). Two RSA padding modes behave differently if EVP_PKEY_CTX_set_signature_md() -is used. If this macro is called for PKCS#1 padding the plaintext buffer is +is used. If this function is called for PKCS#1 padding the plaintext buffer is an actual digest value and is encapsulated in a DigestInfo structure according to PKCS#1 when signing and this structure is expected (and stripped off) when verifying. If this control is not used with RSA and PKCS#1 padding then the @@ -250,13 +248,12 @@ padding for RSA the algorithm identifier byte is added or checked and removed if this control is called. If it is not called then the first byte of the plaintext buffer is expected to be the algorithm identifier byte. -The EVP_PKEY_CTX_get_rsa_padding() function gets the RSA padding mode for I. +EVP_PKEY_CTX_get_rsa_padding() gets the RSA padding mode for I. -The EVP_PKEY_CTX_set_rsa_pss_saltlen() function sets the RSA PSS salt -length to I. As its name implies it is only supported for PSS -padding. If this function is not called then the maximum salt length -is used when signing and auto detection when verifying. Three special -values are supported: +EVP_PKEY_CTX_set_rsa_pss_saltlen() sets the RSA PSS salt length to I. +As its name implies it is only supported for PSS padding. If this function is +not called then the maximum salt length is used when signing and auto detection +when verifying. Three special values are supported: =over 4 @@ -276,74 +273,73 @@ meaning as B. =back -The EVP_PKEY_CTX_get_rsa_pss_saltlen() function gets the RSA PSS salt length -for I. The padding mode must already have been set to -B. +EVP_PKEY_CTX_get_rsa_pss_saltlen() gets the RSA PSS salt length for I. +The padding mode must already have been set to B. -The EVP_PKEY_CTX_set_rsa_keygen_bits() macro sets the RSA key length for +EVP_PKEY_CTX_set_rsa_keygen_bits() sets the RSA key length for RSA key generation to I. If not specified 2048 bits is used. -The EVP_PKEY_CTX_set_rsa_keygen_pubexp() macro sets the public exponent value -for RSA key generation to I. Currently it should be an odd integer. The +EVP_PKEY_CTX_set_rsa_keygen_pubexp() sets the public exponent value for RSA key +generation to I. Currently it should be an odd integer. The I pointer is used internally by this function so it should not be modified or freed after the call. If not specified 65537 is used. -The EVP_PKEY_CTX_set_rsa_keygen_primes() macro sets the number of primes for +EVP_PKEY_CTX_set_rsa_keygen_primes() sets the number of primes for RSA key generation to I. If not specified 2 is used. -The EVP_PKEY_CTX_set_rsa_mgf1_md_name() function sets the MGF1 digest for RSA +EVP_PKEY_CTX_set_rsa_mgf1_md_name() sets the MGF1 digest for RSA padding schemes to the digest named I. If the RSA algorithm implementation for the selected provider supports it then the digest will be fetched using the properties I. If not explicitly set the signing digest is used. The padding mode must have been set to B or B. -The EVP_PKEY_CTX_set_rsa_mgf1_md() function does the same as +EVP_PKEY_CTX_set_rsa_mgf1_md() does the same as EVP_PKEY_CTX_set_rsa_mgf1_md_name() except that the name of the digest is inferred from the supplied I and it is not possible to specify any properties. -The EVP_PKEY_CTX_get_rsa_mgf1_md_name() function gets the name of the MGF1 +EVP_PKEY_CTX_get_rsa_mgf1_md_name() gets the name of the MGF1 digest algorithm for I. If not explicitly set the signing digest is used. The padding mode must have been set to B or B. -The EVP_PKEY_CTX_get_rsa_mgf1_md() function does the same as +EVP_PKEY_CTX_get_rsa_mgf1_md() does the same as EVP_PKEY_CTX_get_rsa_mgf1_md_name() except that it returns a pointer to an EVP_MD object instead. Note that only known, built-in EVP_MD objects will be returned. The EVP_MD object may be NULL if the digest is not one of these (such as a digest only implemented in a third party provider). -The EVP_PKEY_CTX_set_rsa_oaep_md_name() function sets the message digest type +EVP_PKEY_CTX_set_rsa_oaep_md_name() sets the message digest type used in RSA OAEP to the digest named I. If the RSA algorithm implementation for the selected provider supports it then the digest will be fetched using the properties I. The padding mode must have been set to B. -The EVP_PKEY_CTX_set_rsa_oaep_md() function does the same as +EVP_PKEY_CTX_set_rsa_oaep_md() does the same as EVP_PKEY_CTX_set_rsa_oaep_md_name() except that the name of the digest is inferred from the supplied I and it is not possible to specify any properties. -The EVP_PKEY_CTX_get_rsa_oaep_md_name() function gets the message digest +EVP_PKEY_CTX_get_rsa_oaep_md_name() gets the message digest algorithm name used in RSA OAEP and stores it in the buffer I which is of size I. The padding mode must have been set to B. The buffer should be sufficiently large for any expected digest algorithm names or the function will fail. -The EVP_PKEY_CTX_get_rsa_oaep_md() function does the same as +EVP_PKEY_CTX_get_rsa_oaep_md() does the same as EVP_PKEY_CTX_get_rsa_oaep_md_name() except that it returns a pointer to an EVP_MD object instead. Note that only known, built-in EVP_MD objects will be returned. The EVP_MD object may be NULL if the digest is not one of these (such as a digest only implemented in a third party provider). -The EVP_PKEY_CTX_set0_rsa_oaep_label() function sets the RSA OAEP label to +EVP_PKEY_CTX_set0_rsa_oaep_label() sets the RSA OAEP label to I