提交 f112dc82 编写于 作者: M Matt Caswell

Ignore the digest in req app if using EdDSA

This follows on from the previous commit, and makes the same change to
ignore the digest if we are using EdDSA.
Reviewed-by: NViktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6901)
上级 aabbc24e
...@@ -1601,10 +1601,19 @@ static int do_sign_init(EVP_MD_CTX *ctx, EVP_PKEY *pkey, ...@@ -1601,10 +1601,19 @@ static int do_sign_init(EVP_MD_CTX *ctx, EVP_PKEY *pkey,
const EVP_MD *md, STACK_OF(OPENSSL_STRING) *sigopts) const EVP_MD *md, STACK_OF(OPENSSL_STRING) *sigopts)
{ {
EVP_PKEY_CTX *pkctx = NULL; EVP_PKEY_CTX *pkctx = NULL;
int i; int i, def_nid;
if (ctx == NULL) if (ctx == NULL)
return 0; return 0;
/*
* EVP_PKEY_get_default_digest_nid() returns 2 if the digest is mandatory
* for this algorithm.
*/
if (EVP_PKEY_get_default_digest_nid(pkey, &def_nid) == 2
&& def_nid == NID_undef) {
/* The signing algorithm requires there to be no digest */
md = NULL;
}
if (!EVP_DigestSignInit(ctx, &pkctx, md, NULL, pkey)) if (!EVP_DigestSignInit(ctx, &pkctx, md, NULL, pkey))
return 0; return 0;
for (i = 0; i < sk_OPENSSL_STRING_num(sigopts); i++) { for (i = 0; i < sk_OPENSSL_STRING_num(sigopts); i++) {
......
...@@ -209,7 +209,7 @@ the configuration file. ...@@ -209,7 +209,7 @@ the configuration file.
Some public key algorithms may override this choice. For instance, DSA Some public key algorithms may override this choice. For instance, DSA
signatures always use SHA1, GOST R 34.10 signatures always use signatures always use SHA1, GOST R 34.10 signatures always use
GOST R 34.11-94 (B<-md_gost94>). GOST R 34.11-94 (B<-md_gost94>), Ed25519 and Ed448 never use any digest.
=item B<-config filename> =item B<-config filename>
...@@ -394,10 +394,10 @@ option. For compatibility B<encrypt_rsa_key> is an equivalent option. ...@@ -394,10 +394,10 @@ option. For compatibility B<encrypt_rsa_key> is an equivalent option.
=item B<default_md> =item B<default_md>
This option specifies the digest algorithm to use. This option specifies the digest algorithm to use. Any digest supported by the
Any digest supported by the OpenSSL B<dgst> command can be used. OpenSSL B<dgst> command can be used. This option can be overridden on the
If not present then MD5 is used. command line. Certain signing algorithms (i.e. Ed25519 and Ed448) will ignore
This option can be overridden on the command line. any digest that has been set.
=item B<string_mask> =item B<string_mask>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册