Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 18 additions & 25 deletions RSA.xs
Original file line number Diff line number Diff line change
Expand Up @@ -230,40 +230,33 @@ int get_digest_length(int hash_method)

EVP_MD *get_md_bynid(int hash_method)
{
const char *name;
EVP_MD *md;

switch(hash_method)
{
case NID_md5:
return EVP_MD_fetch(NULL, "md5", NULL);
break;
case NID_sha1:
return EVP_MD_fetch(NULL, "sha1", NULL);
break;
case NID_md5: name = "md5"; break;
case NID_sha1: name = "sha1"; break;
#ifdef SHA512_DIGEST_LENGTH
case NID_sha224:
return EVP_MD_fetch(NULL, "sha224", NULL);
break;
case NID_sha256:
return EVP_MD_fetch(NULL, "sha256", NULL);
break;
case NID_sha384:
return EVP_MD_fetch(NULL, "sha384", NULL);
break;
case NID_sha512:
return EVP_MD_fetch(NULL, "sha512", NULL);
break;
case NID_sha224: name = "sha224"; break;
case NID_sha256: name = "sha256"; break;
case NID_sha384: name = "sha384"; break;
case NID_sha512: name = "sha512"; break;
#endif
case NID_ripemd160:
return EVP_MD_fetch(NULL, "ripemd160", NULL);
break;
case NID_ripemd160: name = "ripemd160"; break;
#ifdef WHIRLPOOL_DIGEST_LENGTH
case NID_whirlpool:
return EVP_MD_fetch(NULL, "whirlpool", NULL);
break;
case NID_whirlpool: name = "whirlpool"; break;
#endif
default:
croak("Unknown digest hash mode %u", hash_method);
break;
return NULL;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@toddr-bot do we need the return NULL here considering the croak?

}

md = EVP_MD_fetch(NULL, name, NULL);
if (!md)
croak("Digest algorithm '%s' is not available"
" (you may need to load the legacy provider)", name);
return md;
}

/* Configure PSS/PKCS1 padding, signature digest, and MGF1 on an already-initialised
Expand Down
Loading