[PATCH 4/5] dssenh: Implement CPGenRandom.

Hans Leidekker hans at codeweavers.com
Mon Oct 12 09:11:11 CDT 2020


Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
 dlls/dssenh/dssenh.spec |  2 +-
 dlls/dssenh/main.c      | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/dlls/dssenh/dssenh.spec b/dlls/dssenh/dssenh.spec
index e74650c9bb7..eb9ef06337a 100644
--- a/dlls/dssenh/dssenh.spec
+++ b/dlls/dssenh/dssenh.spec
@@ -9,7 +9,7 @@
 @ stub CPEncrypt
 @ stdcall CPExportKey(ptr ptr ptr long long ptr ptr)
 @ stdcall CPGenKey(ptr long long ptr)
-@ stub CPGenRandom
+@ stdcall CPGenRandom(ptr long ptr)
 @ stdcall CPGetHashParam(ptr ptr long ptr ptr long)
 @ stub CPGetKeyParam
 @ stdcall CPGetProvParam(ptr long ptr ptr long)
diff --git a/dlls/dssenh/main.c b/dlls/dssenh/main.c
index 38ee325b8ee..ce7b15f7a66 100644
--- a/dlls/dssenh/main.c
+++ b/dlls/dssenh/main.c
@@ -27,6 +27,7 @@
 #include "bcrypt.h"
 #include "objbase.h"
 #include "rpcproxy.h"
+#include "ntsecapi.h"
 
 #include "wine/debug.h"
 #include "wine/heap.h"
@@ -498,6 +499,17 @@ BOOL WINAPI CPDuplicateKey( HCRYPTPROV hprov, HCRYPTKEY hkey, DWORD *reserved, D
     return TRUE;
 }
 
+BOOL WINAPI CPGenRandom( HCRYPTPROV hprov, DWORD len, BYTE *buffer )
+{
+    struct container *container = (struct container *)hprov;
+
+    TRACE( "%p, %u, %p\n", (void *)hprov, len, buffer );
+
+    if (container->magic != MAGIC_CONTAINER) return FALSE;
+
+    return RtlGenRandom( buffer, len );
+}
+
 static struct hash *create_hash( ALG_ID algid )
 {
     struct hash *ret;
-- 
2.28.0




More information about the wine-devel mailing list