[PATCH 15/16] ncrypt: Implement NCryptVerifySignature

abdaandroid at gmail.com abdaandroid at gmail.com
Sun Oct 11 10:45:34 CDT 2020


From: Ariel Darshan <abdaandroid at gmail.com>

Signed-off-by: Ariel Darshan <abdaandroid at gmail.com>
---
 dlls/ncrypt/main.c      | 24 ++++++++++++++++++++++++
 dlls/ncrypt/ncrypt.spec |  2 +-
 include/ncrypt.h        |  1 +
 3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/dlls/ncrypt/main.c b/dlls/ncrypt/main.c
index bb6f90e6cf9..3eca9018bec 100644
--- a/dlls/ncrypt/main.c
+++ b/dlls/ncrypt/main.c
@@ -631,6 +631,30 @@ SECURITY_STATUS WINAPI NCryptSignHash(NCRYPT_KEY_HANDLE key, void *paddingInfo,
     return providerInstance->functions.SignHash(keyInstance->kspHandle, paddingInfo, hashValue, hashSize, signature, signatureSize, result, flags);
 }
 
+SECURITY_STATUS WINAPI NCryptVerifySignature(NCRYPT_KEY_HANDLE key, void *paddingInfo, PBYTE hashValue,
+                                             DWORD hashSize, PBYTE signature, DWORD signatureSize, DWORD flags)
+{
+    struct ncrypt_key_instance *keyInstance;
+    struct ncrypt_provider_instance * providerInstance;
+
+    TRACE("(0x%lx, %p, %p, 0x%08x, %p, 0x%08x, 0x%08x)\n", key, paddingInfo, hashValue, hashSize,
+                                                            signature, signatureSize, flags);
+
+    if (!key)
+    {
+        return NTE_INVALID_HANDLE;
+    }
+    keyInstance = handle2key(key);
+
+    if (!keyInstance->provider)
+    {
+        return NTE_INVALID_HANDLE;
+    }
+    providerInstance = handle2provider(keyInstance->provider);
+
+    return providerInstance->functions.VerifySignature(keyInstance->kspHandle, paddingInfo, hashValue, hashSize, signature, signatureSize, flags);
+}
+
 static SECURITY_STATUS open_provider(NCRYPT_PROV_HANDLE *providerInstance, const WCHAR *name, const WCHAR *dllName, DWORD flags)
 {
     unsigned int size;
diff --git a/dlls/ncrypt/ncrypt.spec b/dlls/ncrypt/ncrypt.spec
index 9c09b061ff7..77283351660 100644
--- a/dlls/ncrypt/ncrypt.spec
+++ b/dlls/ncrypt/ncrypt.spec
@@ -101,7 +101,7 @@
 @ stub NCryptUnprotectKey
 @ stub NCryptUnprotectSecret
 @ stub NCryptVerifyClaim
-@ stub NCryptVerifySignature
+@ stdcall NCryptVerifySignature(long ptr ptr long ptr long long)
 @ stub SslChangeNotify
 @ stub SslComputeClientAuthHash
 @ stub SslComputeEapKeyBlock
diff --git a/include/ncrypt.h b/include/ncrypt.h
index 2a58067b54d..6a002d148ab 100644
--- a/include/ncrypt.h
+++ b/include/ncrypt.h
@@ -93,6 +93,7 @@ SECURITY_STATUS WINAPI NCryptOpenKey(NCRYPT_PROV_HANDLE, NCRYPT_KEY_HANDLE *, co
 SECURITY_STATUS WINAPI NCryptOpenStorageProvider(NCRYPT_PROV_HANDLE *, const WCHAR *, DWORD);
 SECURITY_STATUS WINAPI NCryptSetProperty(NCRYPT_HANDLE, const WCHAR *, PBYTE, DWORD, DWORD);
 SECURITY_STATUS WINAPI NCryptSignHash(NCRYPT_KEY_HANDLE, void *, PBYTE, DWORD, PBYTE, DWORD, DWORD *, DWORD);
+SECURITY_STATUS WINAPI NCryptVerifySignature(NCRYPT_KEY_HANDLE, void *, PBYTE, DWORD, PBYTE, DWORD, DWORD);
 
 #ifdef __cplusplus
 }
-- 
2.28.0




More information about the wine-devel mailing list