diff options
author | Libor Krystek <krystek@ica.cz> | 2014-07-02 00:30:13 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2014-07-02 00:33:10 +0100 |
commit | a5ff18bf90a204f04c878d777db6a6b25d9f63a9 (patch) | |
tree | fd28b78159d5b1b75e37617f33248a43a5222c65 /engines | |
parent | 22a10c89d7c3f951339c385d57cc8fd23c0a800b (diff) |
Add support for SHA2 in CAPI ENGINE.
PR#2706 though patch is from PR#3366.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/e_capi.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/engines/e_capi.c b/engines/e_capi.c index a3456a330c..d4221cbae3 100644 --- a/engines/e_capi.c +++ b/engines/e_capi.c @@ -114,6 +114,26 @@ #define CERT_SYSTEM_STORE_CURRENT_USER 0x00010000 #endif +#ifndef ALG_SID_SHA_256 + #define ALG_SID_SHA_256 12 +#endif +#ifndef ALG_SID_SHA_384 + #define ALG_SID_SHA_384 13 +#endif +#ifndef ALG_SID_SHA_512 + #define ALG_SID_SHA_512 14 +#endif + +#ifndef CALG_SHA_256 + #define CALG_SHA_256 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_256) +#endif +#ifndef CALG_SHA_384 + #define CALG_SHA_384 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_384) +#endif +#ifndef CALG_SHA_512 + #define CALG_SHA_512 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_512) +#endif + #include <openssl/engine.h> #include <openssl/pem.h> #include <openssl/x509v3.h> @@ -821,6 +841,18 @@ int capi_rsa_sign(int dtype, const unsigned char *m, unsigned int m_len, /* Convert the signature type to a CryptoAPI algorithm ID */ switch(dtype) { + case NID_sha256: + alg = CALG_SHA_256; + break; + + case NID_sha384: + alg = CALG_SHA_384; + break; + + case NID_sha512: + alg = CALG_SHA_512; + break; + case NID_sha1: alg = CALG_SHA1; break; |