Commit e32b29a3 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

dssenh: Implement CPDuplicateKey.

parent bf83b89d
......@@ -5,7 +5,7 @@
@ stdcall CPDestroyHash(ptr ptr)
@ stdcall CPDestroyKey(ptr ptr)
@ stdcall CPDuplicateHash(ptr ptr ptr long ptr)
@ stub CPDuplicateKey
@ stdcall CPDuplicateKey(ptr ptr ptr long ptr)
@ stub CPEncrypt
@ stdcall CPExportKey(ptr ptr ptr long long ptr ptr)
@ stdcall CPGenKey(ptr long long ptr)
......
......@@ -471,6 +471,33 @@ BOOL WINAPI CPExportKey( HCRYPTPROV hprov, HCRYPTKEY hkey, HCRYPTKEY hexpkey, DW
return FALSE;
}
static struct key *duplicate_key( const struct key *key )
{
struct key *ret;
if (!(ret = create_key( key->algid, key->flags ))) return NULL;
if (BCryptDuplicateKey( key->handle, &ret->handle, NULL, 0, 0 ))
{
heap_free( ret );
return NULL;
}
return ret;
}
BOOL WINAPI CPDuplicateKey( HCRYPTPROV hprov, HCRYPTKEY hkey, DWORD *reserved, DWORD flags, HCRYPTKEY *ret_key )
{
struct key *key = (struct key *)hkey, *ret;
TRACE( "%p, %p, %p, %08x, %p\n", (void *)hprov, (void *)hkey, reserved, flags, ret_key );
if (key->magic != MAGIC_KEY) return FALSE;
if (!(ret = duplicate_key( key ))) return FALSE;
*ret_key = (HCRYPTKEY)ret;
return TRUE;
}
static struct hash *create_hash( ALG_ID algid )
{
struct hash *ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment