Move FIPS RSA function definitions to fips.h

New function to lookup digests by NID in module.

Minor optimisation: if supplied hash is NULL to FIPS RSA functions and
we are using PKCS padding get digest NID from otherwise unused saltlen
parameter instead.
This commit is contained in:
Dr. Stephen Henson
2011-06-02 17:30:22 +00:00
parent b6df360b9e
commit 0cabe4e172
4 changed files with 64 additions and 20 deletions

View File

@@ -321,3 +321,27 @@ int FIPS_md_ctx_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in)
return 1;
}
const EVP_MD *FIPS_get_digestbynid(int nid)
{
switch (nid)
{
case NID_sha1:
return EVP_sha1();
case NID_sha224:
return EVP_sha224();
case NID_sha256:
return EVP_sha256();
case NID_sha384:
return EVP_sha384();
case NID_sha512:
return EVP_sha512();
default:
return NULL;
}
}