summaryrefslogtreecommitdiff
path: root/fips/utl
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2011-06-02 17:30:22 +0000
committerDr. Stephen Henson <steve@openssl.org>2011-06-02 17:30:22 +0000
commit0cabe4e1722b09e3598c30fbfb1992ba4ae84d69 (patch)
tree6f864f8ae85d31a7ba41fedb8044b84a0e27eb6a /fips/utl
parentb6df360b9eacbb758c30cda76a45368ad9012e83 (diff)
downloadopenssl-new-0cabe4e1722b09e3598c30fbfb1992ba4ae84d69.tar.gz
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.
Diffstat (limited to 'fips/utl')
-rw-r--r--fips/utl/fips_md.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/fips/utl/fips_md.c b/fips/utl/fips_md.c
index d3db1c7188..5e9fe4e4ee 100644
--- a/fips/utl/fips_md.c
+++ b/fips/utl/fips_md.c
@@ -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;
+ }
+ }