From: Matt Caswell Date: Wed, 6 Nov 2019 13:39:21 +0000 (+0000) Subject: Document various new/changes EVP_PKEY_CTX_* functions X-Git-Tag: openssl-3.0.0-alpha1~954 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d8fef6da579c23956c57b03488cb8702cd6d2066;p=oweals%2Fopenssl.git Document various new/changes EVP_PKEY_CTX_* functions We have converted a number of macros to functions and made them work with providers. We've also added some *_ex() variants that needed documenting. Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/10152) --- diff --git a/doc/man3/EVP_PKEY_CTX_ctrl.pod b/doc/man3/EVP_PKEY_CTX_ctrl.pod index fe12b09043..06151d4a5c 100644 --- a/doc/man3/EVP_PKEY_CTX_ctrl.pod +++ b/doc/man3/EVP_PKEY_CTX_ctrl.pod @@ -20,10 +20,14 @@ EVP_PKEY_CTX_get_rsa_pss_saltlen, EVP_PKEY_CTX_set_rsa_keygen_bits, EVP_PKEY_CTX_set_rsa_keygen_pubexp, EVP_PKEY_CTX_set_rsa_keygen_primes, +EVP_PKEY_CTX_set_rsa_mgf1_md_name, EVP_PKEY_CTX_set_rsa_mgf1_md, EVP_PKEY_CTX_get_rsa_mgf1_md, +EVP_PKEY_CTX_get_rsa_mgf1_md_name, +EVP_PKEY_CTX_set_rsa_oaep_md_name, EVP_PKEY_CTX_set_rsa_oaep_md, EVP_PKEY_CTX_get_rsa_oaep_md, +EVP_PKEY_CTX_get_rsa_oaep_md_name, EVP_PKEY_CTX_set0_rsa_oaep_label, EVP_PKEY_CTX_get0_rsa_oaep_label, EVP_PKEY_CTX_set_dsa_paramgen_bits, @@ -95,10 +99,18 @@ EVP_PKEY_CTX_set1_id, EVP_PKEY_CTX_get1_id, EVP_PKEY_CTX_get1_id_len int EVP_PKEY_CTX_set_rsa_keygen_bits(EVP_PKEY_CTX *ctx, int mbits); int EVP_PKEY_CTX_set_rsa_keygen_pubexp(EVP_PKEY_CTX *ctx, BIGNUM *pubexp); int EVP_PKEY_CTX_set_rsa_keygen_primes(EVP_PKEY_CTX *ctx, int primes); + int EVP_PKEY_CTX_set_rsa_mgf1_md_name(EVP_PKEY_CTX *ctx, const char *mdname, + const char *mdprops); int EVP_PKEY_CTX_set_rsa_mgf1_md(EVP_PKEY_CTX *ctx, const EVP_MD *md); int EVP_PKEY_CTX_get_rsa_mgf1_md(EVP_PKEY_CTX *ctx, const EVP_MD **md); + int EVP_PKEY_CTX_get_rsa_mgf1_md_name(EVP_PKEY_CTX *ctx, char *name, + size_t namelen); + int EVP_PKEY_CTX_set_rsa_oaep_md_name(EVP_PKEY_CTX *ctx, const char *mdname, + const char *mdprops); int EVP_PKEY_CTX_set_rsa_oaep_md(EVP_PKEY_CTX *ctx, const EVP_MD *md); int EVP_PKEY_CTX_get_rsa_oaep_md(EVP_PKEY_CTX *ctx, const EVP_MD **md); + int EVP_PKEY_CTX_get_rsa_oaep_md_name(EVP_PKEY_CTX *ctx, char *name, + size_t namelen) int EVP_PKEY_CTX_set0_rsa_oaep_label(EVP_PKEY_CTX *ctx, unsigned char *label, int len); int EVP_PKEY_CTX_get0_rsa_oaep_label(EVP_PKEY_CTX *ctx, unsigned char **label); @@ -241,7 +253,7 @@ supported by the L function. =head2 RSA parameters -The EVP_PKEY_CTX_set_rsa_padding() macro sets the RSA padding mode for B. +The EVP_PKEY_CTX_set_rsa_padding() function sets the RSA padding mode for B. The B parameter can take the value B for PKCS#1 padding, B for SSLv23 padding, B for no padding, B for OAEP padding (encrypt and @@ -258,7 +270,7 @@ 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() macro gets the RSA padding mode for B. +The EVP_PKEY_CTX_get_rsa_padding() function gets the RSA padding mode for B. The EVP_PKEY_CTX_set_rsa_pss_saltlen() macro sets the RSA PSS salt length to B. As its name implies it is only supported for PSS padding. Three special @@ -283,30 +295,59 @@ 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 RSA key generation to B. If not specified 2 is used. -The EVP_PKEY_CTX_set_rsa_mgf1_md() macro sets the MGF1 digest for RSA padding -schemes to B. If not explicitly set the signing digest is used. The -padding mode must have been set to B +The EVP_PKEY_CTX_set_rsa_mgf1_md_name() function sets the MGF1 digest for RSA +padding schemes to the digest named B. If the RSA algorithm +implementation for the selected provider supports it then the digest will be +fetched using the properties B. 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() macro gets the MGF1 digest for B. -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_oaep_md() macro sets the message digest type used -in RSA OAEP to B. The padding mode must have been set to +The EVP_PKEY_CTX_set_rsa_mgf1_md() function does the same as +EVP_PKEY_CTX_set_rsa_mgf1_md_name() except that the name of the digest is +inferred from the supplied B 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 +digest algorithm for B. 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_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 +used in RSA OAEP to the digest named B. If the RSA algorithm +implementation for the selected provider supports it then the digest will be +fetched using the properties B. The padding mode must have been set to B. -The EVP_PKEY_CTX_get_rsa_oaep_md() macro gets the message digest type used -in RSA OAEP to B. 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_name() except that the name of the digest is +inferred from the supplied B and it is not possible to specify any +properties. + +The EVP_PKEY_CTX_get_rsa_oaep_md_name() function gets the message digest +algorithm name used in RSA OAEP and stores it in the buffer B which is of +size B. 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_set0_rsa_oaep_label() macro sets the RSA OAEP label to +The EVP_PKEY_CTX_get_rsa_oaep_md() function 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 B