Wine-devel
Threads by month
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
December 2021
- 85 participants
- 585 discussions
Doesn't regenerate ./configure.
Signed-off-by: Damjan Jovanovic <damjan.jov(a)gmail.com>
---
configure.ac | 1 +
dlls/ntdll/unix/system.c | 46 ++++++++++++++++++++++++++++++++++++++++
include/config.h.in | 3 +++
3 files changed, 50 insertions(+)
1
0
Signed-off-by: Brendan Shanks <bshanks(a)codeweavers.com>
---
include/Makefile.in | 1 +
include/processthreadsapi.h | 33 +++++++++++++++++++++++++++++++++
include/winbase.h | 1 +
3 files changed, 35 insertions(+)
create mode 100644 include/processthreadsapi.h
diff --git a/include/Makefile.in b/include/Makefile.in
index c99b0e1e1c1..de40421edcb 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -592,6 +592,7 @@ SOURCES = \
poppack.h \
powrprof.h \
prntvpt.h \
+ processthreadsapi.h \
profinfo.h \
proofofpossessioncookieinfo.idl \
propidl.idl \
diff --git a/include/processthreadsapi.h b/include/processthreadsapi.h
new file mode 100644
index 00000000000..8cdaff4796a
--- /dev/null
+++ b/include/processthreadsapi.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2021 Brendan Shanks for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _PROCESSTHREADSAPI_H
+#define _PROCESSTHREADSAPI_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WINBASEAPI HRESULT WINAPI GetThreadDescription(HANDLE,PWSTR *);
+WINBASEAPI HRESULT WINAPI SetThreadDescription(HANDLE,PCWSTR);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _PROCESSTHREADSAPI_H */
diff --git a/include/winbase.h b/include/winbase.h
index 8e8a185b4ff..2f7287f12b6 100644
--- a/include/winbase.h
+++ b/include/winbase.h
@@ -40,6 +40,7 @@ extern "C" {
#endif
#include <libloaderapi.h>
+#include <processthreadsapi.h>
#include <synchapi.h>
#include <threadpoolapiset.h>
--
2.30.1 (Apple Git-130)
1
0
[PATCH] ntdll: Support THREAD_CREATE_FLAGS_HIDE_FROM_DEBUGGER thread creation flag.
by Paul Gofman 03 Dec '21
by Paul Gofman 03 Dec '21
03 Dec '21
Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com>
---
dlls/ntdll/tests/Makefile.in | 1 +
dlls/ntdll/tests/thread.c | 126 +++++++++++++++++++++++++++++++++++
dlls/ntdll/unix/process.c | 12 +++-
dlls/ntdll/unix/thread.c | 6 +-
server/protocol.def | 2 +-
server/thread.c | 3 +-
6 files changed, 146 insertions(+), 4 deletions(-)
create mode 100644 dlls/ntdll/tests/thread.c
diff --git a/dlls/ntdll/tests/Makefile.in b/dlls/ntdll/tests/Makefile.in
index 8c6a86fb965..90deb5865f8 100644
--- a/dlls/ntdll/tests/Makefile.in
+++ b/dlls/ntdll/tests/Makefile.in
@@ -22,6 +22,7 @@ C_SRCS = \
rtlstr.c \
string.c \
sync.c \
+ thread.c \
threadpool.c \
time.c \
virtual.c \
diff --git a/dlls/ntdll/tests/thread.c b/dlls/ntdll/tests/thread.c
new file mode 100644
index 00000000000..09b9bcc8497
--- /dev/null
+++ b/dlls/ntdll/tests/thread.c
@@ -0,0 +1,126 @@
+/*
+ * Unit test suite for ntdll thread functions
+ *
+ * Copyright 2021 Paul Gofman for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ */
+
+#include "ntdll_test.h"
+
+static NTSTATUS (WINAPI *pNtCreateThreadEx)( HANDLE *, ACCESS_MASK, OBJECT_ATTRIBUTES *,
+ HANDLE, PRTL_THREAD_START_ROUTINE, void *,
+ ULONG, ULONG_PTR, SIZE_T, SIZE_T, PS_ATTRIBUTE_LIST * );
+
+static void init_function_pointers(void)
+{
+ HMODULE hntdll = GetModuleHandleA( "ntdll.dll" );
+#define GET_FUNC(name) p##name = (void *)GetProcAddress( hntdll, #name );
+ GET_FUNC( NtCreateThreadEx );
+#undef GET_FUNC
+}
+
+static void CALLBACK test_NtCreateThreadEx_proc(void *param)
+{
+}
+
+static void test_dbg_hidden_thread_creation(void)
+{
+ RTL_USER_PROCESS_PARAMETERS *params;
+ PS_CREATE_INFO create_info;
+ PS_ATTRIBUTE_LIST ps_attr;
+ WCHAR path[MAX_PATH + 4];
+ HANDLE process, thread;
+ UNICODE_STRING imageW;
+ BOOLEAN dbg_hidden;
+ NTSTATUS status;
+
+ if (!pNtCreateThreadEx)
+ {
+ win_skip( "NtCreateThreadEx is not available.\n" );
+ return;
+ }
+
+ status = pNtCreateThreadEx( &thread, THREAD_ALL_ACCESS, NULL, GetCurrentProcess(), test_NtCreateThreadEx_proc,
+ NULL, THREAD_CREATE_FLAGS_CREATE_SUSPENDED, 0, 0, 0, NULL );
+ ok( status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status );
+
+ dbg_hidden = 0xcc;
+ status = NtQueryInformationThread( thread, ThreadHideFromDebugger, &dbg_hidden, sizeof(dbg_hidden), NULL );
+ ok( status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status );
+ ok( !dbg_hidden, "Got unexpected dbg_hidden %#x.\n", dbg_hidden );
+
+ status = NtResumeThread( thread, NULL );
+ ok( status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status );
+ WaitForSingleObject( thread, INFINITE );
+ CloseHandle( thread );
+
+ status = pNtCreateThreadEx( &thread, THREAD_ALL_ACCESS, NULL, GetCurrentProcess(), test_NtCreateThreadEx_proc,
+ NULL, THREAD_CREATE_FLAGS_CREATE_SUSPENDED | THREAD_CREATE_FLAGS_HIDE_FROM_DEBUGGER,
+ 0, 0, 0, NULL );
+ ok( status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status );
+
+ dbg_hidden = 0xcc;
+ status = NtQueryInformationThread( thread, ThreadHideFromDebugger, &dbg_hidden, sizeof(dbg_hidden), NULL );
+ ok( status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status );
+ ok( dbg_hidden == 1, "Got unexpected dbg_hidden %#x.\n", dbg_hidden );
+
+ status = NtResumeThread( thread, NULL );
+ ok( status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status );
+ WaitForSingleObject( thread, INFINITE );
+ CloseHandle( thread );
+
+ lstrcpyW( path, L"\\??\\" );
+ GetModuleFileNameW( NULL, path + 4, MAX_PATH );
+
+ RtlInitUnicodeString( &imageW, path );
+
+ memset( &ps_attr, 0, sizeof(ps_attr) );
+ ps_attr.Attributes[0].Attribute = PS_ATTRIBUTE_IMAGE_NAME;
+ ps_attr.Attributes[0].Size = lstrlenW(path) * sizeof(WCHAR);
+ ps_attr.Attributes[0].ValuePtr = path;
+ ps_attr.TotalLength = sizeof(ps_attr);
+
+ status = RtlCreateProcessParametersEx( ¶ms, &imageW, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, PROCESS_PARAMS_FLAG_NORMALIZED );
+ ok( status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status );
+
+ /* NtCreateUserProcess() may return STATUS_INVALID_PARAMATER with some unitialized data in create_info. */
+ memset( &create_info, 0, sizeof(create_info) );
+ create_info.Size = sizeof(create_info);
+
+ status = NtCreateUserProcess( &process, &thread, PROCESS_ALL_ACCESS, THREAD_ALL_ACCESS,
+ NULL, NULL, 0, THREAD_CREATE_FLAGS_CREATE_SUSPENDED
+ | THREAD_CREATE_FLAGS_HIDE_FROM_DEBUGGER, params,
+ &create_info, &ps_attr );
+ ok( status == STATUS_INVALID_PARAMETER, "Got unexpected status %#x.\n", status );
+ status = NtCreateUserProcess( &process, &thread, PROCESS_ALL_ACCESS, THREAD_ALL_ACCESS,
+ NULL, NULL, 0, THREAD_CREATE_FLAGS_CREATE_SUSPENDED, params,
+ &create_info, &ps_attr );
+ ok( status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status );
+ status = NtTerminateProcess( process, 0 );
+ ok( status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status );
+ CloseHandle( process );
+ CloseHandle( thread );
+}
+
+START_TEST(thread)
+{
+ init_function_pointers();
+
+ test_dbg_hidden_thread_creation();
+}
diff --git a/dlls/ntdll/unix/process.c b/dlls/ntdll/unix/process.c
index c834ef85c79..b2457905698 100644
--- a/dlls/ntdll/unix/process.c
+++ b/dlls/ntdll/unix/process.c
@@ -705,6 +705,16 @@ NTSTATUS WINAPI NtCreateUserProcess( HANDLE *process_handle_ptr, HANDLE *thread_
data_size_t handles_size, jobs_size;
obj_handle_t *handles, *jobs;
+ if (thread_flags & THREAD_CREATE_FLAGS_HIDE_FROM_DEBUGGER)
+ {
+ WARN( "Invalid thread flags %#x.\n", thread_flags );
+
+ return STATUS_INVALID_PARAMETER;
+ }
+
+ if (thread_flags & ~THREAD_CREATE_FLAGS_CREATE_SUSPENDED)
+ FIXME( "Unsupported thread flags %#x.\n", thread_flags );
+
for (i = 0; i < attr_count; i++)
{
switch (ps_attr->Attributes[i].Attribute)
@@ -845,7 +855,7 @@ NTSTATUS WINAPI NtCreateUserProcess( HANDLE *process_handle_ptr, HANDLE *thread_
{
req->process = wine_server_obj_handle( process_handle );
req->access = thread_access;
- req->suspend = !!(thread_flags & THREAD_CREATE_FLAGS_CREATE_SUSPENDED);
+ req->flags = thread_flags;
req->request_fd = -1;
wine_server_add_data( req, objattr, attr_len );
if (!(status = wine_server_call( req )))
diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c
index 455272e07e0..00fe2b6fa1b 100644
--- a/dlls/ntdll/unix/thread.c
+++ b/dlls/ntdll/unix/thread.c
@@ -1243,6 +1243,7 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle, ACCESS_MASK access, OBJECT_ATT
ULONG flags, ULONG_PTR zero_bits, SIZE_T stack_commit,
SIZE_T stack_reserve, PS_ATTRIBUTE_LIST *attr_list )
{
+ static const ULONG supported_flags = THREAD_CREATE_FLAGS_CREATE_SUSPENDED | THREAD_CREATE_FLAGS_HIDE_FROM_DEBUGGER;
sigset_t sigset;
pthread_t pthread_id;
pthread_attr_t pthread_attr;
@@ -1254,6 +1255,9 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle, ACCESS_MASK access, OBJECT_ATT
TEB *teb;
NTSTATUS status;
+ if (flags & ~supported_flags)
+ FIXME( "Unsupported flags %#x.\n", flags );
+
if (zero_bits > 21 && zero_bits < 32) return STATUS_INVALID_PARAMETER_3;
#ifndef _WIN64
if (!is_wow64 && zero_bits >= 32) return STATUS_INVALID_PARAMETER_3;
@@ -1303,7 +1307,7 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle, ACCESS_MASK access, OBJECT_ATT
{
req->process = wine_server_obj_handle( process );
req->access = access;
- req->suspend = flags & THREAD_CREATE_FLAGS_CREATE_SUSPENDED;
+ req->flags = flags;
req->request_fd = request_pipe[0];
wine_server_add_data( req, objattr, len );
if (!(status = wine_server_call( req )))
diff --git a/server/protocol.def b/server/protocol.def
index c83e6a2ef7c..15bda74def1 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -871,7 +871,7 @@ typedef struct
@REQ(new_thread)
obj_handle_t process; /* process in which to create thread */
unsigned int access; /* wanted access rights */
- int suspend; /* new thread should be suspended on creation */
+ int flags; /* thread creation flags */
int request_fd; /* fd for request pipe */
VARARG(objattr,object_attributes); /* object attributes */
@REPLY
diff --git a/server/thread.c b/server/thread.c
index 55eb8513af8..e9240a05659 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -1355,7 +1355,8 @@ DECL_HANDLER(new_thread)
if ((thread = create_thread( request_fd, process, sd )))
{
thread->system_regs = current->system_regs;
- if (req->suspend) thread->suspend++;
+ if (req->flags & THREAD_CREATE_FLAGS_CREATE_SUSPENDED) thread->suspend++;
+ thread->dbg_hidden = !!(req->flags & THREAD_CREATE_FLAGS_HIDE_FROM_DEBUGGER);
reply->tid = get_thread_id( thread );
if ((reply->handle = alloc_handle_no_access_check( current->process, thread,
req->access, objattr->attributes )))
--
2.33.1
2
1
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/bcrypt/bcrypt_main.c | 90 +++++++++++++++++++--------------------
1 file changed, 44 insertions(+), 46 deletions(-)
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
index a1c6ef2c66c..6319a26dd4d 100644
--- a/dlls/bcrypt/bcrypt_main.c
+++ b/dlls/bcrypt/bcrypt_main.c
@@ -18,6 +18,7 @@
*/
#include <stdarg.h>
+#include <stdlib.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
@@ -28,10 +29,8 @@
#include "winternl.h"
#include "bcrypt.h"
-#include "bcrypt_internal.h"
-
#include "wine/debug.h"
-#include "wine/heap.h"
+#include "bcrypt_internal.h"
WINE_DEFAULT_DEBUG_CHANNEL(bcrypt);
@@ -156,7 +155,7 @@ NTSTATUS WINAPI BCryptEnumAlgorithms( ULONG type, ULONG *ret_count, BCRYPT_ALGOR
if (match_operation_type( type, builtin_algorithms[i].class )) count++;
}
- if (!(list = heap_alloc( count * sizeof(*list) ))) return STATUS_NO_MEMORY;
+ if (!(list = malloc( count * sizeof(*list) ))) return STATUS_NO_MEMORY;
for (i = 0; i < ARRAY_SIZE( builtin_algorithms ); i++)
{
@@ -248,7 +247,7 @@ NTSTATUS WINAPI BCryptOpenAlgorithmProvider( BCRYPT_ALG_HANDLE *handle, LPCWSTR
return STATUS_NOT_IMPLEMENTED;
}
- if (!(alg = heap_alloc( sizeof(*alg) ))) return STATUS_NO_MEMORY;
+ if (!(alg = malloc( sizeof(*alg) ))) return STATUS_NO_MEMORY;
alg->hdr.magic = MAGIC_ALG;
alg->id = alg_id;
alg->mode = MODE_ID_CBC;
@@ -266,7 +265,7 @@ NTSTATUS WINAPI BCryptCloseAlgorithmProvider( BCRYPT_ALG_HANDLE handle, DWORD fl
if (!alg || alg->hdr.magic != MAGIC_ALG) return STATUS_INVALID_HANDLE;
alg->hdr.magic = 0;
- heap_free( alg );
+ free( alg );
return STATUS_SUCCESS;
}
@@ -797,16 +796,16 @@ static NTSTATUS hash_create( const struct algorithm *alg, UCHAR *secret, ULONG s
struct hash *hash;
NTSTATUS status;
- if (!(hash = heap_alloc_zero( sizeof(*hash) ))) return STATUS_NO_MEMORY;
+ if (!(hash = calloc( 1, sizeof(*hash) ))) return STATUS_NO_MEMORY;
hash->hdr.magic = MAGIC_HASH;
hash->alg_id = alg->id;
if (alg->flags & BCRYPT_ALG_HANDLE_HMAC_FLAG) hash->flags = HASH_FLAG_HMAC;
if ((alg->flags & BCRYPT_HASH_REUSABLE_FLAG) || (flags & BCRYPT_HASH_REUSABLE_FLAG))
hash->flags |= HASH_FLAG_REUSABLE;
- if (secret_len && !(hash->secret = heap_alloc( secret_len )))
+ if (secret_len && !(hash->secret = malloc( secret_len )))
{
- heap_free( hash );
+ free( hash );
return STATUS_NO_MEMORY;
}
memcpy( hash->secret, secret, secret_len );
@@ -814,8 +813,8 @@ static NTSTATUS hash_create( const struct algorithm *alg, UCHAR *secret, ULONG s
if ((status = hash_prepare( hash )))
{
- heap_free( hash->secret );
- heap_free( hash );
+ free( hash->secret );
+ free( hash );
return status;
}
@@ -858,13 +857,12 @@ NTSTATUS WINAPI BCryptDuplicateHash( BCRYPT_HASH_HANDLE handle, BCRYPT_HASH_HAND
if (!handle_copy) return STATUS_INVALID_PARAMETER;
if (object) FIXME( "ignoring object buffer\n" );
- if (!(hash_copy = heap_alloc( sizeof(*hash_copy) )))
- return STATUS_NO_MEMORY;
+ if (!(hash_copy = malloc( sizeof(*hash_copy) ))) return STATUS_NO_MEMORY;
memcpy( hash_copy, hash_orig, sizeof(*hash_orig) );
- if (hash_orig->secret && !(hash_copy->secret = heap_alloc( hash_orig->secret_len )))
+ if (hash_orig->secret && !(hash_copy->secret = malloc( hash_orig->secret_len )))
{
- heap_free( hash_copy );
+ free( hash_copy );
return STATUS_NO_MEMORY;
}
memcpy( hash_copy->secret, hash_orig->secret, hash_orig->secret_len );
@@ -877,8 +875,8 @@ static void hash_destroy( struct hash *hash )
{
if (!hash) return;
hash->hdr.magic = 0;
- heap_free( hash->secret );
- heap_free( hash );
+ free( hash->secret );
+ free( hash );
}
NTSTATUS WINAPI BCryptDestroyHash( BCRYPT_HASH_HANDLE handle )
@@ -971,15 +969,15 @@ static NTSTATUS key_asymmetric_create( struct key **ret_key, struct algorithm *a
return STATUS_NOT_IMPLEMENTED;
}
- if (!(key = heap_alloc_zero( sizeof(*key) ))) return STATUS_NO_MEMORY;
+ if (!(key = calloc( 1, sizeof(*key) ))) return STATUS_NO_MEMORY;
key->hdr.magic = MAGIC_KEY;
key->alg_id = alg->id;
key->u.a.bitlen = bitlen;
key->u.a.pubkey_len = pubkey_len;
- if (!(key->u.a.pubkey = heap_alloc( pubkey_len )))
+ if (!(key->u.a.pubkey = malloc( pubkey_len )))
{
- heap_free( key );
+ free( key );
return STATUS_NO_MEMORY;
}
if (pubkey) memcpy( key->u.a.pubkey, pubkey, pubkey_len );
@@ -1013,12 +1011,12 @@ static NTSTATUS key_symmetric_set_vector( struct key *key, UCHAR *vector, ULONG
BOOL needs_reset = (!is_zero_vector( vector, vector_len ) ||
!is_equal_vector( key->u.s.vector, key->u.s.vector_len, vector, vector_len ));
- heap_free( key->u.s.vector );
+ free( key->u.s.vector );
key->u.s.vector = NULL;
key->u.s.vector_len = 0;
if (vector)
{
- if (!(key->u.s.vector = heap_alloc( vector_len ))) return STATUS_NO_MEMORY;
+ if (!(key->u.s.vector = malloc( vector_len ))) return STATUS_NO_MEMORY;
memcpy( key->u.s.vector, vector, vector_len );
key->u.s.vector_len = vector_len;
}
@@ -1208,12 +1206,12 @@ static NTSTATUS key_symmetric_encrypt( struct key *key, UCHAR *input, ULONG inp
if (flags & BCRYPT_BLOCK_PADDING)
{
- if (!(buf = heap_alloc( key->u.s.block_size ))) return STATUS_NO_MEMORY;
+ if (!(buf = malloc( key->u.s.block_size ))) return STATUS_NO_MEMORY;
memcpy( buf, encrypt_params.input, bytes_left );
memset( buf + bytes_left, key->u.s.block_size - bytes_left, key->u.s.block_size - bytes_left );
encrypt_params.input = buf;
status = UNIX_CALL( key_symmetric_encrypt, &encrypt_params );
- heap_free( buf );
+ free( buf );
}
return status;
@@ -1300,7 +1298,7 @@ static NTSTATUS key_symmetric_decrypt( struct key *key, UCHAR *input, ULONG inpu
if (flags & BCRYPT_BLOCK_PADDING)
{
UCHAR *buf, *dst = decrypt_params.output;
- if (!(buf = heap_alloc( key->u.s.block_size ))) return STATUS_NO_MEMORY;
+ if (!(buf = malloc( key->u.s.block_size ))) return STATUS_NO_MEMORY;
decrypt_params.output = buf;
status = UNIX_CALL( key_symmetric_decrypt, &decrypt_params );
if (!status && buf[ key->u.s.block_size - 1 ] <= key->u.s.block_size)
@@ -1310,7 +1308,7 @@ static NTSTATUS key_symmetric_decrypt( struct key *key, UCHAR *input, ULONG inpu
else memcpy( dst, buf, key->u.s.block_size - buf[ key->u.s.block_size - 1 ] );
}
else status = STATUS_UNSUCCESSFUL; /* FIXME: invalid padding */
- heap_free( buf );
+ free( buf );
}
return status;
@@ -1567,16 +1565,16 @@ NTSTATUS WINAPI BCryptGenerateSymmetricKey( BCRYPT_ALG_HANDLE algorithm, BCRYPT_
}
}
- if (!(key = heap_alloc_zero( sizeof(*key) ))) return STATUS_NO_MEMORY;
+ if (!(key = calloc( 1, sizeof(*key) ))) return STATUS_NO_MEMORY;
InitializeCriticalSection( &key->u.s.cs );
key->hdr.magic = MAGIC_KEY;
key->alg_id = alg->id;
key->u.s.mode = alg->mode;
key->u.s.block_size = block_size;
- if (!(key->u.s.secret = heap_alloc( secret_len )))
+ if (!(key->u.s.secret = malloc( secret_len )))
{
- heap_free( key );
+ free( key );
return STATUS_NO_MEMORY;
}
memcpy( key->u.s.secret, secret, secret_len );
@@ -1685,7 +1683,7 @@ static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy )
if (key_is_symmetric( key_orig ))
{
- if (!(buffer = heap_alloc( key_orig->u.s.secret_len ))) return STATUS_NO_MEMORY;
+ if (!(buffer = malloc( key_orig->u.s.secret_len ))) return STATUS_NO_MEMORY;
memcpy( buffer, key_orig->u.s.secret, key_orig->u.s.secret_len );
key_copy->u.s.mode = key_orig->u.s.mode;
@@ -1698,7 +1696,7 @@ static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy )
{
struct key_asymmetric_duplicate_params params;
- if (!(buffer = heap_alloc( key_orig->u.a.pubkey_len ))) return STATUS_NO_MEMORY;
+ if (!(buffer = malloc( key_orig->u.a.pubkey_len ))) return STATUS_NO_MEMORY;
memcpy( buffer, key_orig->u.a.pubkey, key_orig->u.a.pubkey_len );
key_copy->u.a.bitlen = key_orig->u.a.bitlen;
@@ -1720,17 +1718,17 @@ static void key_destroy( struct key *key )
if (key_is_symmetric( key ))
{
UNIX_CALL( key_symmetric_destroy, key );
- heap_free( key->u.s.vector );
- heap_free( key->u.s.secret );
+ free( key->u.s.vector );
+ free( key->u.s.secret );
DeleteCriticalSection( &key->u.s.cs );
}
else
{
UNIX_CALL( key_asymmetric_destroy, key );
- heap_free( key->u.a.pubkey );
+ free( key->u.a.pubkey );
}
key->hdr.magic = 0;
- heap_free( key );
+ free( key );
}
NTSTATUS WINAPI BCryptDuplicateKey( BCRYPT_KEY_HANDLE handle, BCRYPT_KEY_HANDLE *handle_copy,
@@ -1745,7 +1743,7 @@ NTSTATUS WINAPI BCryptDuplicateKey( BCRYPT_KEY_HANDLE handle, BCRYPT_KEY_HANDLE
if (!key_orig || key_orig->hdr.magic != MAGIC_KEY) return STATUS_INVALID_HANDLE;
if (!handle_copy) return STATUS_INVALID_PARAMETER;
- if (!(key_copy = heap_alloc( sizeof(*key_copy) ))) return STATUS_NO_MEMORY;
+ if (!(key_copy = malloc( sizeof(*key_copy) ))) return STATUS_NO_MEMORY;
if ((status = key_duplicate( key_orig, key_copy )))
{
@@ -1978,7 +1976,7 @@ static NTSTATUS pbkdf2( struct hash *hash, UCHAR *pwd, ULONG pwd_len, UCHAR *sal
UCHAR bytes[4], *buf;
ULONG j, k;
- if (!(buf = heap_alloc( hash_len ))) return STATUS_NO_MEMORY;
+ if (!(buf = malloc( hash_len ))) return STATUS_NO_MEMORY;
for (j = 0; j < iterations; j++)
{
@@ -1987,7 +1985,7 @@ static NTSTATUS pbkdf2( struct hash *hash, UCHAR *pwd, ULONG pwd_len, UCHAR *sal
/* use salt || INT(i) */
if ((status = hash_update( &hash->inner, hash->alg_id, salt, salt_len )))
{
- heap_free( buf );
+ free( buf );
return status;
}
bytes[0] = (i >> 24) & 0xff;
@@ -2000,13 +1998,13 @@ static NTSTATUS pbkdf2( struct hash *hash, UCHAR *pwd, ULONG pwd_len, UCHAR *sal
if (status)
{
- heap_free( buf );
+ free( buf );
return status;
}
if ((status = hash_finalize( hash, buf, hash_len )))
{
- heap_free( buf );
+ free( buf );
return status;
}
@@ -2014,7 +2012,7 @@ static NTSTATUS pbkdf2( struct hash *hash, UCHAR *pwd, ULONG pwd_len, UCHAR *sal
else for (k = 0; k < hash_len; k++) dst[k] ^= buf[k];
}
- heap_free( buf );
+ free( buf );
return status;
}
@@ -2051,7 +2049,7 @@ NTSTATUS WINAPI BCryptDeriveKeyPBKDF2( BCRYPT_ALG_HANDLE handle, UCHAR *pwd, ULO
}
/* final partial block */
- if (!(partial = heap_alloc( hash_len )))
+ if (!(partial = malloc( hash_len )))
{
hash_destroy( hash );
return STATUS_NO_MEMORY;
@@ -2060,13 +2058,13 @@ NTSTATUS WINAPI BCryptDeriveKeyPBKDF2( BCRYPT_ALG_HANDLE handle, UCHAR *pwd, ULO
if ((status = pbkdf2( hash, pwd, pwd_len, salt, salt_len, iterations, block_count, partial, hash_len )))
{
hash_destroy( hash );
- heap_free( partial );
+ free( partial );
return status;
}
memcpy( dk + ((block_count - 1) * hash_len), partial, bytes_left );
hash_destroy( hash );
- heap_free( partial );
+ free( partial );
return STATUS_SUCCESS;
}
@@ -2082,7 +2080,7 @@ NTSTATUS WINAPI BCryptSecretAgreement(BCRYPT_KEY_HANDLE privatekey, BCRYPT_KEY_H
if (!pubkey || pubkey->hdr.magic != MAGIC_KEY) return STATUS_INVALID_HANDLE;
if (!handle) return STATUS_INVALID_PARAMETER;
- if (!(secret = heap_alloc_zero( sizeof(*secret) ))) return STATUS_NO_MEMORY;
+ if (!(secret = calloc( 1, sizeof(*secret) ))) return STATUS_NO_MEMORY;
secret->hdr.magic = MAGIC_SECRET;
*handle = secret;
@@ -2097,7 +2095,7 @@ NTSTATUS WINAPI BCryptDestroySecret(BCRYPT_SECRET_HANDLE handle)
if (!secret || secret->hdr.magic != MAGIC_SECRET) return STATUS_INVALID_HANDLE;
secret->hdr.magic = 0;
- heap_free( secret );
+ free( secret );
return STATUS_SUCCESS;
}
--
2.30.2
2
1
[PATCH 3/4] bcrypt/tests: Link directly to functions available since Windows 7.
by Hans Leidekker 03 Dec '21
by Hans Leidekker 03 Dec '21
03 Dec '21
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/bcrypt/tests/bcrypt.c | 886 +++++++++++++++++--------------------
1 file changed, 405 insertions(+), 481 deletions(-)
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
index a688d43657b..3b32ea0349b 100644
--- a/dlls/bcrypt/tests/bcrypt.c
+++ b/dlls/bcrypt/tests/bcrypt.c
@@ -27,72 +27,34 @@
#include "wine/test.h"
-static NTSTATUS (WINAPI *pBCryptCloseAlgorithmProvider)(BCRYPT_ALG_HANDLE, ULONG);
-static NTSTATUS (WINAPI *pBCryptCreateHash)(BCRYPT_ALG_HANDLE, BCRYPT_HASH_HANDLE *, PUCHAR, ULONG, PUCHAR,
- ULONG, ULONG);
-static NTSTATUS (WINAPI *pBCryptDecrypt)(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR, ULONG, PUCHAR, ULONG,
- ULONG *, ULONG);
-static NTSTATUS (WINAPI *pBCryptDeriveKeyCapi)(BCRYPT_HASH_HANDLE, BCRYPT_ALG_HANDLE, UCHAR *, ULONG, ULONG);
-static NTSTATUS (WINAPI *pBCryptDeriveKeyPBKDF2)(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, PUCHAR, ULONG, ULONGLONG,
- PUCHAR, ULONG, ULONG);
-static NTSTATUS (WINAPI *pBCryptDestroyHash)(BCRYPT_HASH_HANDLE);
-static NTSTATUS (WINAPI *pBCryptDestroyKey)(BCRYPT_KEY_HANDLE);
-static NTSTATUS (WINAPI *pBCryptDuplicateHash)(BCRYPT_HASH_HANDLE, BCRYPT_HASH_HANDLE *, UCHAR *, ULONG, ULONG);
-static NTSTATUS (WINAPI *pBCryptDuplicateKey)(BCRYPT_KEY_HANDLE, BCRYPT_KEY_HANDLE *, UCHAR *, ULONG, ULONG);
-static NTSTATUS (WINAPI *pBCryptEncrypt)(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR, ULONG, PUCHAR, ULONG,
- ULONG *, ULONG);
-static NTSTATUS (WINAPI *pBCryptEnumAlgorithms)(ULONG, ULONG *, BCRYPT_ALGORITHM_IDENTIFIER **, ULONG);
-static NTSTATUS (WINAPI *pBCryptEnumContextFunctions)(ULONG, const WCHAR *, ULONG, ULONG *, CRYPT_CONTEXT_FUNCTIONS **);
-static NTSTATUS (WINAPI *pBCryptExportKey)(BCRYPT_KEY_HANDLE, BCRYPT_KEY_HANDLE, LPCWSTR, PUCHAR, ULONG, ULONG *, ULONG);
-static NTSTATUS (WINAPI *pBCryptFinalizeKeyPair)(BCRYPT_KEY_HANDLE, ULONG);
-static NTSTATUS (WINAPI *pBCryptFinishHash)(BCRYPT_HASH_HANDLE, PUCHAR, ULONG, ULONG);
-static void (WINAPI *pBCryptFreeBuffer)(void *);
-static NTSTATUS (WINAPI *pBCryptGenerateKeyPair)(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE *, ULONG, ULONG);
-static NTSTATUS (WINAPI *pBCryptGenerateSymmetricKey)(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE *, PUCHAR, ULONG,
- PUCHAR, ULONG, ULONG);
-static NTSTATUS (WINAPI *pBCryptGetFipsAlgorithmMode)(BOOLEAN *);
-static NTSTATUS (WINAPI *pBCryptGetProperty)(BCRYPT_HANDLE, LPCWSTR, PUCHAR, ULONG, ULONG *, ULONG);
-static NTSTATUS (WINAPI *pBCryptGenRandom)(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, ULONG);
static NTSTATUS (WINAPI *pBCryptHash)(BCRYPT_ALG_HANDLE, UCHAR *, ULONG, UCHAR *, ULONG, UCHAR *, ULONG);
-static NTSTATUS (WINAPI *pBCryptHashData)(BCRYPT_HASH_HANDLE, PUCHAR, ULONG, ULONG);
-static NTSTATUS (WINAPI *pBCryptImportKey)(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE, LPCWSTR, BCRYPT_KEY_HANDLE *,
- PUCHAR, ULONG, PUCHAR, ULONG, ULONG);
-static NTSTATUS (WINAPI *pBCryptImportKeyPair)(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE, LPCWSTR, BCRYPT_KEY_HANDLE *,
- UCHAR *, ULONG, ULONG);
-static NTSTATUS (WINAPI *pBCryptOpenAlgorithmProvider)(BCRYPT_ALG_HANDLE *, LPCWSTR, LPCWSTR, ULONG);
-static NTSTATUS (WINAPI *pBCryptSetProperty)(BCRYPT_HANDLE, LPCWSTR, PUCHAR, ULONG, ULONG);
-static NTSTATUS (WINAPI *pBCryptSignHash)(BCRYPT_KEY_HANDLE, void *, UCHAR *, ULONG, UCHAR *, ULONG, ULONG *, ULONG);
-static NTSTATUS (WINAPI *pBCryptVerifySignature)(BCRYPT_KEY_HANDLE, VOID *, UCHAR *, ULONG, UCHAR *, ULONG, ULONG);
-static NTSTATUS (WINAPI *pBCryptSecretAgreement)(BCRYPT_KEY_HANDLE, BCRYPT_KEY_HANDLE, BCRYPT_SECRET_HANDLE *, ULONG);
-static NTSTATUS (WINAPI *pBCryptDestroySecret)(BCRYPT_SECRET_HANDLE);
-static NTSTATUS (WINAPI *pBCryptDeriveKey)(BCRYPT_SECRET_HANDLE, LPCWSTR, BCryptBufferDesc *, PUCHAR, ULONG, ULONG *, ULONG);
static void test_BCryptGenRandom(void)
{
NTSTATUS ret;
UCHAR buffer[256];
- ret = pBCryptGenRandom(NULL, NULL, 0, 0);
+ ret = BCryptGenRandom(NULL, NULL, 0, 0);
ok(ret == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got 0x%x\n", ret);
- ret = pBCryptGenRandom(NULL, buffer, 0, 0);
+ ret = BCryptGenRandom(NULL, buffer, 0, 0);
ok(ret == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got 0x%x\n", ret);
- ret = pBCryptGenRandom(NULL, buffer, sizeof(buffer), 0);
+ ret = BCryptGenRandom(NULL, buffer, sizeof(buffer), 0);
ok(ret == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got 0x%x\n", ret);
- ret = pBCryptGenRandom(NULL, buffer, sizeof(buffer), BCRYPT_USE_SYSTEM_PREFERRED_RNG);
+ ret = BCryptGenRandom(NULL, buffer, sizeof(buffer), BCRYPT_USE_SYSTEM_PREFERRED_RNG);
ok(ret == STATUS_SUCCESS, "Expected success, got 0x%x\n", ret);
- ret = pBCryptGenRandom(NULL, buffer, sizeof(buffer),
+ ret = BCryptGenRandom(NULL, buffer, sizeof(buffer),
BCRYPT_USE_SYSTEM_PREFERRED_RNG|BCRYPT_RNG_USE_ENTROPY_IN_BUFFER);
ok(ret == STATUS_SUCCESS, "Expected success, got 0x%x\n", ret);
- ret = pBCryptGenRandom(NULL, NULL, sizeof(buffer), BCRYPT_USE_SYSTEM_PREFERRED_RNG);
+ ret = BCryptGenRandom(NULL, NULL, sizeof(buffer), BCRYPT_USE_SYSTEM_PREFERRED_RNG);
ok(ret == STATUS_INVALID_PARAMETER, "Expected STATUS_INVALID_PARAMETER, got 0x%x\n", ret);
/* Zero sized buffer should work too */
- ret = pBCryptGenRandom(NULL, buffer, 0, BCRYPT_USE_SYSTEM_PREFERRED_RNG);
+ ret = BCryptGenRandom(NULL, buffer, 0, BCRYPT_USE_SYSTEM_PREFERRED_RNG);
ok(ret == STATUS_SUCCESS, "Expected success, got 0x%x\n", ret);
/* Test random number generation - It's impossible for a sane RNG to return 8 zeros */
memset(buffer, 0, 16);
- ret = pBCryptGenRandom(NULL, buffer, 8, BCRYPT_USE_SYSTEM_PREFERRED_RNG);
+ ret = BCryptGenRandom(NULL, buffer, 8, BCRYPT_USE_SYSTEM_PREFERRED_RNG);
ok(ret == STATUS_SUCCESS, "Expected success, got 0x%x\n", ret);
ok(memcmp(buffer, buffer + 8, 8), "Expected a random number, got 0\n");
}
@@ -124,11 +86,11 @@ todo_wine
}
RegCloseKey(hkey);
- ret = pBCryptGetFipsAlgorithmMode(&enabled);
+ ret = BCryptGetFipsAlgorithmMode(&enabled);
ok(ret == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got 0x%x\n", ret);
ok(enabled == expected, "expected result %d, got %d\n", expected, enabled);
- ret = pBCryptGetFipsAlgorithmMode(NULL);
+ ret = BCryptGetFipsAlgorithmMode(NULL);
ok(ret == STATUS_INVALID_PARAMETER, "Expected STATUS_INVALID_PARAMETER, got 0x%x\n", ret);
}
@@ -150,30 +112,30 @@ static void _test_object_length(unsigned line, void *handle)
ULONG len, size;
len = size = 0xdeadbeef;
- status = pBCryptGetProperty(NULL, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
+ status = BCryptGetProperty(NULL, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
ok_(__FILE__,line)(status == STATUS_INVALID_HANDLE, "BCryptGetProperty failed: %08x\n", status);
len = size = 0xdeadbeef;
- status = pBCryptGetProperty(handle, NULL, (UCHAR *)&len, sizeof(len), &size, 0);
+ status = BCryptGetProperty(handle, NULL, (UCHAR *)&len, sizeof(len), &size, 0);
ok_(__FILE__,line)(status == STATUS_INVALID_PARAMETER, "BCryptGetProperty failed: %08x\n", status);
len = size = 0xdeadbeef;
- status = pBCryptGetProperty(handle, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), NULL, 0);
+ status = BCryptGetProperty(handle, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), NULL, 0);
ok_(__FILE__,line)(status == STATUS_INVALID_PARAMETER, "BCryptGetProperty failed: %08x\n", status);
len = size = 0xdeadbeef;
- status = pBCryptGetProperty(handle, BCRYPT_OBJECT_LENGTH, NULL, sizeof(len), &size, 0);
+ status = BCryptGetProperty(handle, BCRYPT_OBJECT_LENGTH, NULL, sizeof(len), &size, 0);
ok_(__FILE__,line)(status == STATUS_SUCCESS, "BCryptGetProperty failed: %08x\n", status);
ok_(__FILE__,line)(size == sizeof(len), "got %u\n", size);
len = size = 0xdeadbeef;
- status = pBCryptGetProperty(handle, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, 0, &size, 0);
+ status = BCryptGetProperty(handle, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, 0, &size, 0);
ok_(__FILE__,line)(status == STATUS_BUFFER_TOO_SMALL, "BCryptGetProperty failed: %08x\n", status);
ok_(__FILE__,line)(len == 0xdeadbeef, "got %u\n", len);
ok_(__FILE__,line)(size == sizeof(len), "got %u\n", size);
len = size = 0xdeadbeef;
- status = pBCryptGetProperty(handle, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
+ status = BCryptGetProperty(handle, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
ok_(__FILE__,line)(status == STATUS_SUCCESS, "BCryptGetProperty failed: %08x\n", status);
ok_(__FILE__,line)(len != 0xdeadbeef, "len not set\n");
ok_(__FILE__,line)(size == sizeof(len), "got %u\n", size);
@@ -185,7 +147,7 @@ static void _test_hash_length(unsigned line, void *handle, ULONG exlen)
ULONG len = 0xdeadbeef, size = 0xdeadbeef;
NTSTATUS status;
- status = pBCryptGetProperty(handle, BCRYPT_HASH_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
+ status = BCryptGetProperty(handle, BCRYPT_HASH_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
ok_(__FILE__,line)(status == STATUS_SUCCESS, "BCryptGetProperty failed: %08x\n", status);
ok_(__FILE__,line)(size == sizeof(len), "got %u\n", size);
ok_(__FILE__,line)(len == exlen, "len = %u, expected %u\n", len, exlen);
@@ -199,7 +161,7 @@ static void _test_alg_name(unsigned line, void *handle, const WCHAR *exname)
const WCHAR *name = (const WCHAR*)buf;
NTSTATUS status;
- status = pBCryptGetProperty(handle, BCRYPT_ALGORITHM_NAME, buf, sizeof(buf), &size, 0);
+ status = BCryptGetProperty(handle, BCRYPT_ALGORITHM_NAME, buf, sizeof(buf), &size, 0);
ok_(__FILE__,line)(status == STATUS_SUCCESS, "BCryptGetProperty failed: %08x\n", status);
ok_(__FILE__,line)(size == (lstrlenW(exname)+1)*sizeof(WCHAR), "got %u\n", size);
ok_(__FILE__,line)(!lstrcmpW(name, exname), "alg name = %s, expected %s\n", wine_dbgstr_w(name),
@@ -226,7 +188,7 @@ static void test_hash(const struct hash_test *test)
ULONG len;
alg = NULL;
- ret = pBCryptOpenAlgorithmProvider(&alg, test->alg, MS_PRIMITIVE_PROVIDER, 0);
+ ret = BCryptOpenAlgorithmProvider(&alg, test->alg, MS_PRIMITIVE_PROVIDER, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(alg != NULL, "alg not set\n");
@@ -236,122 +198,122 @@ static void test_hash(const struct hash_test *test)
hash = NULL;
len = sizeof(buf);
- ret = pBCryptCreateHash(alg, &hash, buf, len, NULL, 0, 0);
+ ret = BCryptCreateHash(alg, &hash, buf, len, NULL, 0, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(hash != NULL, "hash not set\n");
- ret = pBCryptHashData(hash, NULL, 0, 0);
+ ret = BCryptHashData(hash, NULL, 0, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
- ret = pBCryptHashData(hash, (UCHAR *)"test", sizeof("test"), 0);
+ ret = BCryptHashData(hash, (UCHAR *)"test", sizeof("test"), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
test_hash_length(hash, test->hash_size);
test_alg_name(hash, test->alg);
memset(hash_buf, 0, sizeof(hash_buf));
- ret = pBCryptFinishHash(hash, hash_buf, test->hash_size, 0);
+ ret = BCryptFinishHash(hash, hash_buf, test->hash_size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
format_hash( hash_buf, test->hash_size, str );
ok(!strcmp(str, test->hash), "got %s\n", str);
- ret = pBCryptDestroyHash(hash);
+ ret = BCryptDestroyHash(hash);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
hash = NULL;
len = sizeof(buf);
- ret = pBCryptCreateHash(alg, &hash, buf, len, NULL, 0, BCRYPT_HASH_REUSABLE_FLAG);
+ ret = BCryptCreateHash(alg, &hash, buf, len, NULL, 0, BCRYPT_HASH_REUSABLE_FLAG);
ok(ret == STATUS_SUCCESS || broken(ret == STATUS_INVALID_PARAMETER) /* < win8 */, "got %08x\n", ret);
if (ret == STATUS_SUCCESS)
{
- ret = pBCryptHashData(hash, (UCHAR *)"test", sizeof("test"), 0);
+ ret = BCryptHashData(hash, (UCHAR *)"test", sizeof("test"), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
memset(hash_buf, 0, sizeof(hash_buf));
- ret = pBCryptFinishHash(hash, hash_buf, test->hash_size, 0);
+ ret = BCryptFinishHash(hash, hash_buf, test->hash_size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
format_hash( hash_buf, test->hash_size, str );
ok(!strcmp(str, test->hash), "got %s\n", str);
/* reuse it */
- ret = pBCryptHashData(hash, (UCHAR *)"tset", sizeof("tset"), 0);
+ ret = BCryptHashData(hash, (UCHAR *)"tset", sizeof("tset"), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
memset(hash_buf, 0, sizeof(hash_buf));
- ret = pBCryptFinishHash(hash, hash_buf, test->hash_size, 0);
+ ret = BCryptFinishHash(hash, hash_buf, test->hash_size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
format_hash( hash_buf, test->hash_size, str );
ok(!strcmp(str, test->hash2), "got %s\n", str);
- ret = pBCryptDestroyHash(hash);
+ ret = BCryptDestroyHash(hash);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
}
- ret = pBCryptCloseAlgorithmProvider(alg, 0);
+ ret = BCryptCloseAlgorithmProvider(alg, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
alg = NULL;
- ret = pBCryptOpenAlgorithmProvider(&alg, test->alg, MS_PRIMITIVE_PROVIDER, BCRYPT_ALG_HANDLE_HMAC_FLAG);
+ ret = BCryptOpenAlgorithmProvider(&alg, test->alg, MS_PRIMITIVE_PROVIDER, BCRYPT_ALG_HANDLE_HMAC_FLAG);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(alg != NULL, "alg not set\n");
hash = NULL;
len = sizeof(buf_hmac);
- ret = pBCryptCreateHash(alg, &hash, buf_hmac, len, (UCHAR *)"key", sizeof("key"), 0);
+ ret = BCryptCreateHash(alg, &hash, buf_hmac, len, (UCHAR *)"key", sizeof("key"), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(hash != NULL, "hash not set\n");
- ret = pBCryptHashData(hash, (UCHAR *)"test", sizeof("test"), 0);
+ ret = BCryptHashData(hash, (UCHAR *)"test", sizeof("test"), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
test_hash_length(hash, test->hash_size);
test_alg_name(hash, test->alg);
memset(hmac_hash, 0, sizeof(hmac_hash));
- ret = pBCryptFinishHash(hash, hmac_hash, test->hash_size, 0);
+ ret = BCryptFinishHash(hash, hmac_hash, test->hash_size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
format_hash( hmac_hash, test->hash_size, str );
ok(!strcmp(str, test->hmac_hash), "got %s\n", str);
- ret = pBCryptDestroyHash(hash);
+ ret = BCryptDestroyHash(hash);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
hash = NULL;
len = sizeof(buf_hmac);
- ret = pBCryptCreateHash(alg, &hash, buf_hmac, len, (UCHAR *)"key", sizeof("key"), BCRYPT_HASH_REUSABLE_FLAG);
+ ret = BCryptCreateHash(alg, &hash, buf_hmac, len, (UCHAR *)"key", sizeof("key"), BCRYPT_HASH_REUSABLE_FLAG);
ok(ret == STATUS_SUCCESS || broken(ret == STATUS_INVALID_PARAMETER) /* < win8 */, "got %08x\n", ret);
if (ret == STATUS_SUCCESS)
{
- ret = pBCryptHashData(hash, (UCHAR *)"test", sizeof("test"), 0);
+ ret = BCryptHashData(hash, (UCHAR *)"test", sizeof("test"), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
memset(hmac_hash, 0, sizeof(hmac_hash));
- ret = pBCryptFinishHash(hash, hmac_hash, test->hash_size, 0);
+ ret = BCryptFinishHash(hash, hmac_hash, test->hash_size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
format_hash( hmac_hash, test->hash_size, str );
ok(!strcmp(str, test->hmac_hash), "got %s\n", str);
/* reuse it */
- ret = pBCryptHashData(hash, (UCHAR *)"tset", sizeof("tset"), 0);
+ ret = BCryptHashData(hash, (UCHAR *)"tset", sizeof("tset"), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
memset(hmac_hash, 0, sizeof(hmac_hash));
- ret = pBCryptFinishHash(hash, hmac_hash, test->hash_size, 0);
+ ret = BCryptFinishHash(hash, hmac_hash, test->hash_size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
format_hash( hmac_hash, test->hash_size, str );
ok(!strcmp(str, test->hmac_hash2), "got %s\n", str);
- ret = pBCryptDestroyHash(hash);
+ ret = BCryptDestroyHash(hash);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
}
- ret = pBCryptDestroyHash(hash);
+ ret = BCryptDestroyHash(hash);
ok(ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret);
- ret = pBCryptDestroyHash(NULL);
+ ret = BCryptDestroyHash(NULL);
ok(ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret);
- ret = pBCryptCloseAlgorithmProvider(alg, 0);
+ ret = BCryptCloseAlgorithmProvider(alg, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
}
@@ -434,7 +396,7 @@ static void test_BcryptHash(void)
}
alg = NULL;
- ret = pBCryptOpenAlgorithmProvider(&alg, BCRYPT_MD5_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0);
+ ret = BCryptOpenAlgorithmProvider(&alg, BCRYPT_MD5_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(alg != NULL, "alg not set\n");
@@ -447,12 +409,12 @@ static void test_BcryptHash(void)
format_hash( md5, sizeof(md5), str );
ok(!strcmp(str, expected), "got %s\n", str);
- ret = pBCryptCloseAlgorithmProvider(alg, 0);
+ ret = BCryptCloseAlgorithmProvider(alg, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
alg = NULL;
memset(md5_hmac, 0, sizeof(md5_hmac));
- ret = pBCryptOpenAlgorithmProvider(&alg, BCRYPT_MD5_ALGORITHM, MS_PRIMITIVE_PROVIDER, BCRYPT_ALG_HANDLE_HMAC_FLAG);
+ ret = BCryptOpenAlgorithmProvider(&alg, BCRYPT_MD5_ALGORITHM, MS_PRIMITIVE_PROVIDER, BCRYPT_ALG_HANDLE_HMAC_FLAG);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(alg != NULL, "alg not set\n");
@@ -461,7 +423,7 @@ static void test_BcryptHash(void)
format_hash( md5_hmac, sizeof(md5_hmac), str );
ok(!strcmp(str, expected_hmac), "got %s\n", str);
- ret = pBCryptCloseAlgorithmProvider(alg, 0);
+ ret = BCryptCloseAlgorithmProvider(alg, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
}
@@ -507,14 +469,8 @@ static void test_BcryptDeriveKeyPBKDF2(void)
NTSTATUS ret;
ULONG i;
- if (!pBCryptDeriveKeyPBKDF2) /* < Win7 */
- {
- win_skip("BCryptDeriveKeyPBKDF2 is not available\n");
- return;
- }
-
alg = NULL;
- ret = pBCryptOpenAlgorithmProvider(&alg, BCRYPT_SHA1_ALGORITHM, MS_PRIMITIVE_PROVIDER,
+ ret = BCryptOpenAlgorithmProvider(&alg, BCRYPT_SHA1_ALGORITHM, MS_PRIMITIVE_PROVIDER,
BCRYPT_ALG_HANDLE_HMAC_FLAG);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(alg != NULL, "alg not set\n");
@@ -522,21 +478,21 @@ static void test_BcryptDeriveKeyPBKDF2(void)
test_hash_length(alg, 20);
test_alg_name(alg, L"SHA1");
- ret = pBCryptDeriveKeyPBKDF2(alg, rfc6070[0].pwd, rfc6070[0].pwd_len, rfc6070[0].salt, rfc6070[0].salt_len,
+ ret = BCryptDeriveKeyPBKDF2(alg, rfc6070[0].pwd, rfc6070[0].pwd_len, rfc6070[0].salt, rfc6070[0].salt_len,
0, buf, rfc6070[0].dk_len, 0);
ok(ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret);
for (i = 0; i < ARRAY_SIZE(rfc6070); i++)
{
memset(buf, 0, sizeof(buf));
- ret = pBCryptDeriveKeyPBKDF2(alg, rfc6070[i].pwd, rfc6070[i].pwd_len, rfc6070[i].salt, rfc6070[i].salt_len,
+ ret = BCryptDeriveKeyPBKDF2(alg, rfc6070[i].pwd, rfc6070[i].pwd_len, rfc6070[i].salt, rfc6070[i].salt_len,
rfc6070[i].iterations, buf, rfc6070[i].dk_len, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
format_hash(buf, rfc6070[i].dk_len, str);
ok(!memcmp(str, rfc6070[i].dk, rfc6070[i].dk_len), "got %s\n", str);
}
- ret = pBCryptCloseAlgorithmProvider(alg, 0);
+ ret = BCryptCloseAlgorithmProvider(alg, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
}
@@ -548,26 +504,26 @@ static void test_rng(void)
NTSTATUS ret;
alg = NULL;
- ret = pBCryptOpenAlgorithmProvider(&alg, BCRYPT_RNG_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0);
+ ret = BCryptOpenAlgorithmProvider(&alg, BCRYPT_RNG_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(alg != NULL, "alg not set\n");
len = size = 0xdeadbeef;
- ret = pBCryptGetProperty(alg, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
+ ret = BCryptGetProperty(alg, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
ok(ret == STATUS_NOT_SUPPORTED, "got %08x\n", ret);
len = size = 0xdeadbeef;
- ret = pBCryptGetProperty(alg, BCRYPT_HASH_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
+ ret = BCryptGetProperty(alg, BCRYPT_HASH_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
ok(ret == STATUS_NOT_SUPPORTED, "got %08x\n", ret);
test_alg_name(alg, L"RNG");
memset(buf, 0, 16);
- ret = pBCryptGenRandom(alg, buf, 8, 0);
+ ret = BCryptGenRandom(alg, buf, 8, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(memcmp(buf, buf + 8, 8), "got zeroes\n");
- ret = pBCryptCloseAlgorithmProvider(alg, 0);
+ ret = BCryptCloseAlgorithmProvider(alg, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
}
@@ -580,42 +536,42 @@ static void test_aes(void)
NTSTATUS ret;
alg = NULL;
- ret = pBCryptOpenAlgorithmProvider(&alg, BCRYPT_AES_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0);
+ ret = BCryptOpenAlgorithmProvider(&alg, BCRYPT_AES_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(alg != NULL, "alg not set\n");
len = size = 0;
- ret = pBCryptGetProperty(alg, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
+ ret = BCryptGetProperty(alg, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(len, "expected non-zero len\n");
ok(size == sizeof(len), "got %u\n", size);
len = size = 0;
- ret = pBCryptGetProperty(alg, BCRYPT_BLOCK_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
+ ret = BCryptGetProperty(alg, BCRYPT_BLOCK_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(len == 16, "got %u\n", len);
ok(size == sizeof(len), "got %u\n", size);
size = 0;
- ret = pBCryptGetProperty(alg, BCRYPT_CHAINING_MODE, mode, 0, &size, 0);
+ ret = BCryptGetProperty(alg, BCRYPT_CHAINING_MODE, mode, 0, &size, 0);
ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
ok(size == 64, "got %u\n", size);
size = 0;
- ret = pBCryptGetProperty(alg, BCRYPT_CHAINING_MODE, mode, sizeof(mode) - 1, &size, 0);
+ ret = BCryptGetProperty(alg, BCRYPT_CHAINING_MODE, mode, sizeof(mode) - 1, &size, 0);
ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
ok(size == 64, "got %u\n", size);
size = 0;
memset(mode, 0, sizeof(mode));
- ret = pBCryptGetProperty(alg, BCRYPT_CHAINING_MODE, mode, sizeof(mode), &size, 0);
+ ret = BCryptGetProperty(alg, BCRYPT_CHAINING_MODE, mode, sizeof(mode), &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(!lstrcmpW((const WCHAR *)mode, BCRYPT_CHAIN_MODE_CBC), "got %s\n", wine_dbgstr_w((const WCHAR *)mode));
ok(size == 64, "got %u\n", size);
size = 0;
memset(&key_lengths, 0, sizeof(key_lengths));
- ret = pBCryptGetProperty(alg, BCRYPT_KEY_LENGTHS, (UCHAR*)&key_lengths, sizeof(key_lengths), &size, 0);
+ ret = BCryptGetProperty(alg, BCRYPT_KEY_LENGTHS, (UCHAR*)&key_lengths, sizeof(key_lengths), &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == sizeof(key_lengths), "got %u\n", size);
ok(key_lengths.dwMinLength == 128, "Expected 128, got %d\n", key_lengths.dwMinLength);
@@ -623,19 +579,19 @@ static void test_aes(void)
ok(key_lengths.dwIncrement == 64, "Expected 64, got %d\n", key_lengths.dwIncrement);
memcpy(mode, BCRYPT_CHAIN_MODE_GCM, sizeof(BCRYPT_CHAIN_MODE_GCM));
- ret = pBCryptSetProperty(alg, BCRYPT_CHAINING_MODE, mode, 0, 0);
+ ret = BCryptSetProperty(alg, BCRYPT_CHAINING_MODE, mode, 0, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
size = 0;
memset(mode, 0, sizeof(mode));
- ret = pBCryptGetProperty(alg, BCRYPT_CHAINING_MODE, mode, sizeof(mode), &size, 0);
+ ret = BCryptGetProperty(alg, BCRYPT_CHAINING_MODE, mode, sizeof(mode), &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(!lstrcmpW((const WCHAR *)mode, BCRYPT_CHAIN_MODE_GCM), "got %s\n", wine_dbgstr_w((const WCHAR *)mode));
ok(size == 64, "got %u\n", size);
test_alg_name(alg, L"AES");
- ret = pBCryptCloseAlgorithmProvider(alg, 0);
+ ret = BCryptCloseAlgorithmProvider(alg, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
}
@@ -648,42 +604,42 @@ static void test_3des(void)
NTSTATUS ret;
alg = NULL;
- ret = pBCryptOpenAlgorithmProvider(&alg, BCRYPT_3DES_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0);
+ ret = BCryptOpenAlgorithmProvider(&alg, BCRYPT_3DES_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(alg != NULL, "alg not set\n");
len = size = 0;
- ret = pBCryptGetProperty(alg, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
+ ret = BCryptGetProperty(alg, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(len, "expected non-zero len\n");
ok(size == sizeof(len), "got %u\n", size);
len = size = 0;
- ret = pBCryptGetProperty(alg, BCRYPT_BLOCK_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
+ ret = BCryptGetProperty(alg, BCRYPT_BLOCK_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(len == 8, "got %u\n", len);
ok(size == sizeof(len), "got %u\n", size);
size = 0;
- ret = pBCryptGetProperty(alg, BCRYPT_CHAINING_MODE, mode, 0, &size, 0);
+ ret = BCryptGetProperty(alg, BCRYPT_CHAINING_MODE, mode, 0, &size, 0);
ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
ok(size == 64, "got %u\n", size);
size = 0;
- ret = pBCryptGetProperty(alg, BCRYPT_CHAINING_MODE, mode, sizeof(mode) - 1, &size, 0);
+ ret = BCryptGetProperty(alg, BCRYPT_CHAINING_MODE, mode, sizeof(mode) - 1, &size, 0);
ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
ok(size == 64, "got %u\n", size);
size = 0;
memset(mode, 0, sizeof(mode));
- ret = pBCryptGetProperty(alg, BCRYPT_CHAINING_MODE, mode, sizeof(mode), &size, 0);
+ ret = BCryptGetProperty(alg, BCRYPT_CHAINING_MODE, mode, sizeof(mode), &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(!lstrcmpW((const WCHAR *)mode, BCRYPT_CHAIN_MODE_CBC), "got %s\n", wine_dbgstr_w((const WCHAR *)mode));
ok(size == 64, "got %u\n", size);
size = 0;
memset(&key_lengths, 0, sizeof(key_lengths));
- ret = pBCryptGetProperty(alg, BCRYPT_KEY_LENGTHS, (UCHAR*)&key_lengths, sizeof(key_lengths), &size, 0);
+ ret = BCryptGetProperty(alg, BCRYPT_KEY_LENGTHS, (UCHAR*)&key_lengths, sizeof(key_lengths), &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == sizeof(key_lengths), "got %u\n", size);
ok(key_lengths.dwMinLength == 192, "Expected 192, got %d\n", key_lengths.dwMinLength);
@@ -691,12 +647,12 @@ static void test_3des(void)
ok(key_lengths.dwIncrement == 0, "Expected 0, got %d\n", key_lengths.dwIncrement);
memcpy(mode, BCRYPT_CHAIN_MODE_GCM, sizeof(BCRYPT_CHAIN_MODE_GCM));
- ret = pBCryptSetProperty(alg, BCRYPT_CHAINING_MODE, mode, 0, 0);
+ ret = BCryptSetProperty(alg, BCRYPT_CHAINING_MODE, mode, 0, 0);
ok(ret == STATUS_NOT_SUPPORTED, "got %08x\n", ret);
test_alg_name(alg, L"3DES");
- ret = pBCryptCloseAlgorithmProvider(alg, 0);
+ ret = BCryptCloseAlgorithmProvider(alg, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
}
@@ -717,15 +673,15 @@ static void test_BCryptGenerateSymmetricKey(void)
ULONG size, len, i;
NTSTATUS ret;
- ret = pBCryptOpenAlgorithmProvider(&aes, BCRYPT_AES_ALGORITHM, NULL, 0);
+ ret = BCryptOpenAlgorithmProvider(&aes, BCRYPT_AES_ALGORITHM, NULL, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
len = size = 0xdeadbeef;
- ret = pBCryptGetProperty(aes, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
+ ret = BCryptGetProperty(aes, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
key = (void *)0xdeadbeef;
- ret = pBCryptGenerateSymmetricKey(NULL, &key, NULL, 0, secret, sizeof(secret), 0);
+ ret = BCryptGenerateSymmetricKey(NULL, &key, NULL, 0, secret, sizeof(secret), 0);
ok(ret == STATUS_INVALID_HANDLE, "got %08x\n", ret);
ok(key == (void *)0xdeadbeef, "got %p\n", key);
@@ -733,61 +689,61 @@ static void test_BCryptGenerateSymmetricKey(void)
buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
key = (BCRYPT_KEY_HANDLE)0xdeadbeef;
- ret = pBCryptGenerateSymmetricKey(aes, &key, buf, len, secret, 1, 0);
+ ret = BCryptGenerateSymmetricKey(aes, &key, buf, len, secret, 1, 0);
ok(ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret);
ok(key == (HANDLE)0xdeadbeef, "got unexpected key %p.\n", key);
key = (BCRYPT_KEY_HANDLE)0xdeadbeef;
- ret = pBCryptGenerateSymmetricKey(aes, &key, buf, len, secret, sizeof(secret) + 1, 0);
+ ret = BCryptGenerateSymmetricKey(aes, &key, buf, len, secret, sizeof(secret) + 1, 0);
ok(ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret);
ok(key == (HANDLE)0xdeadbeef, "got unexpected key %p.\n", key);
- ret = pBCryptGenerateSymmetricKey(aes, &key, buf, len, secret, sizeof(secret), 0);
+ ret = BCryptGenerateSymmetricKey(aes, &key, buf, len, secret, sizeof(secret), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(key != NULL, "key not set\n");
- ret = pBCryptSetProperty(aes, BCRYPT_CHAINING_MODE, (UCHAR *)BCRYPT_CHAIN_MODE_CBC,
+ ret = BCryptSetProperty(aes, BCRYPT_CHAINING_MODE, (UCHAR *)BCRYPT_CHAIN_MODE_CBC,
sizeof(BCRYPT_CHAIN_MODE_CBC), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
size = 0;
memset(mode, 0, sizeof(mode));
- ret = pBCryptGetProperty(key, BCRYPT_CHAINING_MODE, mode, sizeof(mode), &size, 0);
+ ret = BCryptGetProperty(key, BCRYPT_CHAINING_MODE, mode, sizeof(mode), &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(!lstrcmpW((const WCHAR *)mode, BCRYPT_CHAIN_MODE_CBC), "got %s\n", wine_dbgstr_w((const WCHAR *)mode));
ok(size == 64, "got %u\n", size);
- ret = pBCryptSetProperty(key, BCRYPT_CHAINING_MODE, (UCHAR *)BCRYPT_CHAIN_MODE_ECB, 0, 0);
+ ret = BCryptSetProperty(key, BCRYPT_CHAINING_MODE, (UCHAR *)BCRYPT_CHAIN_MODE_ECB, 0, 0);
ok(ret == STATUS_SUCCESS || broken(ret == STATUS_NOT_SUPPORTED) /* < Win 8 */, "got %08x\n", ret);
if (ret == STATUS_SUCCESS)
{
size = 0;
memset(mode, 0, sizeof(mode));
- ret = pBCryptGetProperty(key, BCRYPT_CHAINING_MODE, mode, sizeof(mode), &size, 0);
+ ret = BCryptGetProperty(key, BCRYPT_CHAINING_MODE, mode, sizeof(mode), &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(!lstrcmpW((const WCHAR *)mode, BCRYPT_CHAIN_MODE_ECB), "got %s\n", wine_dbgstr_w((const WCHAR *)mode));
ok(size == 64, "got %u\n", size);
}
- ret = pBCryptSetProperty(key, BCRYPT_CHAINING_MODE, (UCHAR *)BCRYPT_CHAIN_MODE_CBC,
+ ret = BCryptSetProperty(key, BCRYPT_CHAINING_MODE, (UCHAR *)BCRYPT_CHAIN_MODE_CBC,
sizeof(BCRYPT_CHAIN_MODE_CBC), 0);
ok(ret == STATUS_SUCCESS || broken(ret == STATUS_NOT_SUPPORTED) /* < Win 8 */, "got %08x\n", ret);
size = 0xdeadbeef;
- ret = pBCryptEncrypt(key, NULL, 0, NULL, NULL, 0, NULL, 0, &size, 0);
+ ret = BCryptEncrypt(key, NULL, 0, NULL, NULL, 0, NULL, 0, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(!size, "got %u\n", size);
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
- ret = pBCryptEncrypt(key, data, 16, NULL, ivbuf, 16, NULL, 0, &size, 0);
+ ret = BCryptEncrypt(key, data, 16, NULL, ivbuf, 16, NULL, 0, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 16, "got %u\n", size);
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
memset(ciphertext, 0, sizeof(ciphertext));
- ret = pBCryptEncrypt(key, data, 16, NULL, ivbuf, 16, ciphertext, 16, &size, 0);
+ ret = BCryptEncrypt(key, data, 16, NULL, ivbuf, 16, ciphertext, 16, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 16, "got %u\n", size);
ok(!memcmp(ciphertext, expected, sizeof(expected)), "wrong data\n");
@@ -795,18 +751,18 @@ static void test_BCryptGenerateSymmetricKey(void)
ok(ciphertext[i] == expected[i], "%u: %02x != %02x\n", i, ciphertext[i], expected[i]);
key2 = (void *)0xdeadbeef;
- ret = pBCryptDuplicateKey(NULL, &key2, NULL, 0, 0);
+ ret = BCryptDuplicateKey(NULL, &key2, NULL, 0, 0);
ok(ret == STATUS_INVALID_HANDLE, "got %08x\n", ret);
ok(key2 == (void *)0xdeadbeef, "got %p\n", key2);
if (0) /* crashes on some Windows versions */
{
- ret = pBCryptDuplicateKey(key, NULL, NULL, 0, 0);
+ ret = BCryptDuplicateKey(key, NULL, NULL, 0, 0);
ok(ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret);
}
key2 = (void *)0xdeadbeef;
- ret = pBCryptDuplicateKey(key, &key2, NULL, 0, 0);
+ ret = BCryptDuplicateKey(key, &key2, NULL, 0, 0);
ok(ret == STATUS_SUCCESS || broken(ret == STATUS_INVALID_PARAMETER), "got %08x\n", ret);
if (ret == STATUS_SUCCESS)
@@ -814,62 +770,62 @@ static void test_BCryptGenerateSymmetricKey(void)
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
memset(ciphertext, 0, sizeof(ciphertext));
- ret = pBCryptEncrypt(key2, data, 16, NULL, ivbuf, 16, ciphertext, 16, &size, 0);
+ ret = BCryptEncrypt(key2, data, 16, NULL, ivbuf, 16, ciphertext, 16, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 16, "got %u\n", size);
ok(!memcmp(ciphertext, expected, sizeof(expected)), "wrong data\n");
for (i = 0; i < 16; i++)
ok(ciphertext[i] == expected[i], "%u: %02x != %02x\n", i, ciphertext[i], expected[i]);
- ret = pBCryptDestroyKey(key2);
+ ret = BCryptDestroyKey(key2);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
}
size = 0xdeadbeef;
- ret = pBCryptDecrypt(key, NULL, 0, NULL, NULL, 0, NULL, 0, &size, 0);
+ ret = BCryptDecrypt(key, NULL, 0, NULL, NULL, 0, NULL, 0, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(!size, "got %u\n", size);
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
- ret = pBCryptDecrypt(key, ciphertext, 16, NULL, ivbuf, 16, NULL, 0, &size, 0);
+ ret = BCryptDecrypt(key, ciphertext, 16, NULL, ivbuf, 16, NULL, 0, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 16, "got %u\n", size);
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
memset(plaintext, 0, sizeof(plaintext));
- ret = pBCryptDecrypt(key, ciphertext, 16, NULL, ivbuf, 16, plaintext, 16, &size, 0);
+ ret = BCryptDecrypt(key, ciphertext, 16, NULL, ivbuf, 16, plaintext, 16, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 16, "got %u\n", size);
ok(!memcmp(plaintext, data, sizeof(data)), "wrong data\n");
memset(mode, 0, sizeof(mode));
- ret = pBCryptGetProperty(key, BCRYPT_CHAINING_MODE, mode, sizeof(mode), &size, 0);
+ ret = BCryptGetProperty(key, BCRYPT_CHAINING_MODE, mode, sizeof(mode), &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(!lstrcmpW((const WCHAR *)mode, BCRYPT_CHAIN_MODE_CBC), "wrong mode\n");
len = 0;
size = 0;
- ret = pBCryptGetProperty(key, BCRYPT_BLOCK_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
+ ret = BCryptGetProperty(key, BCRYPT_BLOCK_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(len == 16, "got %u\n", len);
ok(size == sizeof(len), "got %u\n", size);
size = 0;
memset(&key_lengths, 0, sizeof(key_lengths));
- ret = pBCryptGetProperty(aes, BCRYPT_KEY_LENGTHS, (UCHAR*)&key_lengths, sizeof(key_lengths), &size, 0);
+ ret = BCryptGetProperty(aes, BCRYPT_KEY_LENGTHS, (UCHAR*)&key_lengths, sizeof(key_lengths), &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == sizeof(key_lengths), "got %u\n", size);
ok(key_lengths.dwMinLength == 128, "Expected 128, got %d\n", key_lengths.dwMinLength);
ok(key_lengths.dwMaxLength == 256, "Expected 256, got %d\n", key_lengths.dwMaxLength);
ok(key_lengths.dwIncrement == 64, "Expected 64, got %d\n", key_lengths.dwIncrement);
- ret = pBCryptDestroyKey(key);
+ ret = BCryptDestroyKey(key);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
HeapFree(GetProcessHeap(), 0, buf);
- ret = pBCryptCloseAlgorithmProvider(aes, 0);
+ ret = BCryptCloseAlgorithmProvider(aes, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
}
@@ -917,7 +873,7 @@ static DWORD WINAPI encrypt_race_thread(void *parameter)
size = 0;
memset(ciphertext, 0xff, sizeof(ciphertext));
memset(tag, 0xff, sizeof(tag));
- ret = pBCryptEncrypt(key, data2, 32, &auth_info, NULL, 0, ciphertext, 32, &size, 0);
+ ret = BCryptEncrypt(key, data2, 32, &auth_info, NULL, 0, ciphertext, 32, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
ok(!memcmp(ciphertext, expected4, sizeof(expected4)), "wrong data\n");
@@ -996,7 +952,7 @@ static void test_BCryptEncrypt(void)
HANDLE hthread;
NTSTATUS ret;
- ret = pBCryptOpenAlgorithmProvider(&aes, BCRYPT_AES_ALGORITHM, NULL, 0);
+ ret = BCryptOpenAlgorithmProvider(&aes, BCRYPT_AES_ALGORITHM, NULL, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
/******************
@@ -1005,26 +961,26 @@ static void test_BCryptEncrypt(void)
len = 0xdeadbeef;
size = sizeof(len);
- ret = pBCryptGetProperty(aes, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
+ ret = BCryptGetProperty(aes, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
key = NULL;
buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
- ret = pBCryptGenerateSymmetricKey(aes, &key, buf, len, secret, sizeof(secret), 0);
+ ret = BCryptGenerateSymmetricKey(aes, &key, buf, len, secret, sizeof(secret), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(key != NULL, "key not set\n");
/* input size is a multiple of block size */
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
- ret = pBCryptEncrypt(key, data, 16, NULL, ivbuf, 16, NULL, 0, &size, 0);
+ ret = BCryptEncrypt(key, data, 16, NULL, ivbuf, 16, NULL, 0, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 16, "got %u\n", size);
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
memset(ciphertext, 0, sizeof(ciphertext));
- ret = pBCryptEncrypt(key, data, 16, NULL, ivbuf, 16, ciphertext, 16, &size, 0);
+ ret = BCryptEncrypt(key, data, 16, NULL, ivbuf, 16, ciphertext, 16, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 16, "got %u\n", size);
ok(!memcmp(ciphertext, expected, sizeof(expected)), "wrong data\n");
@@ -1034,7 +990,7 @@ static void test_BCryptEncrypt(void)
/* NULL initialization vector */
size = 0;
memset(ciphertext, 0, sizeof(ciphertext));
- ret = pBCryptEncrypt(key, data, 16, NULL, NULL, 0, ciphertext, 16, &size, 0);
+ ret = BCryptEncrypt(key, data, 16, NULL, NULL, 0, ciphertext, 16, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 16, "got %u\n", size);
todo_wine ok(!memcmp(ciphertext, expected8, sizeof(expected8)), "wrong data\n");
@@ -1043,7 +999,7 @@ static void test_BCryptEncrypt(void)
size = 0;
memset(ciphertext, 0, sizeof(ciphertext));
memset(ivbuf, 0, sizeof(ivbuf));
- ret = pBCryptEncrypt(key, data, 16, NULL, ivbuf, 16, ciphertext, 16, &size, 0);
+ ret = BCryptEncrypt(key, data, 16, NULL, ivbuf, 16, ciphertext, 16, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 16, "got %u\n", size);
ok(!memcmp(ciphertext, expected9, sizeof(expected9)), "wrong data\n");
@@ -1053,21 +1009,21 @@ static void test_BCryptEncrypt(void)
/* input size is not a multiple of block size */
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
- ret = pBCryptEncrypt(key, data, 17, NULL, ivbuf, 16, NULL, 0, &size, 0);
+ ret = BCryptEncrypt(key, data, 17, NULL, ivbuf, 16, NULL, 0, &size, 0);
ok(ret == STATUS_INVALID_BUFFER_SIZE, "got %08x\n", ret);
ok(size == 17, "got %u\n", size);
/* input size is not a multiple of block size, block padding set */
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
- ret = pBCryptEncrypt(key, data, 17, NULL, ivbuf, 16, NULL, 0, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptEncrypt(key, data, 17, NULL, ivbuf, 16, NULL, 0, &size, BCRYPT_BLOCK_PADDING);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
memset(ciphertext, 0, sizeof(ciphertext));
- ret = pBCryptEncrypt(key, data, 17, NULL, ivbuf, 16, ciphertext, 32, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptEncrypt(key, data, 17, NULL, ivbuf, 16, ciphertext, 32, &size, BCRYPT_BLOCK_PADDING);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
ok(!memcmp(ciphertext, expected2, sizeof(expected2)), "wrong data\n");
@@ -1077,14 +1033,14 @@ static void test_BCryptEncrypt(void)
/* input size is a multiple of block size, block padding set */
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
- ret = pBCryptEncrypt(key, data2, 32, NULL, ivbuf, 16, NULL, 0, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptEncrypt(key, data2, 32, NULL, ivbuf, 16, NULL, 0, &size, BCRYPT_BLOCK_PADDING);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 48, "got %u\n", size);
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
memset(ciphertext, 0, sizeof(ciphertext));
- ret = pBCryptEncrypt(key, data2, 32, NULL, ivbuf, 16, ciphertext, 48, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptEncrypt(key, data2, 32, NULL, ivbuf, 16, ciphertext, 48, &size, BCRYPT_BLOCK_PADDING);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 48, "got %u\n", size);
ok(!memcmp(ciphertext, expected3, sizeof(expected3)), "wrong data\n");
@@ -1095,51 +1051,51 @@ static void test_BCryptEncrypt(void)
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
memset(ciphertext, 0, sizeof(ciphertext));
- ret = pBCryptEncrypt(key, data, 17, NULL, ivbuf, 16, ciphertext, 31, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptEncrypt(key, data, 17, NULL, ivbuf, 16, ciphertext, 31, &size, BCRYPT_BLOCK_PADDING);
ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
memset(ciphertext, 0, sizeof(ciphertext));
- ret = pBCryptEncrypt(key, data2, 32, NULL, ivbuf, 16, ciphertext, 32, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptEncrypt(key, data2, 32, NULL, ivbuf, 16, ciphertext, 32, &size, BCRYPT_BLOCK_PADDING);
ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
ok(size == 48, "got %u\n", size);
- ret = pBCryptDestroyKey(key);
+ ret = BCryptDestroyKey(key);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
HeapFree(GetProcessHeap(), 0, buf);
/* 256 bit key */
buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
- ret = pBCryptGenerateSymmetricKey(aes, &key, buf, len, secret256, sizeof(secret256), 0);
+ ret = BCryptGenerateSymmetricKey(aes, &key, buf, len, secret256, sizeof(secret256), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
- ret = pBCryptDestroyKey(key);
+ ret = BCryptDestroyKey(key);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
/* Key generations succeeds if the key size exceeds maximum and uses maximum key length
* from secret. */
- ret = pBCryptGenerateSymmetricKey(aes, &key, buf, len, secret256, sizeof(secret256) + 1, 0);
+ ret = BCryptGenerateSymmetricKey(aes, &key, buf, len, secret256, sizeof(secret256) + 1, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
- ret = pBCryptEncrypt(key, data2, 32, NULL, ivbuf, 16, NULL, 0, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptEncrypt(key, data2, 32, NULL, ivbuf, 16, NULL, 0, &size, BCRYPT_BLOCK_PADDING);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 48, "got %u\n", size);
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
memset(ciphertext, 0, sizeof(ciphertext));
- ret = pBCryptEncrypt(key, data2, 32, NULL, ivbuf, 16, ciphertext, 48, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptEncrypt(key, data2, 32, NULL, ivbuf, 16, ciphertext, 48, &size, BCRYPT_BLOCK_PADDING);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 48, "got %u\n", size);
ok(!memcmp(ciphertext, expected10, sizeof(expected10)), "wrong data\n");
for (i = 0; i < 48; i++)
ok(ciphertext[i] == expected10[i], "%u: %02x != %02x\n", i, ciphertext[i], expected10[i]);
- ret = pBCryptDestroyKey(key);
+ ret = BCryptDestroyKey(key);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
HeapFree(GetProcessHeap(), 0, buf);
@@ -1148,20 +1104,20 @@ static void test_BCryptEncrypt(void)
******************/
size = 0;
- ret = pBCryptGetProperty(aes, BCRYPT_AUTH_TAG_LENGTH, NULL, 0, &size, 0);
+ ret = BCryptGetProperty(aes, BCRYPT_AUTH_TAG_LENGTH, NULL, 0, &size, 0);
ok(ret == STATUS_NOT_SUPPORTED, "got %08x\n", ret);
- ret = pBCryptSetProperty(aes, BCRYPT_CHAINING_MODE, (UCHAR*)BCRYPT_CHAIN_MODE_GCM, sizeof(BCRYPT_CHAIN_MODE_GCM), 0);
+ ret = BCryptSetProperty(aes, BCRYPT_CHAINING_MODE, (UCHAR*)BCRYPT_CHAIN_MODE_GCM, sizeof(BCRYPT_CHAIN_MODE_GCM), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
size = 0;
- ret = pBCryptGetProperty(aes, BCRYPT_AUTH_TAG_LENGTH, NULL, 0, &size, 0);
+ ret = BCryptGetProperty(aes, BCRYPT_AUTH_TAG_LENGTH, NULL, 0, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == sizeof(tag_length), "got %u\n", size);
size = 0;
memset(&tag_length, 0, sizeof(tag_length));
- ret = pBCryptGetProperty(aes, BCRYPT_AUTH_TAG_LENGTH, (UCHAR*)&tag_length, sizeof(tag_length), &size, 0);
+ ret = BCryptGetProperty(aes, BCRYPT_AUTH_TAG_LENGTH, (UCHAR*)&tag_length, sizeof(tag_length), &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == sizeof(tag_length), "got %u\n", size);
ok(tag_length.dwMinLength == 12, "Expected 12, got %d\n", tag_length.dwMinLength);
@@ -1170,16 +1126,16 @@ static void test_BCryptEncrypt(void)
len = 0xdeadbeef;
size = sizeof(len);
- ret = pBCryptGetProperty(aes, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
+ ret = BCryptGetProperty(aes, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
key = NULL;
buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
- ret = pBCryptGenerateSymmetricKey(aes, &key, buf, len, secret, sizeof(secret), 0);
+ ret = BCryptGenerateSymmetricKey(aes, &key, buf, len, secret, sizeof(secret), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(key != NULL, "key not set\n");
- ret = pBCryptGetProperty(key, BCRYPT_AUTH_TAG_LENGTH, (UCHAR*)&tag_length, sizeof(tag_length), &size, 0);
+ ret = BCryptGetProperty(key, BCRYPT_AUTH_TAG_LENGTH, (UCHAR*)&tag_length, sizeof(tag_length), &size, 0);
ok(ret == STATUS_NOT_SUPPORTED, "got %08x\n", ret);
memset(&auth_info, 0, sizeof(auth_info));
@@ -1195,7 +1151,7 @@ static void test_BCryptEncrypt(void)
memcpy(ivbuf, iv, sizeof(iv));
memset(ciphertext, 0xff, sizeof(ciphertext));
memset(tag, 0xff, sizeof(tag));
- ret = pBCryptEncrypt(key, data2, 32, &auth_info, ivbuf, 16, ciphertext, 32, &size, 0);
+ ret = BCryptEncrypt(key, data2, 32, &auth_info, ivbuf, 16, ciphertext, 32, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
ok(!memcmp(ciphertext, expected4, sizeof(expected4)), "wrong data\n");
@@ -1209,7 +1165,7 @@ static void test_BCryptEncrypt(void)
size = 0;
memset(ciphertext, 0xff, sizeof(ciphertext));
memset(tag, 0xff, sizeof(tag));
- ret = pBCryptEncrypt(key, data2, 32, &auth_info, NULL, 0, ciphertext, 32, &size, 0);
+ ret = BCryptEncrypt(key, data2, 32, &auth_info, NULL, 0, ciphertext, 32, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
ok(!memcmp(ciphertext, expected4, sizeof(expected4)), "wrong data\n");
@@ -1224,7 +1180,7 @@ static void test_BCryptEncrypt(void)
memset(ciphertext, 0xff, sizeof(ciphertext));
memset(tag, 0xff, sizeof(tag));
memset(ivbuf, 0, sizeof(ivbuf));
- ret = pBCryptEncrypt(key, data2, 32, &auth_info, ivbuf, 16, ciphertext, 32, &size, 0);
+ ret = BCryptEncrypt(key, data2, 32, &auth_info, ivbuf, 16, ciphertext, 32, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
ok(!memcmp(ciphertext, expected4, sizeof(expected4)), "wrong data\n");
@@ -1239,7 +1195,7 @@ static void test_BCryptEncrypt(void)
memcpy(ivbuf, iv, sizeof(iv));
memset(ciphertext, 0xff, sizeof(ciphertext));
memset(tag, 0xff, sizeof(tag));
- ret = pBCryptEncrypt(key, data2, 24, &auth_info, ivbuf, 16, ciphertext, 24, &size, 0);
+ ret = BCryptEncrypt(key, data2, 24, &auth_info, ivbuf, 16, ciphertext, 24, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 24, "got %u\n", size);
ok(!memcmp(ciphertext, expected4, 24), "wrong data\n");
@@ -1257,7 +1213,7 @@ static void test_BCryptEncrypt(void)
memcpy(ivbuf, iv, sizeof(iv));
memset(ciphertext, 0xff, sizeof(ciphertext));
memset(tag, 0xff, sizeof(tag));
- ret = pBCryptEncrypt(key, data2, 32, &auth_info, ivbuf, 16, ciphertext, 32, &size, 0);
+ ret = BCryptEncrypt(key, data2, 32, &auth_info, ivbuf, 16, ciphertext, 32, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
ok(!memcmp(ciphertext, expected4, sizeof(expected4)), "wrong data\n");
@@ -1268,14 +1224,14 @@ static void test_BCryptEncrypt(void)
ok(tag[i] == expected_tag3[i], "%u: %02x != %02x\n", i, tag[i], expected_tag3[i]);
memset(tag, 0xff, sizeof(tag));
- ret = pBCryptEncrypt(key, data2, 0, &auth_info, ivbuf, 16, NULL, 0, &size, 0);
+ ret = BCryptEncrypt(key, data2, 0, &auth_info, ivbuf, 16, NULL, 0, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(!size, "got %u\n", size);
for (i = 0; i < 16; i++)
ok(tag[i] == 0xff, "%u: %02x != %02x\n", i, tag[i], 0xff);
memset(tag, 0xff, sizeof(tag));
- ret = pBCryptEncrypt(key, NULL, 0, &auth_info, ivbuf, 16, NULL, 0, &size, 0);
+ ret = BCryptEncrypt(key, NULL, 0, &auth_info, ivbuf, 16, NULL, 0, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(!size, "got %u\n", size);
ok(!memcmp(tag, expected_tag4, sizeof(expected_tag4)), "wrong tag\n");
@@ -1285,12 +1241,12 @@ static void test_BCryptEncrypt(void)
/* test with padding */
memcpy(ivbuf, iv, sizeof(iv));
memset(ciphertext, 0, sizeof(ciphertext));
- ret = pBCryptEncrypt(key, data2, 32, &auth_info, ivbuf, 16, ciphertext, 32, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptEncrypt(key, data2, 32, &auth_info, ivbuf, 16, ciphertext, 32, &size, BCRYPT_BLOCK_PADDING);
todo_wine ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
memcpy(ivbuf, iv, sizeof(iv));
memset(ciphertext, 0, sizeof(ciphertext));
- ret = pBCryptEncrypt(key, data2, 32, &auth_info, ivbuf, 16, ciphertext, 48, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptEncrypt(key, data2, 32, &auth_info, ivbuf, 16, ciphertext, 48, &size, BCRYPT_BLOCK_PADDING);
ok(ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret);
/* race test */
@@ -1306,7 +1262,7 @@ static void test_BCryptEncrypt(void)
size = 0;
memset(ciphertext, 0xff, sizeof(ciphertext));
memset(tag, 0xff, sizeof(tag));
- ret = pBCryptEncrypt(key, data2, 32, &auth_info, NULL, 0, ciphertext, 32, &size, 0);
+ ret = BCryptEncrypt(key, data2, 32, &auth_info, NULL, 0, ciphertext, 32, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
ok(!memcmp(ciphertext, expected4, sizeof(expected4)), "wrong data\n");
@@ -1319,7 +1275,7 @@ static void test_BCryptEncrypt(void)
WaitForSingleObject(hthread, INFINITE);
- ret = pBCryptDestroyKey(key);
+ ret = BCryptDestroyKey(key);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
HeapFree(GetProcessHeap(), 0, buf);
@@ -1327,34 +1283,34 @@ static void test_BCryptEncrypt(void)
* AES - ECB mode *
******************/
- ret = pBCryptSetProperty(aes, BCRYPT_CHAINING_MODE, (UCHAR*)BCRYPT_CHAIN_MODE_ECB, sizeof(BCRYPT_CHAIN_MODE_ECB), 0);
+ ret = BCryptSetProperty(aes, BCRYPT_CHAINING_MODE, (UCHAR*)BCRYPT_CHAIN_MODE_ECB, sizeof(BCRYPT_CHAIN_MODE_ECB), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
len = 0xdeadbeef;
size = sizeof(len);
- ret = pBCryptGetProperty(aes, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
+ ret = BCryptGetProperty(aes, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
- ret = pBCryptGenerateSymmetricKey(aes, &key, buf, len, secret, sizeof(secret), 0);
+ ret = BCryptGenerateSymmetricKey(aes, &key, buf, len, secret, sizeof(secret), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
/* initialization vector is not allowed */
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
- ret = pBCryptEncrypt(key, data, 16, NULL, ivbuf, 16, ciphertext, 16, &size, 0);
+ ret = BCryptEncrypt(key, data, 16, NULL, ivbuf, 16, ciphertext, 16, &size, 0);
ok(ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret);
ok(size == 16, "got %u\n", size);
/* input size is a multiple of block size */
size = 0;
- ret = pBCryptEncrypt(key, data, 16, NULL, NULL, 16, NULL, 0, &size, 0);
+ ret = BCryptEncrypt(key, data, 16, NULL, NULL, 16, NULL, 0, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 16, "got %u\n", size);
size = 0;
memset(ciphertext, 0, sizeof(ciphertext));
- ret = pBCryptEncrypt(key, data, 16, NULL, NULL, 16, ciphertext, 16, &size, 0);
+ ret = BCryptEncrypt(key, data, 16, NULL, NULL, 16, ciphertext, 16, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 16, "got %u\n", size);
ok(!memcmp(ciphertext, expected5, sizeof(expected5)), "wrong data\n");
@@ -1363,19 +1319,19 @@ static void test_BCryptEncrypt(void)
/* input size is not a multiple of block size */
size = 0;
- ret = pBCryptEncrypt(key, data, 17, NULL, NULL, 16, NULL, 0, &size, 0);
+ ret = BCryptEncrypt(key, data, 17, NULL, NULL, 16, NULL, 0, &size, 0);
ok(ret == STATUS_INVALID_BUFFER_SIZE, "got %08x\n", ret);
ok(size == 17, "got %u\n", size);
/* input size is not a multiple of block size, block padding set */
size = 0;
- ret = pBCryptEncrypt(key, data, 17, NULL, NULL, 16, NULL, 0, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptEncrypt(key, data, 17, NULL, NULL, 16, NULL, 0, &size, BCRYPT_BLOCK_PADDING);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
size = 0;
memset(ciphertext, 0, sizeof(ciphertext));
- ret = pBCryptEncrypt(key, data, 17, NULL, NULL, 16, ciphertext, 32, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptEncrypt(key, data, 17, NULL, NULL, 16, ciphertext, 32, &size, BCRYPT_BLOCK_PADDING);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
ok(!memcmp(ciphertext, expected6, sizeof(expected6)), "wrong data\n");
@@ -1384,13 +1340,13 @@ static void test_BCryptEncrypt(void)
/* input size is a multiple of block size, block padding set */
size = 0;
- ret = pBCryptEncrypt(key, data2, 32, NULL, NULL, 16, NULL, 0, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptEncrypt(key, data2, 32, NULL, NULL, 16, NULL, 0, &size, BCRYPT_BLOCK_PADDING);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 48, "got %u\n", size);
size = 0;
memset(ciphertext, 0, sizeof(ciphertext));
- ret = pBCryptEncrypt(key, data2, 32, NULL, NULL, 16, ciphertext, 48, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptEncrypt(key, data2, 32, NULL, NULL, 16, ciphertext, 48, &size, BCRYPT_BLOCK_PADDING);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 48, "got %u\n", size);
ok(!memcmp(ciphertext, expected7, sizeof(expected7)), "wrong data\n");
@@ -1400,21 +1356,21 @@ static void test_BCryptEncrypt(void)
/* output size too small */
size = 0;
memset(ciphertext, 0, sizeof(ciphertext));
- ret = pBCryptEncrypt(key, data, 17, NULL, NULL, 16, ciphertext, 31, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptEncrypt(key, data, 17, NULL, NULL, 16, ciphertext, 31, &size, BCRYPT_BLOCK_PADDING);
ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
size = 0;
memset(ciphertext, 0, sizeof(ciphertext));
- ret = pBCryptEncrypt(key, data2, 32, NULL, NULL, 16, ciphertext, 32, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptEncrypt(key, data2, 32, NULL, NULL, 16, ciphertext, 32, &size, BCRYPT_BLOCK_PADDING);
ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
ok(size == 48, "got %u\n", size);
- ret = pBCryptDestroyKey(key);
+ ret = BCryptDestroyKey(key);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
HeapFree(GetProcessHeap(), 0, buf);
- ret = pBCryptCloseAlgorithmProvider(aes, 0);
+ ret = BCryptCloseAlgorithmProvider(aes, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
}
@@ -1468,12 +1424,12 @@ static void test_BCryptDecrypt(void)
ULONG size, len;
NTSTATUS ret;
- ret = pBCryptOpenAlgorithmProvider(&aes, BCRYPT_AES_ALGORITHM, NULL, 0);
+ ret = BCryptOpenAlgorithmProvider(&aes, BCRYPT_AES_ALGORITHM, NULL, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
size = 0;
memset(&key_lengths, 0, sizeof(key_lengths));
- ret = pBCryptGetProperty(aes, BCRYPT_KEY_LENGTHS, (UCHAR*)&key_lengths, sizeof(key_lengths), &size, 0);
+ ret = BCryptGetProperty(aes, BCRYPT_KEY_LENGTHS, (UCHAR*)&key_lengths, sizeof(key_lengths), &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == sizeof(key_lengths), "got %u\n", size);
ok(key_lengths.dwMinLength == 128, "Expected 128, got %d\n", key_lengths.dwMinLength);
@@ -1486,26 +1442,26 @@ static void test_BCryptDecrypt(void)
len = 0xdeadbeef;
size = sizeof(len);
- ret = pBCryptGetProperty(aes, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
+ ret = BCryptGetProperty(aes, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
key = NULL;
buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
- ret = pBCryptGenerateSymmetricKey(aes, &key, buf, len, secret, sizeof(secret), 0);
+ ret = BCryptGenerateSymmetricKey(aes, &key, buf, len, secret, sizeof(secret), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(key != NULL, "key not set\n");
/* input size is a multiple of block size */
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
- ret = pBCryptDecrypt(key, ciphertext, 32, NULL, ivbuf, 16, NULL, 0, &size, 0);
+ ret = BCryptDecrypt(key, ciphertext, 32, NULL, ivbuf, 16, NULL, 0, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
memset(plaintext, 0, sizeof(plaintext));
- ret = pBCryptDecrypt(key, ciphertext, 32, NULL, ivbuf, 16, plaintext, 32, &size, 0);
+ ret = BCryptDecrypt(key, ciphertext, 32, NULL, ivbuf, 16, plaintext, 32, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
ok(!memcmp(plaintext, expected, sizeof(expected)), "wrong data\n");
@@ -1513,14 +1469,14 @@ static void test_BCryptDecrypt(void)
/* test with padding smaller than block size */
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
- ret = pBCryptDecrypt(key, ciphertext2, 32, NULL, ivbuf, 16, NULL, 0, &size, 0);
+ ret = BCryptDecrypt(key, ciphertext2, 32, NULL, ivbuf, 16, NULL, 0, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
memset(plaintext, 0, sizeof(plaintext));
- ret = pBCryptDecrypt(key, ciphertext2, 32, NULL, ivbuf, 16, plaintext, 17, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptDecrypt(key, ciphertext2, 32, NULL, ivbuf, 16, plaintext, 17, &size, BCRYPT_BLOCK_PADDING);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 17, "got %u\n", size);
ok(!memcmp(plaintext, expected2, sizeof(expected2)), "wrong data\n");
@@ -1528,14 +1484,14 @@ static void test_BCryptDecrypt(void)
/* test with padding of block size */
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
- ret = pBCryptDecrypt(key, ciphertext3, 48, NULL, ivbuf, 16, NULL, 0, &size, 0);
+ ret = BCryptDecrypt(key, ciphertext3, 48, NULL, ivbuf, 16, NULL, 0, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 48, "got %u\n", size);
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
memset(plaintext, 0, sizeof(plaintext));
- ret = pBCryptDecrypt(key, ciphertext3, 48, NULL, ivbuf, 16, plaintext, 32, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptDecrypt(key, ciphertext3, 48, NULL, ivbuf, 16, plaintext, 32, &size, BCRYPT_BLOCK_PADDING);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
ok(!memcmp(plaintext, expected3, sizeof(expected3)), "wrong data\n");
@@ -1543,43 +1499,43 @@ static void test_BCryptDecrypt(void)
/* output size too small */
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
- ret = pBCryptDecrypt(key, ciphertext, 32, NULL, ivbuf, 16, plaintext, 31, &size, 0);
+ ret = BCryptDecrypt(key, ciphertext, 32, NULL, ivbuf, 16, plaintext, 31, &size, 0);
ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
- ret = pBCryptDecrypt(key, ciphertext2, 32, NULL, ivbuf, 16, plaintext, 15, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptDecrypt(key, ciphertext2, 32, NULL, ivbuf, 16, plaintext, 15, &size, BCRYPT_BLOCK_PADDING);
ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
- ret = pBCryptDecrypt(key, ciphertext2, 32, NULL, ivbuf, 16, plaintext, 16, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptDecrypt(key, ciphertext2, 32, NULL, ivbuf, 16, plaintext, 16, &size, BCRYPT_BLOCK_PADDING);
ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
ok(size == 17, "got %u\n", size);
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
- ret = pBCryptDecrypt(key, ciphertext3, 48, NULL, ivbuf, 16, plaintext, 31, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptDecrypt(key, ciphertext3, 48, NULL, ivbuf, 16, plaintext, 31, &size, BCRYPT_BLOCK_PADDING);
ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
ok(size == 48, "got %u\n", size);
/* input size is not a multiple of block size */
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
- ret = pBCryptDecrypt(key, ciphertext, 17, NULL, ivbuf, 16, NULL, 0, &size, 0);
+ ret = BCryptDecrypt(key, ciphertext, 17, NULL, ivbuf, 16, NULL, 0, &size, 0);
ok(ret == STATUS_INVALID_BUFFER_SIZE, "got %08x\n", ret);
ok(size == 17 || broken(size == 0 /* Win < 7 */), "got %u\n", size);
/* input size is not a multiple of block size, block padding set */
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
- ret = pBCryptDecrypt(key, ciphertext, 17, NULL, ivbuf, 16, NULL, 0, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptDecrypt(key, ciphertext, 17, NULL, ivbuf, 16, NULL, 0, &size, BCRYPT_BLOCK_PADDING);
ok(ret == STATUS_INVALID_BUFFER_SIZE, "got %08x\n", ret);
ok(size == 17 || broken(size == 0 /* Win < 7 */), "got %u\n", size);
- ret = pBCryptDestroyKey(key);
+ ret = BCryptDestroyKey(key);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
HeapFree(GetProcessHeap(), 0, buf);
@@ -1587,16 +1543,16 @@ static void test_BCryptDecrypt(void)
* AES - GCM mode *
******************/
- ret = pBCryptSetProperty(aes, BCRYPT_CHAINING_MODE, (UCHAR*)BCRYPT_CHAIN_MODE_GCM, sizeof(BCRYPT_CHAIN_MODE_GCM), 0);
+ ret = BCryptSetProperty(aes, BCRYPT_CHAINING_MODE, (UCHAR*)BCRYPT_CHAIN_MODE_GCM, sizeof(BCRYPT_CHAIN_MODE_GCM), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
key = NULL;
buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
- ret = pBCryptGenerateSymmetricKey(aes, &key, buf, len, secret, sizeof(secret), 0);
+ ret = BCryptGenerateSymmetricKey(aes, &key, buf, len, secret, sizeof(secret), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(key != NULL, "key not set\n");
- ret = pBCryptGetProperty(key, BCRYPT_AUTH_TAG_LENGTH, (UCHAR*)&tag_lengths, sizeof(tag_lengths), &size, 0);
+ ret = BCryptGetProperty(key, BCRYPT_AUTH_TAG_LENGTH, (UCHAR*)&tag_lengths, sizeof(tag_lengths), &size, 0);
ok(ret == STATUS_NOT_SUPPORTED, "got %08x\n", ret);
memset(&auth_info, 0, sizeof(auth_info));
@@ -1611,7 +1567,7 @@ static void test_BCryptDecrypt(void)
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
memset(plaintext, 0, sizeof(plaintext));
- ret = pBCryptDecrypt(key, ciphertext4, 32, &auth_info, ivbuf, 16, plaintext, 32, &size, 0);
+ ret = BCryptDecrypt(key, ciphertext4, 32, &auth_info, ivbuf, 16, plaintext, 32, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
ok(!memcmp(plaintext, expected3, sizeof(expected3)), "wrong data\n");
@@ -1625,7 +1581,7 @@ static void test_BCryptDecrypt(void)
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
memset(plaintext, 0, sizeof(plaintext));
- ret = pBCryptDecrypt(key, ciphertext4, 32, &auth_info, ivbuf, 16, plaintext, 32, &size, 0);
+ ret = BCryptDecrypt(key, ciphertext4, 32, &auth_info, ivbuf, 16, plaintext, 32, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
ok(!memcmp(plaintext, expected3, sizeof(expected3)), "wrong data\n");
@@ -1633,11 +1589,11 @@ static void test_BCryptDecrypt(void)
/* test with wrong tag */
memcpy(ivbuf, iv, sizeof(iv));
auth_info.pbTag = iv; /* wrong tag */
- ret = pBCryptDecrypt(key, ciphertext4, 32, &auth_info, ivbuf, 16, plaintext, 32, &size, 0);
+ ret = BCryptDecrypt(key, ciphertext4, 32, &auth_info, ivbuf, 16, plaintext, 32, &size, 0);
ok(ret == STATUS_AUTH_TAG_MISMATCH, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
- ret = pBCryptDestroyKey(key);
+ ret = BCryptDestroyKey(key);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
HeapFree(GetProcessHeap(), 0, buf);
@@ -1645,114 +1601,114 @@ static void test_BCryptDecrypt(void)
* AES - ECB mode *
******************/
- ret = pBCryptSetProperty(aes, BCRYPT_CHAINING_MODE, (UCHAR*)BCRYPT_CHAIN_MODE_ECB, sizeof(BCRYPT_CHAIN_MODE_ECB), 0);
+ ret = BCryptSetProperty(aes, BCRYPT_CHAINING_MODE, (UCHAR*)BCRYPT_CHAIN_MODE_ECB, sizeof(BCRYPT_CHAIN_MODE_ECB), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
len = 0xdeadbeef;
size = sizeof(len);
- ret = pBCryptGetProperty(aes, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
+ ret = BCryptGetProperty(aes, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
- ret = pBCryptGenerateSymmetricKey(aes, &key, buf, len, secret, sizeof(secret), 0);
+ ret = BCryptGenerateSymmetricKey(aes, &key, buf, len, secret, sizeof(secret), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
/* initialization vector is not allowed */
size = 0;
memcpy(ivbuf, iv, sizeof(iv));
- ret = pBCryptDecrypt(key, ciphertext5, 32, NULL, ivbuf, 16, plaintext, 32, &size, 0);
+ ret = BCryptDecrypt(key, ciphertext5, 32, NULL, ivbuf, 16, plaintext, 32, &size, 0);
ok(ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
/* input size is a multiple of block size */
size = 0;
- ret = pBCryptDecrypt(key, ciphertext5, 32, NULL, NULL, 16, NULL, 0, &size, 0);
+ ret = BCryptDecrypt(key, ciphertext5, 32, NULL, NULL, 16, NULL, 0, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
size = 0;
memset(plaintext, 0, sizeof(plaintext));
- ret = pBCryptDecrypt(key, ciphertext5, 32, NULL, NULL, 16, plaintext, 32, &size, 0);
+ ret = BCryptDecrypt(key, ciphertext5, 32, NULL, NULL, 16, plaintext, 32, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
ok(!memcmp(plaintext, expected, sizeof(expected)), "wrong data\n");
/* test with padding smaller than block size */
size = 0;
- ret = pBCryptDecrypt(key, ciphertext5, 32, NULL, NULL, 16, NULL, 0, &size, 0);
+ ret = BCryptDecrypt(key, ciphertext5, 32, NULL, NULL, 16, NULL, 0, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
size = 0;
memset(plaintext, 0, sizeof(plaintext));
- ret = pBCryptDecrypt(key, ciphertext5, 32, NULL, NULL, 16, plaintext, 17, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptDecrypt(key, ciphertext5, 32, NULL, NULL, 16, plaintext, 17, &size, BCRYPT_BLOCK_PADDING);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 17, "got %u\n", size);
ok(!memcmp(plaintext, expected2, sizeof(expected2)), "wrong data\n");
/* test with padding of block size */
size = 0;
- ret = pBCryptDecrypt(key, ciphertext6, 48, NULL, NULL, 16, NULL, 0, &size, 0);
+ ret = BCryptDecrypt(key, ciphertext6, 48, NULL, NULL, 16, NULL, 0, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 48, "got %u\n", size);
size = 0;
memset(plaintext, 0, sizeof(plaintext));
- ret = pBCryptDecrypt(key, ciphertext6, 48, NULL, NULL, 16, plaintext, 32, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptDecrypt(key, ciphertext6, 48, NULL, NULL, 16, plaintext, 32, &size, BCRYPT_BLOCK_PADDING);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
ok(!memcmp(plaintext, expected3, sizeof(expected3)), "wrong data\n");
/* output size too small */
size = 0;
- ret = pBCryptDecrypt(key, ciphertext4, 32, NULL, NULL, 16, plaintext, 31, &size, 0);
+ ret = BCryptDecrypt(key, ciphertext4, 32, NULL, NULL, 16, plaintext, 31, &size, 0);
ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
size = 0;
- ret = pBCryptDecrypt(key, ciphertext5, 32, NULL, NULL, 16, plaintext, 15, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptDecrypt(key, ciphertext5, 32, NULL, NULL, 16, plaintext, 15, &size, BCRYPT_BLOCK_PADDING);
ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
ok(size == 32, "got %u\n", size);
size = 0;
- ret = pBCryptDecrypt(key, ciphertext5, 32, NULL, NULL, 16, plaintext, 16, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptDecrypt(key, ciphertext5, 32, NULL, NULL, 16, plaintext, 16, &size, BCRYPT_BLOCK_PADDING);
ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
ok(size == 17, "got %u\n", size);
size = 0;
- ret = pBCryptDecrypt(key, ciphertext6, 48, NULL, NULL, 16, plaintext, 31, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptDecrypt(key, ciphertext6, 48, NULL, NULL, 16, plaintext, 31, &size, BCRYPT_BLOCK_PADDING);
ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
ok(size == 48, "got %u\n", size);
/* input size is not a multiple of block size */
size = 0;
- ret = pBCryptDecrypt(key, ciphertext4, 17, NULL, NULL, 16, NULL, 0, &size, 0);
+ ret = BCryptDecrypt(key, ciphertext4, 17, NULL, NULL, 16, NULL, 0, &size, 0);
ok(ret == STATUS_INVALID_BUFFER_SIZE, "got %08x\n", ret);
ok(size == 17 || broken(size == 0 /* Win < 7 */), "got %u\n", size);
/* input size is not a multiple of block size, block padding set */
size = 0;
- ret = pBCryptDecrypt(key, ciphertext4, 17, NULL, NULL, 16, NULL, 0, &size, BCRYPT_BLOCK_PADDING);
+ ret = BCryptDecrypt(key, ciphertext4, 17, NULL, NULL, 16, NULL, 0, &size, BCRYPT_BLOCK_PADDING);
ok(ret == STATUS_INVALID_BUFFER_SIZE, "got %08x\n", ret);
ok(size == 17 || broken(size == 0 /* Win < 7 */), "got %u\n", size);
- ret = pBCryptDestroyKey(key);
+ ret = BCryptDestroyKey(key);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
- ret = pBCryptDestroyKey(key);
+ ret = BCryptDestroyKey(key);
ok(ret == STATUS_INVALID_HANDLE, "got %08x\n", ret);
HeapFree(GetProcessHeap(), 0, buf);
- ret = pBCryptDestroyKey(NULL);
+ ret = BCryptDestroyKey(NULL);
ok(ret == STATUS_INVALID_HANDLE, "got %08x\n", ret);
- ret = pBCryptCloseAlgorithmProvider(aes, 0);
+ ret = BCryptCloseAlgorithmProvider(aes, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
- ret = pBCryptCloseAlgorithmProvider(aes, 0);
+ ret = BCryptCloseAlgorithmProvider(aes, 0);
ok(ret == STATUS_INVALID_HANDLE, "got %08x\n", ret);
- ret = pBCryptCloseAlgorithmProvider(NULL, 0);
+ ret = BCryptCloseAlgorithmProvider(NULL, 0);
ok(ret == STATUS_INVALID_HANDLE, "got %08x\n", ret);
}
@@ -1766,7 +1722,7 @@ static void test_key_import_export(void)
NTSTATUS ret;
ULONG size;
- ret = pBCryptOpenAlgorithmProvider(&aes, BCRYPT_AES_ALGORITHM, NULL, 0);
+ ret = BCryptOpenAlgorithmProvider(&aes, BCRYPT_AES_ALGORITHM, NULL, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
key_data1->dwMagic = BCRYPT_KEY_DATA_BLOB_MAGIC;
@@ -1775,7 +1731,7 @@ static void test_key_import_export(void)
memset(&key_data1[1], 0x11, 16);
key = NULL;
- ret = pBCryptImportKey(aes, NULL, BCRYPT_KEY_DATA_BLOB, &key, NULL, 0, buffer1, sizeof(buffer1), 0);
+ ret = BCryptImportKey(aes, NULL, BCRYPT_KEY_DATA_BLOB, &key, NULL, 0, buffer1, sizeof(buffer1), 0);
ok(ret == STATUS_SUCCESS || broken(ret == STATUS_INVALID_PARAMETER) /* vista */, "got %08x\n", ret);
if (ret == STATUS_INVALID_PARAMETER)
{
@@ -1785,40 +1741,40 @@ static void test_key_import_export(void)
ok(key != NULL, "key not set\n");
size = 0;
- ret = pBCryptExportKey(key, NULL, BCRYPT_KEY_DATA_BLOB, buffer2, 0, &size, 0);
+ ret = BCryptExportKey(key, NULL, BCRYPT_KEY_DATA_BLOB, buffer2, 0, &size, 0);
ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
ok(size == sizeof(buffer2), "got %u\n", size);
size = 0;
memset(buffer2, 0xff, sizeof(buffer2));
- ret = pBCryptExportKey(key, NULL, BCRYPT_KEY_DATA_BLOB, buffer2, sizeof(buffer2), &size, 0);
+ ret = BCryptExportKey(key, NULL, BCRYPT_KEY_DATA_BLOB, buffer2, sizeof(buffer2), &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == sizeof(buffer2), "Got %u\n", size);
ok(!memcmp(buffer1, buffer2, sizeof(buffer1)), "Expected exported key to match imported key\n");
/* opaque blob */
size = 0;
- ret = pBCryptExportKey(key, NULL, BCRYPT_OPAQUE_KEY_BLOB, buffer2, 0, &size, 0);
+ ret = BCryptExportKey(key, NULL, BCRYPT_OPAQUE_KEY_BLOB, buffer2, 0, &size, 0);
ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
ok(size > 0, "got zero\n");
buf = HeapAlloc(GetProcessHeap(), 0, size);
- ret = pBCryptExportKey(key, NULL, BCRYPT_OPAQUE_KEY_BLOB, buf, size, &size, 0);
+ ret = BCryptExportKey(key, NULL, BCRYPT_OPAQUE_KEY_BLOB, buf, size, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
- ret = pBCryptDestroyKey(key);
+ ret = BCryptDestroyKey(key);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
key = NULL;
- ret = pBCryptImportKey(aes, NULL, BCRYPT_OPAQUE_KEY_BLOB, &key, NULL, 0, buf, size, 0);
+ ret = BCryptImportKey(aes, NULL, BCRYPT_OPAQUE_KEY_BLOB, &key, NULL, 0, buf, size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(key != NULL, "key not set\n");
HeapFree(GetProcessHeap(), 0, buf);
- ret = pBCryptDestroyKey(key);
+ ret = BCryptDestroyKey(key);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
- ret = pBCryptCloseAlgorithmProvider(aes, 0);
+ ret = BCryptCloseAlgorithmProvider(aes, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
}
@@ -1867,7 +1823,7 @@ static void test_ECDSA(void)
NTSTATUS status;
ULONG size;
- status = pBCryptOpenAlgorithmProvider(&alg, BCRYPT_ECDSA_P256_ALGORITHM, NULL, 0);
+ status = BCryptOpenAlgorithmProvider(&alg, BCRYPT_ECDSA_P256_ALGORITHM, NULL, 0);
if (status)
{
skip("Failed to open ECDSA provider: %08x, skipping test\n", status);
@@ -1879,54 +1835,54 @@ static void test_ECDSA(void)
ecckey->cbKey = 2;
size = sizeof(BCRYPT_ECCKEY_BLOB) + sizeof(eccPubkey);
- status = pBCryptImportKeyPair(alg, NULL, BCRYPT_ECCPUBLIC_BLOB, &key, buffer, size, 0);
+ status = BCryptImportKeyPair(alg, NULL, BCRYPT_ECCPUBLIC_BLOB, &key, buffer, size, 0);
ok(status == STATUS_INVALID_PARAMETER, "Expected STATUS_INVALID_PARAMETER, got %08x\n", status);
ecckey->dwMagic = BCRYPT_ECDH_PUBLIC_P256_MAGIC;
ecckey->cbKey = 32;
- status = pBCryptImportKeyPair(alg, NULL, BCRYPT_ECCPUBLIC_BLOB, &key, buffer, size, 0);
+ status = BCryptImportKeyPair(alg, NULL, BCRYPT_ECCPUBLIC_BLOB, &key, buffer, size, 0);
ok(status == STATUS_INVALID_PARAMETER, "Expected STATUS_INVALID_PARAMETER, got %08x\n", status);
ecckey->dwMagic = BCRYPT_ECDSA_PUBLIC_P256_MAGIC;
ecckey->cbKey = 32;
- status = pBCryptImportKeyPair(alg, NULL, BCRYPT_ECCPUBLIC_BLOB, &key, buffer, size, 0);
+ status = BCryptImportKeyPair(alg, NULL, BCRYPT_ECCPUBLIC_BLOB, &key, buffer, size, 0);
ok(!status, "BCryptImportKeyPair failed: %08x\n", status);
- status = pBCryptVerifySignature(key, NULL, certHash, sizeof(certHash) - 1, certSignature, sizeof(certSignature), 0);
+ status = BCryptVerifySignature(key, NULL, certHash, sizeof(certHash) - 1, certSignature, sizeof(certSignature), 0);
ok(status == STATUS_INVALID_SIGNATURE, "Expected STATUS_INVALID_SIGNATURE, got %08x\n", status);
- status = pBCryptVerifySignature(key, NULL, certHash, sizeof(certHash), certSignature, sizeof(certSignature), 0);
+ status = BCryptVerifySignature(key, NULL, certHash, sizeof(certHash), certSignature, sizeof(certSignature), 0);
ok(!status, "BCryptVerifySignature failed: %08x\n", status);
- pBCryptDestroyKey(key);
+ BCryptDestroyKey(key);
ecckey->dwMagic = BCRYPT_ECDSA_PRIVATE_P256_MAGIC;
memcpy(ecckey + 1, eccPrivkey, sizeof(eccPrivkey));
ecckey->cbKey = 2;
size = sizeof(BCRYPT_ECCKEY_BLOB) + sizeof(eccPrivkey);
- status = pBCryptImportKeyPair(alg, NULL, BCRYPT_ECCPRIVATE_BLOB, &key, buffer, size, 0);
+ status = BCryptImportKeyPair(alg, NULL, BCRYPT_ECCPRIVATE_BLOB, &key, buffer, size, 0);
ok(status == STATUS_INVALID_PARAMETER, "Expected STATUS_INVALID_PARAMETER, got %08x\n", status);
ecckey->dwMagic = BCRYPT_ECDH_PRIVATE_P256_MAGIC;
ecckey->cbKey = 32;
- status = pBCryptImportKeyPair(alg, NULL, BCRYPT_ECCPRIVATE_BLOB, &key, buffer, size, 0);
+ status = BCryptImportKeyPair(alg, NULL, BCRYPT_ECCPRIVATE_BLOB, &key, buffer, size, 0);
ok(status == STATUS_INVALID_PARAMETER, "Expected STATUS_INVALID_PARAMETER, got %08x\n", status);
ecckey->dwMagic = BCRYPT_ECDSA_PRIVATE_P256_MAGIC;
ecckey->cbKey = 32;
- status = pBCryptImportKeyPair(alg, NULL, BCRYPT_ECCPRIVATE_BLOB, &key, buffer, size, 0);
+ status = BCryptImportKeyPair(alg, NULL, BCRYPT_ECCPRIVATE_BLOB, &key, buffer, size, 0);
ok(!status, "BCryptImportKeyPair failed: %08x\n", status);
memset( buffer, 0, sizeof(buffer) );
- status = pBCryptExportKey(key, NULL, BCRYPT_ECCPRIVATE_BLOB, buffer, size, &size, 0);
+ status = BCryptExportKey(key, NULL, BCRYPT_ECCPRIVATE_BLOB, buffer, size, &size, 0);
ok(status == STATUS_SUCCESS, "got %08x\n", status);
ecckey = (BCRYPT_ECCKEY_BLOB *)buffer;
ok(ecckey->dwMagic == BCRYPT_ECDSA_PRIVATE_P256_MAGIC, "got %08x\n", ecckey->dwMagic);
ok(ecckey->cbKey == 32, "got %u\n", ecckey->cbKey);
ok(size == sizeof(*ecckey) + ecckey->cbKey * 3, "got %u\n", size);
- pBCryptDestroyKey(key);
- pBCryptCloseAlgorithmProvider(alg, 0);
+ BCryptDestroyKey(key);
+ BCryptCloseAlgorithmProvider(alg, 0);
}
static UCHAR rsaPublicBlob[] =
@@ -2028,7 +1984,7 @@ static void test_RSA(void)
NTSTATUS ret;
BYTE *buf;
- ret = pBCryptOpenAlgorithmProvider(&alg, BCRYPT_RSA_ALGORITHM, NULL, 0);
+ ret = BCryptOpenAlgorithmProvider(&alg, BCRYPT_RSA_ALGORITHM, NULL, 0);
if (ret)
{
win_skip("Failed to open RSA provider: %08x, skipping test\n", ret);
@@ -2036,59 +1992,59 @@ static void test_RSA(void)
}
schemes = size = 0;
- ret = pBCryptGetProperty(alg, L"PaddingSchemes", (UCHAR *)&schemes, sizeof(schemes), &size, 0);
+ ret = BCryptGetProperty(alg, L"PaddingSchemes", (UCHAR *)&schemes, sizeof(schemes), &size, 0);
ok(!ret, "got %08x\n", ret);
ok(schemes, "schemes not set\n");
ok(size == sizeof(schemes), "got %u\n", size);
- ret = pBCryptImportKeyPair(alg, NULL, BCRYPT_RSAPUBLIC_BLOB, &key, rsaPublicBlob, sizeof(rsaPublicBlob), 0);
- ok(!ret, "pBCryptImportKeyPair failed: %08x\n", ret);
+ ret = BCryptImportKeyPair(alg, NULL, BCRYPT_RSAPUBLIC_BLOB, &key, rsaPublicBlob, sizeof(rsaPublicBlob), 0);
+ ok(!ret, "BCryptImportKeyPair failed: %08x\n", ret);
pad.pszAlgId = BCRYPT_SHA1_ALGORITHM;
- ret = pBCryptVerifySignature(key, &pad, rsaHash, sizeof(rsaHash), rsaSignature, sizeof(rsaSignature), BCRYPT_PAD_PKCS1);
- ok(!ret, "pBCryptVerifySignature failed: %08x\n", ret);
+ ret = BCryptVerifySignature(key, &pad, rsaHash, sizeof(rsaHash), rsaSignature, sizeof(rsaSignature), BCRYPT_PAD_PKCS1);
+ ok(!ret, "BCryptVerifySignature failed: %08x\n", ret);
- ret = pBCryptVerifySignature(key, NULL, rsaHash, sizeof(rsaHash), rsaSignature, sizeof(rsaSignature), BCRYPT_PAD_PKCS1);
+ ret = BCryptVerifySignature(key, NULL, rsaHash, sizeof(rsaHash), rsaSignature, sizeof(rsaSignature), BCRYPT_PAD_PKCS1);
ok(ret == STATUS_INVALID_PARAMETER, "Expected STATUS_INVALID_PARAMETER, got %08x\n", ret);
pad.pszAlgId = BCRYPT_SHA1_ALGORITHM;
- ret = pBCryptVerifySignature(key, &pad, rsaHash, sizeof(rsaHash), rsaSignature, sizeof(rsaSignature), 0);
+ ret = BCryptVerifySignature(key, &pad, rsaHash, sizeof(rsaHash), rsaSignature, sizeof(rsaSignature), 0);
ok(ret == STATUS_INVALID_PARAMETER, "Expected STATUS_INVALID_PARAMETER, got %08x\n", ret);
- ret = pBCryptVerifySignature(key, NULL, rsaHash, sizeof(rsaHash), rsaSignature, sizeof(rsaSignature), 0);
+ ret = BCryptVerifySignature(key, NULL, rsaHash, sizeof(rsaHash), rsaSignature, sizeof(rsaSignature), 0);
ok(ret == STATUS_INVALID_PARAMETER, "Expected STATUS_INVALID_PARAMETER, got %08x\n", ret);
pad.pszAlgId = BCRYPT_AES_ALGORITHM;
- ret = pBCryptVerifySignature(key, &pad, rsaHash, sizeof(rsaHash), rsaSignature, sizeof(rsaSignature), BCRYPT_PAD_PKCS1);
+ ret = BCryptVerifySignature(key, &pad, rsaHash, sizeof(rsaHash), rsaSignature, sizeof(rsaSignature), BCRYPT_PAD_PKCS1);
ok(ret == STATUS_NOT_SUPPORTED, "Expected STATUS_NOT_SUPPORTED, got %08x\n", ret);
pad.pszAlgId = NULL;
- ret = pBCryptVerifySignature(key, &pad, rsaHash, sizeof(rsaHash), rsaSignature, sizeof(rsaSignature), BCRYPT_PAD_PKCS1);
+ ret = BCryptVerifySignature(key, &pad, rsaHash, sizeof(rsaHash), rsaSignature, sizeof(rsaSignature), BCRYPT_PAD_PKCS1);
ok(ret == STATUS_INVALID_SIGNATURE, "Expected STATUS_INVALID_SIGNATURE, got %08x\n", ret);
- ret = pBCryptDestroyKey(key);
- ok(!ret, "pBCryptDestroyKey failed: %08x\n", ret);
+ ret = BCryptDestroyKey(key);
+ ok(!ret, "BCryptDestroyKey failed: %08x\n", ret);
/* sign/verify with export/import round-trip */
- ret = pBCryptGenerateKeyPair(alg, &key, 512, 0);
+ ret = BCryptGenerateKeyPair(alg, &key, 512, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
- ret = pBCryptFinalizeKeyPair(key, 0);
+ ret = BCryptFinalizeKeyPair(key, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
pad.pszAlgId = BCRYPT_SHA1_ALGORITHM;
memset(sig, 0, sizeof(sig));
- ret = pBCryptSignHash(key, &pad, hash, sizeof(hash), sig, sizeof(sig), &len, BCRYPT_PAD_PKCS1);
+ ret = BCryptSignHash(key, &pad, hash, sizeof(hash), sig, sizeof(sig), &len, BCRYPT_PAD_PKCS1);
ok(!ret, "got %08x\n", ret);
/* export private key */
size = 0;
- ret = pBCryptExportKey(key, NULL, BCRYPT_RSAPRIVATE_BLOB, NULL, 0, &size, 0);
+ ret = BCryptExportKey(key, NULL, BCRYPT_RSAPRIVATE_BLOB, NULL, 0, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size, "size not set\n");
buf = HeapAlloc(GetProcessHeap(), 0, size);
- ret = pBCryptExportKey(key, NULL, BCRYPT_RSAPRIVATE_BLOB, buf, size, &size, 0);
+ ret = BCryptExportKey(key, NULL, BCRYPT_RSAPRIVATE_BLOB, buf, size, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
rsablob = (BCRYPT_RSAKEY_BLOB *)buf;
ok(rsablob->Magic == BCRYPT_RSAPRIVATE_MAGIC, "got %08x\n", rsablob->Magic);
@@ -2102,12 +2058,12 @@ static void test_RSA(void)
HeapFree(GetProcessHeap(), 0, buf);
size = 0;
- ret = pBCryptExportKey(key, NULL, BCRYPT_RSAFULLPRIVATE_BLOB, NULL, 0, &size, 0);
+ ret = BCryptExportKey(key, NULL, BCRYPT_RSAFULLPRIVATE_BLOB, NULL, 0, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size, "size not set\n");
buf = HeapAlloc(GetProcessHeap(), 0, size);
- ret = pBCryptExportKey(key, NULL, BCRYPT_RSAFULLPRIVATE_BLOB, buf, size, &size, 0);
+ ret = BCryptExportKey(key, NULL, BCRYPT_RSAFULLPRIVATE_BLOB, buf, size, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
rsablob = (BCRYPT_RSAKEY_BLOB *)buf;
ok(rsablob->Magic == BCRYPT_RSAFULLPRIVATE_MAGIC, "got %08x\n", rsablob->Magic);
@@ -2122,12 +2078,12 @@ static void test_RSA(void)
/* export public key */
size = 0;
- ret = pBCryptExportKey(key, NULL, BCRYPT_RSAPUBLIC_BLOB, NULL, 0, &size, 0);
+ ret = BCryptExportKey(key, NULL, BCRYPT_RSAPUBLIC_BLOB, NULL, 0, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size, "size not set\n");
buf = HeapAlloc(GetProcessHeap(), 0, size);
- ret = pBCryptExportKey(key, NULL, BCRYPT_RSAPUBLIC_BLOB, buf, size, &size, 0);
+ ret = BCryptExportKey(key, NULL, BCRYPT_RSAPUBLIC_BLOB, buf, size, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
rsablob = (BCRYPT_RSAKEY_BLOB *)buf;
ok(rsablob->Magic == BCRYPT_RSAPUBLIC_MAGIC, "got %08x\n", rsablob->Magic);
@@ -2137,45 +2093,45 @@ static void test_RSA(void)
ok(!rsablob->cbPrime1, "got %u\n", rsablob->cbPrime1);
ok(!rsablob->cbPrime2, "got %u\n", rsablob->cbPrime2);
ok(size == sizeof(*rsablob) + rsablob->cbPublicExp + rsablob->cbModulus, "got %u\n", size);
- ret = pBCryptDestroyKey(key);
+ ret = BCryptDestroyKey(key);
ok(!ret, "got %08x\n", ret);
- ret = pBCryptImportKeyPair(alg, NULL, BCRYPT_RSAPUBLIC_BLOB, &key, buf, size, 0);
+ ret = BCryptImportKeyPair(alg, NULL, BCRYPT_RSAPUBLIC_BLOB, &key, buf, size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
HeapFree(GetProcessHeap(), 0, buf);
- ret = pBCryptVerifySignature(key, &pad, hash, sizeof(hash), sig, len, BCRYPT_PAD_PKCS1);
+ ret = BCryptVerifySignature(key, &pad, hash, sizeof(hash), sig, len, BCRYPT_PAD_PKCS1);
ok(!ret, "got %08x\n", ret);
- ret = pBCryptDestroyKey(key);
+ ret = BCryptDestroyKey(key);
ok(!ret, "got %08x\n", ret);
/* import/export private key */
- ret = pBCryptImportKeyPair(alg, NULL, BCRYPT_RSAPRIVATE_BLOB, &key, rsaPrivateBlob, sizeof(rsaPrivateBlob), 0);
+ ret = BCryptImportKeyPair(alg, NULL, BCRYPT_RSAPRIVATE_BLOB, &key, rsaPrivateBlob, sizeof(rsaPrivateBlob), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
size = 0;
buf = HeapAlloc(GetProcessHeap(), 0, sizeof(rsaPrivateBlob));
- ret = pBCryptExportKey(key, NULL, BCRYPT_RSAPRIVATE_BLOB, buf, sizeof(rsaPrivateBlob), &size, 0);
+ ret = BCryptExportKey(key, NULL, BCRYPT_RSAPRIVATE_BLOB, buf, sizeof(rsaPrivateBlob), &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == sizeof(rsaPrivateBlob), "got %u\n", size);
ok(!memcmp(buf, rsaPrivateBlob, size), "wrong data\n");
HeapFree(GetProcessHeap(), 0, buf);
- pBCryptDestroyKey(key);
+ BCryptDestroyKey(key);
/* import/export full private key */
- ret = pBCryptImportKeyPair(alg, NULL, BCRYPT_RSAFULLPRIVATE_BLOB, &key, rsaFullPrivateBlob, sizeof(rsaFullPrivateBlob), 0);
+ ret = BCryptImportKeyPair(alg, NULL, BCRYPT_RSAFULLPRIVATE_BLOB, &key, rsaFullPrivateBlob, sizeof(rsaFullPrivateBlob), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
size = 0;
buf = HeapAlloc(GetProcessHeap(), 0, sizeof(rsaFullPrivateBlob));
- ret = pBCryptExportKey(key, NULL, BCRYPT_RSAFULLPRIVATE_BLOB, buf, sizeof(rsaFullPrivateBlob), &size, 0);
+ ret = BCryptExportKey(key, NULL, BCRYPT_RSAFULLPRIVATE_BLOB, buf, sizeof(rsaFullPrivateBlob), &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == sizeof(rsaFullPrivateBlob), "got %u\n", size);
ok(!memcmp(buf, rsaFullPrivateBlob, size), "wrong data\n");
HeapFree(GetProcessHeap(), 0, buf);
- pBCryptDestroyKey(key);
+ BCryptDestroyKey(key);
- ret = pBCryptCloseAlgorithmProvider(alg, 0);
+ ret = BCryptCloseAlgorithmProvider(alg, 0);
ok(!ret, "got %08x\n", ret);
}
@@ -2189,55 +2145,55 @@ static void test_RSA_SIGN(void)
ULONG size, size2;
BYTE *buf;
- ret = pBCryptOpenAlgorithmProvider(&alg, BCRYPT_RSA_SIGN_ALGORITHM, NULL, 0);
+ ret = BCryptOpenAlgorithmProvider(&alg, BCRYPT_RSA_SIGN_ALGORITHM, NULL, 0);
if (ret)
{
win_skip("Failed to open RSA_SIGN provider: %08x, skipping test\n", ret);
return;
}
- ret = pBCryptImportKeyPair(alg, NULL, BCRYPT_RSAPUBLIC_BLOB, &key, rsaPublicBlob, sizeof(rsaPublicBlob), 0);
- ok(!ret, "pBCryptImportKeyPair failed: %08x\n", ret);
+ ret = BCryptImportKeyPair(alg, NULL, BCRYPT_RSAPUBLIC_BLOB, &key, rsaPublicBlob, sizeof(rsaPublicBlob), 0);
+ ok(!ret, "BCryptImportKeyPair failed: %08x\n", ret);
pad.pszAlgId = BCRYPT_SHA1_ALGORITHM;
- ret = pBCryptVerifySignature(key, &pad, rsaHash, sizeof(rsaHash), rsaSignature, sizeof(rsaSignature), BCRYPT_PAD_PKCS1);
- ok(!ret, "pBCryptVerifySignature failed: %08x\n", ret);
+ ret = BCryptVerifySignature(key, &pad, rsaHash, sizeof(rsaHash), rsaSignature, sizeof(rsaSignature), BCRYPT_PAD_PKCS1);
+ ok(!ret, "BCryptVerifySignature failed: %08x\n", ret);
- ret = pBCryptVerifySignature(key, NULL, rsaHash, sizeof(rsaHash), rsaSignature, sizeof(rsaSignature), BCRYPT_PAD_PKCS1);
+ ret = BCryptVerifySignature(key, NULL, rsaHash, sizeof(rsaHash), rsaSignature, sizeof(rsaSignature), BCRYPT_PAD_PKCS1);
ok(ret == STATUS_INVALID_PARAMETER, "Expected STATUS_INVALID_PARAMETER, got %08x\n", ret);
pad.pszAlgId = BCRYPT_SHA1_ALGORITHM;
- ret = pBCryptVerifySignature(key, &pad, rsaHash, sizeof(rsaHash), rsaSignature, sizeof(rsaSignature), 0);
+ ret = BCryptVerifySignature(key, &pad, rsaHash, sizeof(rsaHash), rsaSignature, sizeof(rsaSignature), 0);
ok(ret == STATUS_INVALID_PARAMETER, "Expected STATUS_INVALID_PARAMETER, got %08x\n", ret);
- ret = pBCryptVerifySignature(key, NULL, rsaHash, sizeof(rsaHash), rsaSignature, sizeof(rsaSignature), 0);
+ ret = BCryptVerifySignature(key, NULL, rsaHash, sizeof(rsaHash), rsaSignature, sizeof(rsaSignature), 0);
ok(ret == STATUS_INVALID_PARAMETER, "Expected STATUS_INVALID_PARAMETER, got %08x\n", ret);
pad.pszAlgId = BCRYPT_AES_ALGORITHM;
- ret = pBCryptVerifySignature(key, &pad, rsaHash, sizeof(rsaHash), rsaSignature, sizeof(rsaSignature), BCRYPT_PAD_PKCS1);
+ ret = BCryptVerifySignature(key, &pad, rsaHash, sizeof(rsaHash), rsaSignature, sizeof(rsaSignature), BCRYPT_PAD_PKCS1);
ok(ret == STATUS_NOT_SUPPORTED, "Expected STATUS_NOT_SUPPORTED, got %08x\n", ret);
pad.pszAlgId = NULL;
- ret = pBCryptVerifySignature(key, &pad, rsaHash, sizeof(rsaHash), rsaSignature, sizeof(rsaSignature), BCRYPT_PAD_PKCS1);
+ ret = BCryptVerifySignature(key, &pad, rsaHash, sizeof(rsaHash), rsaSignature, sizeof(rsaSignature), BCRYPT_PAD_PKCS1);
ok(ret == STATUS_INVALID_SIGNATURE, "Expected STATUS_INVALID_SIGNATURE, got %08x\n", ret);
- ret = pBCryptDestroyKey(key);
- ok(!ret, "pBCryptDestroyKey failed: %08x\n", ret);
+ ret = BCryptDestroyKey(key);
+ ok(!ret, "BCryptDestroyKey failed: %08x\n", ret);
/* export private key */
- ret = pBCryptGenerateKeyPair(alg, &key, 512, 0);
+ ret = BCryptGenerateKeyPair(alg, &key, 512, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
- ret = pBCryptFinalizeKeyPair(key, 0);
+ ret = BCryptFinalizeKeyPair(key, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
size = 0;
- ret = pBCryptExportKey(key, NULL, BCRYPT_RSAPRIVATE_BLOB, NULL, 0, &size, 0);
+ ret = BCryptExportKey(key, NULL, BCRYPT_RSAPRIVATE_BLOB, NULL, 0, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size, "size not set\n");
buf = HeapAlloc(GetProcessHeap(), 0, size);
- ret = pBCryptExportKey(key, NULL, BCRYPT_RSAPRIVATE_BLOB, buf, size, &size, 0);
+ ret = BCryptExportKey(key, NULL, BCRYPT_RSAPRIVATE_BLOB, buf, size, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
rsablob = (BCRYPT_RSAKEY_BLOB *)buf;
ok(rsablob->Magic == BCRYPT_RSAPRIVATE_MAGIC, "got %08x\n", rsablob->Magic);
@@ -2251,12 +2207,12 @@ static void test_RSA_SIGN(void)
HeapFree(GetProcessHeap(), 0, buf);
size = 0;
- ret = pBCryptExportKey(key, NULL, BCRYPT_RSAFULLPRIVATE_BLOB, NULL, 0, &size, 0);
+ ret = BCryptExportKey(key, NULL, BCRYPT_RSAFULLPRIVATE_BLOB, NULL, 0, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size, "size not set\n");
buf = HeapAlloc(GetProcessHeap(), 0, size);
- ret = pBCryptExportKey(key, NULL, BCRYPT_RSAFULLPRIVATE_BLOB, buf, size, &size, 0);
+ ret = BCryptExportKey(key, NULL, BCRYPT_RSAFULLPRIVATE_BLOB, buf, size, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
rsablob = (BCRYPT_RSAKEY_BLOB *)buf;
ok(rsablob->Magic == BCRYPT_RSAFULLPRIVATE_MAGIC, "got %08x\n", rsablob->Magic);
@@ -2268,10 +2224,10 @@ static void test_RSA_SIGN(void)
size2 = sizeof(*rsablob) + rsablob->cbPublicExp + rsablob->cbModulus * 2 + rsablob->cbPrime1 * 3 + rsablob->cbPrime2 * 2;
ok(size == size2, "got %u expected %u\n", size2, size);
HeapFree(GetProcessHeap(), 0, buf);
- pBCryptDestroyKey(key);
+ BCryptDestroyKey(key);
- ret = pBCryptCloseAlgorithmProvider(alg, 0);
- ok(!ret, "pBCryptCloseAlgorithmProvider failed: %08x\n", ret);
+ ret = BCryptCloseAlgorithmProvider(alg, 0);
+ ok(!ret, "BCryptCloseAlgorithmProvider failed: %08x\n", ret);
}
static BYTE eccprivkey[] =
@@ -2333,7 +2289,7 @@ static void test_ECDH(void)
NTSTATUS status;
ULONG size;
- status = pBCryptOpenAlgorithmProvider(&alg, BCRYPT_ECDH_P256_ALGORITHM, NULL, 0);
+ status = BCryptOpenAlgorithmProvider(&alg, BCRYPT_ECDH_P256_ALGORITHM, NULL, 0);
if (status)
{
skip("Failed to open BCRYPT_ECDH_P256_ALGORITHM provider %08x\n", status);
@@ -2341,69 +2297,69 @@ static void test_ECDH(void)
}
key = NULL;
- status = pBCryptGenerateKeyPair(alg, &key, 256, 0);
+ status = BCryptGenerateKeyPair(alg, &key, 256, 0);
ok(status == STATUS_SUCCESS, "got %08x\n", status);
ok(key != NULL, "key not set\n");
- status = pBCryptFinalizeKeyPair(key, 0);
+ status = BCryptFinalizeKeyPair(key, 0);
ok(status == STATUS_SUCCESS, "got %08x\n", status);
size = 0;
- status = pBCryptExportKey(key, NULL, BCRYPT_ECCPUBLIC_BLOB, NULL, 0, &size, 0);
+ status = BCryptExportKey(key, NULL, BCRYPT_ECCPUBLIC_BLOB, NULL, 0, &size, 0);
ok(status == STATUS_SUCCESS, "got %08x\n", status);
ok(size, "size not set\n");
buf = HeapAlloc(GetProcessHeap(), 0, size);
- status = pBCryptExportKey(key, NULL, BCRYPT_ECCPUBLIC_BLOB, buf, size, &size, 0);
+ status = BCryptExportKey(key, NULL, BCRYPT_ECCPUBLIC_BLOB, buf, size, &size, 0);
ok(status == STATUS_SUCCESS, "got %08x\n", status);
ecckey = (BCRYPT_ECCKEY_BLOB *)buf;
ok(ecckey->dwMagic == BCRYPT_ECDH_PUBLIC_P256_MAGIC, "got %08x\n", ecckey->dwMagic);
ok(ecckey->cbKey == 32, "got %u\n", ecckey->cbKey);
ok(size == sizeof(*ecckey) + ecckey->cbKey * 2, "got %u\n", size);
- status = pBCryptImportKeyPair(alg, NULL, BCRYPT_ECCPUBLIC_BLOB, &pubkey, buf, size, 0);
+ status = BCryptImportKeyPair(alg, NULL, BCRYPT_ECCPUBLIC_BLOB, &pubkey, buf, size, 0);
ok(status == STATUS_SUCCESS, "got %08x\n", status);
HeapFree(GetProcessHeap(), 0, buf);
size = 0;
- status = pBCryptExportKey(key, NULL, BCRYPT_ECCPRIVATE_BLOB, NULL, 0, &size, 0);
+ status = BCryptExportKey(key, NULL, BCRYPT_ECCPRIVATE_BLOB, NULL, 0, &size, 0);
ok(status == STATUS_SUCCESS, "got %08x\n", status);
ok(size, "size not set\n");
buf = HeapAlloc(GetProcessHeap(), 0, size);
- status = pBCryptExportKey(key, NULL, BCRYPT_ECCPRIVATE_BLOB, buf, size, &size, 0);
+ status = BCryptExportKey(key, NULL, BCRYPT_ECCPRIVATE_BLOB, buf, size, &size, 0);
ok(status == STATUS_SUCCESS, "got %08x\n", status);
ecckey = (BCRYPT_ECCKEY_BLOB *)buf;
ok(ecckey->dwMagic == BCRYPT_ECDH_PRIVATE_P256_MAGIC, "got %08x\n", ecckey->dwMagic);
ok(ecckey->cbKey == 32, "got %u\n", ecckey->cbKey);
ok(size == sizeof(*ecckey) + ecckey->cbKey * 3, "got %u\n", size);
- status = pBCryptImportKeyPair(alg, NULL, BCRYPT_ECCPRIVATE_BLOB, &privkey, buf, size, 0);
+ status = BCryptImportKeyPair(alg, NULL, BCRYPT_ECCPRIVATE_BLOB, &privkey, buf, size, 0);
ok(status == STATUS_SUCCESS, "got %08x\n", status);
HeapFree(GetProcessHeap(), 0, buf);
- pBCryptDestroyKey(pubkey);
- pBCryptDestroyKey(privkey);
- pBCryptDestroyKey(key);
+ BCryptDestroyKey(pubkey);
+ BCryptDestroyKey(privkey);
+ BCryptDestroyKey(key);
- status = pBCryptImportKeyPair(alg, NULL, BCRYPT_ECCPRIVATE_BLOB, &privkey, eccprivkey, sizeof(eccprivkey), 0);
+ status = BCryptImportKeyPair(alg, NULL, BCRYPT_ECCPRIVATE_BLOB, &privkey, eccprivkey, sizeof(eccprivkey), 0);
ok(status == STATUS_SUCCESS, "got %08x\n", status);
size = 0;
- status = pBCryptExportKey(privkey, NULL, BCRYPT_ECCPRIVATE_BLOB, NULL, 0, &size, 0);
+ status = BCryptExportKey(privkey, NULL, BCRYPT_ECCPRIVATE_BLOB, NULL, 0, &size, 0);
ok(status == STATUS_SUCCESS, "got %08x\n", status);
ok(size, "size not set\n");
buf = HeapAlloc(GetProcessHeap(), 0, size);
- status = pBCryptExportKey(privkey, NULL, BCRYPT_ECCPRIVATE_BLOB, buf, size, &size, 0);
+ status = BCryptExportKey(privkey, NULL, BCRYPT_ECCPRIVATE_BLOB, buf, size, &size, 0);
ok(status == STATUS_SUCCESS, "got %08x\n", status);
ok(size == sizeof(eccprivkey), "got %u\n", size);
ok(!memcmp(buf, eccprivkey, size), "wrong data\n");
HeapFree(GetProcessHeap(), 0, buf);
- status = pBCryptImportKeyPair(alg, NULL, BCRYPT_ECCPUBLIC_BLOB, &pubkey, ecdh_pubkey, sizeof(ecdh_pubkey), 0);
+ status = BCryptImportKeyPair(alg, NULL, BCRYPT_ECCPUBLIC_BLOB, &pubkey, ecdh_pubkey, sizeof(ecdh_pubkey), 0);
ok(status == STATUS_SUCCESS, "got %08x\n", status);
- status = pBCryptSecretAgreement(privkey, pubkey, &secret, 0);
+ status = BCryptSecretAgreement(privkey, pubkey, &secret, 0);
ok(status == STATUS_SUCCESS, "got %08x\n", status);
if (status != STATUS_SUCCESS)
@@ -2412,7 +2368,7 @@ static void test_ECDH(void)
}
/* verify result on windows 10 */
- status = pBCryptDeriveKey(secret, BCRYPT_KDF_RAW_SECRET, NULL, NULL, 0, &size, 0);
+ status = BCryptDeriveKey(secret, BCRYPT_KDF_RAW_SECRET, NULL, NULL, 0, &size, 0);
if (status == STATUS_NOT_SUPPORTED)
{
@@ -2429,14 +2385,14 @@ static void test_ECDH(void)
ok(size == 32, "size of secret key incorrect, got %u, expected 32\n", size);
buf = HeapAlloc(GetProcessHeap(), 0, size);
- status = pBCryptDeriveKey(secret, BCRYPT_KDF_RAW_SECRET, NULL, buf, size, &size, 0);
+ status = BCryptDeriveKey(secret, BCRYPT_KDF_RAW_SECRET, NULL, buf, size, &size, 0);
ok(status == STATUS_SUCCESS, "got %08x\n", status);
ok(!(memcmp(ecdh_secret, buf, size)), "wrong data\n");
HeapFree(GetProcessHeap(), 0, buf);
raw_secret_end:
- status = pBCryptDeriveKey(secret, BCRYPT_KDF_HASH, &hash_params, NULL, 0, &size, 0);
+ status = BCryptDeriveKey(secret, BCRYPT_KDF_HASH, &hash_params, NULL, 0, &size, 0);
todo_wine ok (status == STATUS_SUCCESS, "got %08x\n", status);
if (status != STATUS_SUCCESS)
@@ -2446,34 +2402,34 @@ static void test_ECDH(void)
ok (size == 20, "got %u\n", size);
buf = HeapAlloc(GetProcessHeap(), 0, size);
- status = pBCryptDeriveKey(secret, BCRYPT_KDF_HASH, &hash_params, buf, size, &size, 0);
+ status = BCryptDeriveKey(secret, BCRYPT_KDF_HASH, &hash_params, buf, size, &size, 0);
ok(status == STATUS_SUCCESS, "got %08x\n", status);
ok(!(memcmp(hashed_secret, buf, size)), "wrong data\n");
HeapFree(GetProcessHeap(), 0, buf);
/* ulVersion is not verified */
hash_params.ulVersion = 0xdeadbeef;
- status = pBCryptDeriveKey(secret, BCRYPT_KDF_HASH, &hash_params, NULL, 0, &size, 0);
+ status = BCryptDeriveKey(secret, BCRYPT_KDF_HASH, &hash_params, NULL, 0, &size, 0);
ok (status == STATUS_SUCCESS, "got %08x\n", status);
hash_params.ulVersion = BCRYPTBUFFER_VERSION;
hash_param_buffers[0].pvBuffer = (void*) L"INVALID";
hash_param_buffers[0].cbBuffer = sizeof(L"INVALID");
- status = pBCryptDeriveKey(secret, BCRYPT_KDF_HASH, &hash_params, NULL, 0, &size, 0);
+ status = BCryptDeriveKey(secret, BCRYPT_KDF_HASH, &hash_params, NULL, 0, &size, 0);
ok (status == STATUS_NOT_SUPPORTED || broken (status == STATUS_NOT_FOUND) /* < win8 */, "got %08x\n", status);
hash_param_buffers[0].pvBuffer = (void*) BCRYPT_RNG_ALGORITHM;
hash_param_buffers[0].cbBuffer = sizeof(BCRYPT_RNG_ALGORITHM);
- status = pBCryptDeriveKey(secret, BCRYPT_KDF_HASH, &hash_params, NULL, 0, &size, 0);
+ status = BCryptDeriveKey(secret, BCRYPT_KDF_HASH, &hash_params, NULL, 0, &size, 0);
ok (status == STATUS_NOT_SUPPORTED, "got %08x\n", status);
derive_end:
- pBCryptDestroySecret(secret);
- pBCryptDestroyKey(pubkey);
- pBCryptDestroyKey(privkey);
- pBCryptCloseAlgorithmProvider(alg, 0);
+ BCryptDestroySecret(secret);
+ BCryptDestroyKey(pubkey);
+ BCryptDestroyKey(privkey);
+ BCryptCloseAlgorithmProvider(alg, 0);
}
static void test_BCryptEnumContextFunctions(void)
@@ -2483,9 +2439,9 @@ static void test_BCryptEnumContextFunctions(void)
ULONG buflen;
buffer = NULL;
- status = pBCryptEnumContextFunctions( CRYPT_LOCAL, L"SSL", NCRYPT_SCHANNEL_INTERFACE, &buflen, &buffer );
+ status = BCryptEnumContextFunctions( CRYPT_LOCAL, L"SSL", NCRYPT_SCHANNEL_INTERFACE, &buflen, &buffer );
todo_wine ok( status == STATUS_SUCCESS, "got %08x\n", status);
- if (status == STATUS_SUCCESS) pBCryptFreeBuffer( buffer );
+ if (status == STATUS_SUCCESS) BCryptFreeBuffer( buffer );
}
static BYTE rsapublic[] =
@@ -2523,7 +2479,7 @@ static void test_BCryptSignHash(void)
ULONG len;
/* RSA */
- ret = pBCryptOpenAlgorithmProvider(&alg, BCRYPT_RSA_ALGORITHM, NULL, 0);
+ ret = BCryptOpenAlgorithmProvider(&alg, BCRYPT_RSA_ALGORITHM, NULL, 0);
if (ret)
{
win_skip("failed to open RSA provider: %08x\n", ret);
@@ -2531,83 +2487,83 @@ static void test_BCryptSignHash(void)
}
/* public key */
- ret = pBCryptImportKeyPair(alg, NULL, BCRYPT_RSAPUBLIC_BLOB, &key, rsapublic, sizeof(rsapublic), 0);
+ ret = BCryptImportKeyPair(alg, NULL, BCRYPT_RSAPUBLIC_BLOB, &key, rsapublic, sizeof(rsapublic), 0);
ok(!ret, "got %08x\n", ret);
len = 0;
pad.pszAlgId = BCRYPT_SHA1_ALGORITHM;
- ret = pBCryptSignHash(key, &pad, NULL, 0, NULL, 0, &len, BCRYPT_PAD_PKCS1);
+ ret = BCryptSignHash(key, &pad, NULL, 0, NULL, 0, &len, BCRYPT_PAD_PKCS1);
ok(!ret, "got %08x\n", ret);
ok(len == 256, "got %u\n", len);
len = 0;
- ret = pBCryptSignHash(key, &pad, hash, sizeof(hash), sig, sizeof(sig), &len, BCRYPT_PAD_PKCS1);
+ ret = BCryptSignHash(key, &pad, hash, sizeof(hash), sig, sizeof(sig), &len, BCRYPT_PAD_PKCS1);
ok(ret == STATUS_INVALID_PARAMETER || broken(ret == STATUS_INTERNAL_ERROR) /* < win7 */, "got %08x\n", ret);
- ret = pBCryptDestroyKey(key);
+ ret = BCryptDestroyKey(key);
ok(!ret, "got %08x\n", ret);
- ret = pBCryptGenerateKeyPair(alg, &key, 512, 0);
+ ret = BCryptGenerateKeyPair(alg, &key, 512, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
- ret = pBCryptFinalizeKeyPair(key, 0);
+ ret = BCryptFinalizeKeyPair(key, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
len = 0;
memset(sig, 0, sizeof(sig));
/* inference of padding info on RSA not supported */
- ret = pBCryptSignHash(key, NULL, hash, sizeof(hash), sig, sizeof(sig), &len, 0);
+ ret = BCryptSignHash(key, NULL, hash, sizeof(hash), sig, sizeof(sig), &len, 0);
ok(ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret);
- ret = pBCryptSignHash(key, &pad, hash, sizeof(hash), sig, 0, &len, BCRYPT_PAD_PKCS1);
+ ret = BCryptSignHash(key, &pad, hash, sizeof(hash), sig, 0, &len, BCRYPT_PAD_PKCS1);
ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
- ret = pBCryptSignHash(key, &pad, hash, sizeof(hash), sig, sizeof(sig), &len, BCRYPT_PAD_PKCS1);
+ ret = BCryptSignHash(key, &pad, hash, sizeof(hash), sig, sizeof(sig), &len, BCRYPT_PAD_PKCS1);
ok(!ret, "got %08x\n", ret);
ok(len == 64, "got %u\n", len);
- ret = pBCryptVerifySignature(key, &pad, hash, sizeof(hash), sig, len, BCRYPT_PAD_PKCS1);
+ ret = BCryptVerifySignature(key, &pad, hash, sizeof(hash), sig, len, BCRYPT_PAD_PKCS1);
ok(!ret, "got %08x\n", ret);
- ret = pBCryptDestroyKey(key);
+ ret = BCryptDestroyKey(key);
ok(!ret, "got %08x\n", ret);
- ret = pBCryptCloseAlgorithmProvider(alg, 0);
+ ret = BCryptCloseAlgorithmProvider(alg, 0);
ok(!ret, "got %08x\n", ret);
/* ECDSA */
- ret = pBCryptOpenAlgorithmProvider(&alg, BCRYPT_ECDSA_P256_ALGORITHM, NULL, 0);
+ ret = BCryptOpenAlgorithmProvider(&alg, BCRYPT_ECDSA_P256_ALGORITHM, NULL, 0);
if (ret)
{
win_skip("failed to open ECDSA provider: %08x\n", ret);
return;
}
- ret = pBCryptGenerateKeyPair(alg, &key, 256, 0);
+ ret = BCryptGenerateKeyPair(alg, &key, 256, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
- ret = pBCryptFinalizeKeyPair(key, 0);
+ ret = BCryptFinalizeKeyPair(key, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
memset(sig, 0, sizeof(sig));
len = 0;
/* automatically detects padding info */
- ret = pBCryptSignHash(key, NULL, hash, sizeof(hash), sig, sizeof(sig), &len, 0);
+ ret = BCryptSignHash(key, NULL, hash, sizeof(hash), sig, sizeof(sig), &len, 0);
ok (!ret, "got %08x\n", ret);
ok (len == 64, "got %u\n", len);
- ret = pBCryptVerifySignature(key, NULL, hash, sizeof(hash), sig, len, 0);
+ ret = BCryptVerifySignature(key, NULL, hash, sizeof(hash), sig, len, 0);
ok(!ret, "got %08x\n", ret);
/* mismatch info (SHA-1 != SHA-256) */
- ret = pBCryptSignHash(key, &pad, hash_sha256, sizeof(hash_sha256), sig, sizeof(sig), &len, BCRYPT_PAD_PKCS1);
+ ret = BCryptSignHash(key, &pad, hash_sha256, sizeof(hash_sha256), sig, sizeof(sig), &len, BCRYPT_PAD_PKCS1);
ok (ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret);
- ret = pBCryptDestroyKey(key);
+ ret = BCryptDestroyKey(key);
ok(!ret, "got %08x\n", ret);
- ret = pBCryptCloseAlgorithmProvider(alg, 0);
+ ret = BCryptCloseAlgorithmProvider(alg, 0);
ok(!ret, "got %08x\n", ret);
}
@@ -2617,25 +2573,25 @@ static void test_BCryptEnumAlgorithms(void)
NTSTATUS ret;
ULONG count;
- ret = pBCryptEnumAlgorithms(0, NULL, NULL, 0);
+ ret = BCryptEnumAlgorithms(0, NULL, NULL, 0);
ok(ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret);
- ret = pBCryptEnumAlgorithms(0, &count, NULL, 0);
+ ret = BCryptEnumAlgorithms(0, &count, NULL, 0);
ok(ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret);
- ret = pBCryptEnumAlgorithms(0, NULL, &list, 0);
+ ret = BCryptEnumAlgorithms(0, NULL, &list, 0);
ok(ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret);
- ret = pBCryptEnumAlgorithms(~0u, &count, &list, 0);
+ ret = BCryptEnumAlgorithms(~0u, &count, &list, 0);
ok(ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret);
count = 0;
list = NULL;
- ret = pBCryptEnumAlgorithms(0, &count, &list, 0);
+ ret = BCryptEnumAlgorithms(0, &count, &list, 0);
ok(!ret, "got %08x\n", ret);
ok(list != NULL, "NULL list\n");
ok(count, "got %u\n", count);
- pBCryptFreeBuffer( list );
+ BCryptFreeBuffer( list );
}
static void test_aes_vector(void)
@@ -2653,11 +2609,11 @@ static void test_aes_vector(void)
ULONG size;
NTSTATUS ret;
- ret = pBCryptOpenAlgorithmProvider(&alg, BCRYPT_AES_ALGORITHM, NULL, 0);
+ ret = BCryptOpenAlgorithmProvider(&alg, BCRYPT_AES_ALGORITHM, NULL, 0);
ok(!ret, "got %08x\n", ret);
size = sizeof(BCRYPT_CHAIN_MODE_CBC);
- ret = pBCryptSetProperty(alg, BCRYPT_CHAINING_MODE, (UCHAR *)BCRYPT_CHAIN_MODE_CBC, size, 0);
+ ret = BCryptSetProperty(alg, BCRYPT_CHAINING_MODE, (UCHAR *)BCRYPT_CHAIN_MODE_CBC, size, 0);
ok(!ret, "got %08x\n", ret);
blob->dwMagic = BCRYPT_KEY_DATA_BLOB_MAGIC;
@@ -2665,19 +2621,19 @@ static void test_aes_vector(void)
blob->cbKeyData = sizeof(secret);
memcpy(data + sizeof(*blob), secret, sizeof(secret));
size = sizeof(BCRYPT_KEY_DATA_BLOB_HEADER) + sizeof(secret);
- ret = pBCryptImportKey(alg, NULL, BCRYPT_KEY_DATA_BLOB, &key, NULL, 0, data, size, 0);
+ ret = BCryptImportKey(alg, NULL, BCRYPT_KEY_DATA_BLOB, &key, NULL, 0, data, size, 0);
ok(!ret || broken(ret == STATUS_INVALID_PARAMETER) /* vista */, "got %08x\n", ret);
if (ret == STATUS_INVALID_PARAMETER)
{
win_skip("broken BCryptImportKey\n");
- pBCryptCloseAlgorithmProvider(alg, 0);
+ BCryptCloseAlgorithmProvider(alg, 0);
return;
}
/* zero initialization vector */
size = 0;
memset(output, 0, sizeof(output));
- ret = pBCryptEncrypt(key, input, sizeof(input), NULL, iv, sizeof(iv), output, sizeof(output), &size, 0);
+ ret = BCryptEncrypt(key, input, sizeof(input), NULL, iv, sizeof(iv), output, sizeof(output), &size, 0);
ok(!ret, "got %08x\n", ret);
ok(size == 16, "got %u\n", size);
ok(!memcmp(output, expect, sizeof(expect)), "wrong cipher text\n");
@@ -2685,7 +2641,7 @@ static void test_aes_vector(void)
/* same initialization vector */
size = 0;
memset(output, 0, sizeof(output));
- ret = pBCryptEncrypt(key, input, sizeof(input), NULL, iv, sizeof(iv), output, sizeof(output), &size, 0);
+ ret = BCryptEncrypt(key, input, sizeof(input), NULL, iv, sizeof(iv), output, sizeof(output), &size, 0);
ok(!ret, "got %08x\n", ret);
ok(size == 16, "got %u\n", size);
ok(!memcmp(output, expect2, sizeof(expect2)), "wrong cipher text\n");
@@ -2694,15 +2650,15 @@ static void test_aes_vector(void)
iv[0] = 0x1;
size = 0;
memset(output, 0, sizeof(output));
- ret = pBCryptEncrypt(key, input, sizeof(input), NULL, iv, sizeof(iv), output, sizeof(output), &size, 0);
+ ret = BCryptEncrypt(key, input, sizeof(input), NULL, iv, sizeof(iv), output, sizeof(output), &size, 0);
ok(!ret, "got %08x\n", ret);
ok(size == 16, "got %u\n", size);
todo_wine ok(!memcmp(output, expect3, sizeof(expect3)), "wrong cipher text\n");
- ret = pBCryptDestroyKey(key);
+ ret = BCryptDestroyKey(key);
ok(!ret, "got %08x\n", ret);
- ret = pBCryptCloseAlgorithmProvider(alg, 0);
+ ret = BCryptCloseAlgorithmProvider(alg, 0);
ok(!ret, "got %08x\n", ret);
}
@@ -2718,10 +2674,10 @@ static void test_BcryptDeriveKeyCapi(void)
UCHAR key[40];
NTSTATUS ret;
- ret = pBCryptOpenAlgorithmProvider(&alg, BCRYPT_SHA1_ALGORITHM, NULL, 0);
+ ret = BCryptOpenAlgorithmProvider(&alg, BCRYPT_SHA1_ALGORITHM, NULL, 0);
ok(!ret, "got %08x\n", ret);
- ret = pBCryptCreateHash(alg, &hash, NULL, 0, NULL, 0, 0);
+ ret = BCryptCreateHash(alg, &hash, NULL, 0, NULL, 0, 0);
ok(!ret || broken(ret == STATUS_INVALID_PARAMETER) /* win2k8 */, "got %08x\n", ret);
if (ret == STATUS_INVALID_PARAMETER)
{
@@ -2729,66 +2685,66 @@ static void test_BcryptDeriveKeyCapi(void)
return;
}
- ret = pBCryptDeriveKeyCapi(NULL, NULL, NULL, 0, 0);
+ ret = BCryptDeriveKeyCapi(NULL, NULL, NULL, 0, 0);
ok(ret == STATUS_INVALID_PARAMETER || ret == STATUS_INVALID_HANDLE /* win7 */, "got %08x\n", ret);
- ret = pBCryptDeriveKeyCapi(hash, NULL, NULL, 0, 0);
+ ret = BCryptDeriveKeyCapi(hash, NULL, NULL, 0, 0);
ok(ret == STATUS_INVALID_PARAMETER || !ret /* win7 */, "got %08x\n", ret);
- ret = pBCryptDestroyHash(hash);
+ ret = BCryptDestroyHash(hash);
ok(!ret, "got %08x\n", ret);
- ret = pBCryptCreateHash(alg, &hash, NULL, 0, NULL, 0, 0);
+ ret = BCryptCreateHash(alg, &hash, NULL, 0, NULL, 0, 0);
ok(!ret, "got %08x\n", ret);
- ret = pBCryptDeriveKeyCapi(hash, NULL, key, 0, 0);
+ ret = BCryptDeriveKeyCapi(hash, NULL, key, 0, 0);
ok(ret == STATUS_INVALID_PARAMETER || !ret /* win7 */, "got %08x\n", ret);
- ret = pBCryptDestroyHash(hash);
+ ret = BCryptDestroyHash(hash);
ok(!ret, "got %08x\n", ret);
- ret = pBCryptCreateHash(alg, &hash, NULL, 0, NULL, 0, 0);
+ ret = BCryptCreateHash(alg, &hash, NULL, 0, NULL, 0, 0);
ok(!ret, "got %08x\n", ret);
memset(key, 0, sizeof(key));
- ret = pBCryptDeriveKeyCapi(hash, NULL, key, 41, 0);
+ ret = BCryptDeriveKeyCapi(hash, NULL, key, 41, 0);
ok(ret == STATUS_INVALID_PARAMETER || !ret /* win7 */, "got %08x\n", ret);
if (!ret)
ok(!memcmp(key, expect, sizeof(expect) - 1), "wrong key data\n");
- ret = pBCryptDestroyHash(hash);
+ ret = BCryptDestroyHash(hash);
ok(!ret, "got %08x\n", ret);
- ret = pBCryptCreateHash(alg, &hash, NULL, 0, NULL, 0, 0);
+ ret = BCryptCreateHash(alg, &hash, NULL, 0, NULL, 0, 0);
ok(!ret, "got %08x\n", ret);
memset(key, 0, sizeof(key));
- ret = pBCryptDeriveKeyCapi(hash, NULL, key, 20, 0);
+ ret = BCryptDeriveKeyCapi(hash, NULL, key, 20, 0);
ok(!ret, "got %08x\n", ret);
ok(!memcmp(key, expect, sizeof(expect) - 1), "wrong key data\n");
- ret = pBCryptDeriveKeyCapi(hash, NULL, key, 20, 0);
+ ret = BCryptDeriveKeyCapi(hash, NULL, key, 20, 0);
todo_wine ok(ret == STATUS_INVALID_HANDLE, "got %08x\n", ret);
- ret = pBCryptHashData(hash, NULL, 0, 0);
+ ret = BCryptHashData(hash, NULL, 0, 0);
todo_wine ok(ret == STATUS_INVALID_HANDLE, "got %08x\n", ret);
- ret = pBCryptDestroyHash(hash);
+ ret = BCryptDestroyHash(hash);
ok(!ret, "got %08x\n", ret);
- ret = pBCryptCreateHash(alg, &hash, NULL, 0, NULL, 0, 0);
+ ret = BCryptCreateHash(alg, &hash, NULL, 0, NULL, 0, 0);
ok(!ret, "got %08x\n", ret);
- ret = pBCryptHashData(hash, (UCHAR *)"test", 4, 0);
+ ret = BCryptHashData(hash, (UCHAR *)"test", 4, 0);
ok(!ret, "got %08x\n", ret);
/* padding */
memset(key, 0, sizeof(key));
- ret = pBCryptDeriveKeyCapi(hash, NULL, key, 40, 0);
+ ret = BCryptDeriveKeyCapi(hash, NULL, key, 40, 0);
ok(!ret, "got %08x\n", ret);
ok(!memcmp(key, expect2, sizeof(expect2) - 1), "wrong key data\n");
- ret = pBCryptCloseAlgorithmProvider(alg, 0);
+ ret = BCryptCloseAlgorithmProvider(alg, 0);
ok(!ret, "got %08x\n", ret);
}
@@ -2851,78 +2807,78 @@ static void test_DSA(void)
NTSTATUS ret;
BYTE *buf;
- ret = pBCryptOpenAlgorithmProvider(&alg, BCRYPT_DSA_ALGORITHM, NULL, 0);
+ ret = BCryptOpenAlgorithmProvider(&alg, BCRYPT_DSA_ALGORITHM, NULL, 0);
ok(!ret, "got %08x\n", ret);
- ret = pBCryptGetProperty(alg, L"PaddingSchemes", (UCHAR *)&schemes, sizeof(schemes), &size, 0);
+ ret = BCryptGetProperty(alg, L"PaddingSchemes", (UCHAR *)&schemes, sizeof(schemes), &size, 0);
ok(ret == STATUS_NOT_SUPPORTED, "got %08x\n", ret);
- ret = pBCryptImportKeyPair(alg, NULL, BCRYPT_DSA_PUBLIC_BLOB, &key, dsaPublicBlob, sizeof(dsaPublicBlob), 0);
+ ret = BCryptImportKeyPair(alg, NULL, BCRYPT_DSA_PUBLIC_BLOB, &key, dsaPublicBlob, sizeof(dsaPublicBlob), 0);
ok(!ret, "got %08x\n", ret);
- ret = pBCryptVerifySignature(key, NULL, dsaHash, sizeof(dsaHash), dsaSignature, sizeof(dsaSignature), 0);
+ ret = BCryptVerifySignature(key, NULL, dsaHash, sizeof(dsaHash), dsaSignature, sizeof(dsaSignature), 0);
ok(!ret, "got %08x\n", ret);
- ret = pBCryptDestroyKey(key);
+ ret = BCryptDestroyKey(key);
ok(!ret, "got %08x\n", ret);
/* sign/verify with export/import round-trip */
- ret = pBCryptGenerateKeyPair(alg, &key, 512, 0);
+ ret = BCryptGenerateKeyPair(alg, &key, 512, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
- ret = pBCryptFinalizeKeyPair(key, 0);
+ ret = BCryptFinalizeKeyPair(key, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
len = 0;
memset(sig, 0, sizeof(sig));
- ret = pBCryptSignHash(key, NULL, dsaHash, sizeof(dsaHash), sig, sizeof(sig), &len, 0);
+ ret = BCryptSignHash(key, NULL, dsaHash, sizeof(dsaHash), sig, sizeof(sig), &len, 0);
ok(!ret, "got %08x\n", ret);
ok(len == 40, "got %u\n", len);
size = 0;
- ret = pBCryptExportKey(key, NULL, BCRYPT_DSA_PUBLIC_BLOB, NULL, 0, &size, 0);
+ ret = BCryptExportKey(key, NULL, BCRYPT_DSA_PUBLIC_BLOB, NULL, 0, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size, "size not set\n");
buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
- ret = pBCryptExportKey(key, NULL, BCRYPT_DSA_PUBLIC_BLOB, buf, size, &size, 0);
+ ret = BCryptExportKey(key, NULL, BCRYPT_DSA_PUBLIC_BLOB, buf, size, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
dsablob = (BCRYPT_DSA_KEY_BLOB *)buf;
ok(dsablob->dwMagic == BCRYPT_DSA_PUBLIC_MAGIC, "got %08x\n", dsablob->dwMagic);
ok(dsablob->cbKey == 64, "got %u\n", dsablob->cbKey);
ok(size == sizeof(*dsablob) + dsablob->cbKey * 3, "got %u\n", size);
- ret = pBCryptDestroyKey(key);
+ ret = BCryptDestroyKey(key);
ok(!ret, "got %08x\n", ret);
- ret = pBCryptImportKeyPair(alg, NULL, BCRYPT_DSA_PUBLIC_BLOB, &key, buf, size, 0);
+ ret = BCryptImportKeyPair(alg, NULL, BCRYPT_DSA_PUBLIC_BLOB, &key, buf, size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
HeapFree(GetProcessHeap(), 0, buf);
- ret = pBCryptVerifySignature(key, NULL, dsaHash, sizeof(dsaHash), sig, len, 0);
+ ret = BCryptVerifySignature(key, NULL, dsaHash, sizeof(dsaHash), sig, len, 0);
ok(!ret, "got %08x\n", ret);
- ret = pBCryptDestroyKey(key);
+ ret = BCryptDestroyKey(key);
ok(!ret, "got %08x\n", ret);
- ret = pBCryptImportKeyPair(alg, NULL, LEGACY_DSA_V2_PRIVATE_BLOB, &key, dssKey, sizeof(dssKey), 0);
+ ret = BCryptImportKeyPair(alg, NULL, LEGACY_DSA_V2_PRIVATE_BLOB, &key, dssKey, sizeof(dssKey), 0);
ok(!ret, "got %08x\n", ret);
size = 0;
- ret = pBCryptExportKey(key, NULL, LEGACY_DSA_V2_PRIVATE_BLOB, NULL, 0, &size, 0);
+ ret = BCryptExportKey(key, NULL, LEGACY_DSA_V2_PRIVATE_BLOB, NULL, 0, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size, "size not set\n");
buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
- ret = pBCryptExportKey(key, NULL, LEGACY_DSA_V2_PRIVATE_BLOB, buf, size, &size, 0);
+ ret = BCryptExportKey(key, NULL, LEGACY_DSA_V2_PRIVATE_BLOB, buf, size, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(size == sizeof(dssKey), "got %u expected %u\n", size, sizeof(dssKey));
ok(!memcmp(dssKey, buf, size), "wrong data\n");
HeapFree(GetProcessHeap(), 0, buf);
- ret = pBCryptDestroyKey(key);
+ ret = BCryptDestroyKey(key);
ok(!ret, "got %08x\n", ret);
- ret = pBCryptCloseAlgorithmProvider(alg, 0);
+ ret = BCryptCloseAlgorithmProvider(alg, 0);
ok(!ret, "got %08x\n", ret);
}
@@ -2934,7 +2890,7 @@ static void test_SecretAgreement(void)
NTSTATUS status;
ULONG size;
- status = pBCryptOpenAlgorithmProvider(&alg, BCRYPT_ECDH_P256_ALGORITHM, NULL, 0);
+ status = BCryptOpenAlgorithmProvider(&alg, BCRYPT_ECDH_P256_ALGORITHM, NULL, 0);
if (status)
{
skip("Failed to open BCRYPT_ECDH_P256_ALGORITHM provider %08x\n", status);
@@ -2942,57 +2898,57 @@ static void test_SecretAgreement(void)
}
key = NULL;
- status = pBCryptGenerateKeyPair(alg, &key, 256, 0);
+ status = BCryptGenerateKeyPair(alg, &key, 256, 0);
ok(status == STATUS_SUCCESS, "got %08x\n", status);
ok(key != NULL, "key not set\n");
- status = pBCryptFinalizeKeyPair(key, 0);
+ status = BCryptFinalizeKeyPair(key, 0);
ok(status == STATUS_SUCCESS, "got %08x\n", status);
- status = pBCryptSecretAgreement(NULL, key, &secret, 0);
+ status = BCryptSecretAgreement(NULL, key, &secret, 0);
ok(status == STATUS_INVALID_HANDLE, "got %08x\n", status);
- status = pBCryptSecretAgreement(key, NULL, &secret, 0);
+ status = BCryptSecretAgreement(key, NULL, &secret, 0);
ok(status == STATUS_INVALID_HANDLE, "got %08x\n", status);
- status = pBCryptSecretAgreement(key, key, NULL, 0);
+ status = BCryptSecretAgreement(key, key, NULL, 0);
ok(status == STATUS_INVALID_PARAMETER, "got %08x\n", status);
- status = pBCryptSecretAgreement(key, key, &secret, 0);
+ status = BCryptSecretAgreement(key, key, &secret, 0);
ok(status == STATUS_SUCCESS, "got %08x\n", status);
- status = pBCryptDeriveKey(NULL, L"HASH", NULL, NULL, 0, &size, 0);
+ status = BCryptDeriveKey(NULL, L"HASH", NULL, NULL, 0, &size, 0);
ok(status == STATUS_INVALID_HANDLE, "got %08x\n", status);
- status = pBCryptDeriveKey(key, L"HASH", NULL, NULL, 0, &size, 0);
+ status = BCryptDeriveKey(key, L"HASH", NULL, NULL, 0, &size, 0);
ok(status == STATUS_INVALID_HANDLE, "got %08x\n", status);
- status = pBCryptDeriveKey(secret, NULL, NULL, NULL, 0, &size, 0);
+ status = BCryptDeriveKey(secret, NULL, NULL, NULL, 0, &size, 0);
ok(status == STATUS_INVALID_PARAMETER, "got %08x\n", status);
- status = pBCryptDeriveKey(secret, L"HASH", NULL, NULL, 0, &size, 0);
+ status = BCryptDeriveKey(secret, L"HASH", NULL, NULL, 0, &size, 0);
todo_wine
ok(status == STATUS_SUCCESS, "got %08x\n", status);
- status = pBCryptDestroyHash(secret);
+ status = BCryptDestroyHash(secret);
ok(status == STATUS_INVALID_PARAMETER, "got %08x\n", status);
- status = pBCryptDestroyKey(secret);
+ status = BCryptDestroyKey(secret);
ok(status == STATUS_INVALID_HANDLE, "got %08x\n", status);
- status = pBCryptDestroySecret(NULL);
+ status = BCryptDestroySecret(NULL);
ok(status == STATUS_INVALID_HANDLE, "got %08x\n", status);
- status = pBCryptDestroySecret(alg);
+ status = BCryptDestroySecret(alg);
ok(status == STATUS_INVALID_HANDLE, "got %08x\n", status);
- status = pBCryptDestroySecret(secret);
+ status = BCryptDestroySecret(secret);
ok(status == STATUS_SUCCESS, "got %08x\n", status);
- status = pBCryptDestroyKey(key);
+ status = BCryptDestroyKey(key);
ok(status == STATUS_SUCCESS, "got %08x\n", status);
- status = pBCryptCloseAlgorithmProvider(alg, 0);
+ status = BCryptCloseAlgorithmProvider(alg, 0);
ok(status == STATUS_SUCCESS, "got %08x\n", status);
}
@@ -3006,39 +2962,7 @@ START_TEST(bcrypt)
win_skip("bcrypt.dll not found\n");
return;
}
-
- pBCryptCloseAlgorithmProvider = (void *)GetProcAddress(module, "BCryptCloseAlgorithmProvider");
- pBCryptCreateHash = (void *)GetProcAddress(module, "BCryptCreateHash");
- pBCryptDecrypt = (void *)GetProcAddress(module, "BCryptDecrypt");
- pBCryptDeriveKeyCapi = (void *)GetProcAddress(module, "BCryptDeriveKeyCapi");
- pBCryptDeriveKeyPBKDF2 = (void *)GetProcAddress(module, "BCryptDeriveKeyPBKDF2");
- pBCryptDestroyHash = (void *)GetProcAddress(module, "BCryptDestroyHash");
- pBCryptDestroyKey = (void *)GetProcAddress(module, "BCryptDestroyKey");
- pBCryptDuplicateHash = (void *)GetProcAddress(module, "BCryptDuplicateHash");
- pBCryptDuplicateKey = (void *)GetProcAddress(module, "BCryptDuplicateKey");
- pBCryptEncrypt = (void *)GetProcAddress(module, "BCryptEncrypt");
- pBCryptEnumAlgorithms = (void *)GetProcAddress(module, "BCryptEnumAlgorithms");
- pBCryptEnumContextFunctions = (void *)GetProcAddress(module, "BCryptEnumContextFunctions");
- pBCryptExportKey = (void *)GetProcAddress(module, "BCryptExportKey");
- pBCryptFinalizeKeyPair = (void *)GetProcAddress(module, "BCryptFinalizeKeyPair");
- pBCryptFinishHash = (void *)GetProcAddress(module, "BCryptFinishHash");
- pBCryptFreeBuffer = (void *)GetProcAddress(module, "BCryptFreeBuffer");
- pBCryptGenerateKeyPair = (void *)GetProcAddress(module, "BCryptGenerateKeyPair");
- pBCryptGenerateSymmetricKey = (void *)GetProcAddress(module, "BCryptGenerateSymmetricKey");
- pBCryptGenRandom = (void *)GetProcAddress(module, "BCryptGenRandom");
- pBCryptGetFipsAlgorithmMode = (void *)GetProcAddress(module, "BCryptGetFipsAlgorithmMode");
- pBCryptGetProperty = (void *)GetProcAddress(module, "BCryptGetProperty");
pBCryptHash = (void *)GetProcAddress(module, "BCryptHash");
- pBCryptHashData = (void *)GetProcAddress(module, "BCryptHashData");
- pBCryptImportKey = (void *)GetProcAddress(module, "BCryptImportKey");
- pBCryptImportKeyPair = (void *)GetProcAddress(module, "BCryptImportKeyPair");
- pBCryptOpenAlgorithmProvider = (void *)GetProcAddress(module, "BCryptOpenAlgorithmProvider");
- pBCryptSetProperty = (void *)GetProcAddress(module, "BCryptSetProperty");
- pBCryptSignHash = (void *)GetProcAddress(module, "BCryptSignHash");
- pBCryptVerifySignature = (void *)GetProcAddress(module, "BCryptVerifySignature");
- pBCryptSecretAgreement = (void *)GetProcAddress(module, "BCryptSecretAgreement");
- pBCryptDestroySecret = (void *)GetProcAddress(module, "BCryptDestroySecret");
- pBCryptDeriveKey = (void *)GetProcAddress(module, "BCryptDeriveKey");
test_BCryptGenRandom();
test_BCryptGetFipsAlgorithmMode();
--
2.30.2
2
1
03 Dec '21
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52060
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/bcrypt/bcrypt_internal.h | 2 +
dlls/bcrypt/bcrypt_main.c | 15 +++-
dlls/bcrypt/gnutls.c | 88 +++++++++++++++++++
dlls/bcrypt/tests/bcrypt.c | 157 +++++++++++++++++++++++++++++++++-
include/bcrypt.h | 2 +
5 files changed, 258 insertions(+), 6 deletions(-)
diff --git a/dlls/bcrypt/bcrypt_internal.h b/dlls/bcrypt/bcrypt_internal.h
index e015cc1fa42..c0a53f9068b 100644
--- a/dlls/bcrypt/bcrypt_internal.h
+++ b/dlls/bcrypt/bcrypt_internal.h
@@ -274,6 +274,7 @@ struct key_export_params
UCHAR *buf;
ULONG len;
ULONG *ret_len;
+ BOOL full;
};
struct key_import_params
@@ -301,6 +302,7 @@ enum key_funcs
unix_key_asymmetric_destroy,
unix_key_export_dsa_capi,
unix_key_export_ecc,
+ unix_key_export_rsa,
unix_key_import_dsa_capi,
unix_key_import_ecc,
unix_key_import_rsa,
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
index 542bd0756a0..a1c6ef2c66c 100644
--- a/dlls/bcrypt/bcrypt_main.c
+++ b/dlls/bcrypt/bcrypt_main.c
@@ -1101,6 +1101,15 @@ static NTSTATUS key_export( struct key *key, const WCHAR *type, UCHAR *output, U
if (output) memcpy( output, key->u.a.pubkey, key->u.a.pubkey_len );
return STATUS_SUCCESS;
}
+ else if (!wcscmp( type, BCRYPT_RSAPRIVATE_BLOB ) || !wcscmp( type, BCRYPT_RSAFULLPRIVATE_BLOB ))
+ {
+ params.key = key;
+ params.buf = output;
+ params.len = output_len;
+ params.ret_len = size;
+ params.full = wcscmp( type, BCRYPT_RSAPRIVATE_BLOB );
+ return UNIX_CALL( key_export_rsa, ¶ms );
+ }
else if (!wcscmp( type, BCRYPT_ECCPRIVATE_BLOB ))
{
params.key = key;
@@ -1404,13 +1413,13 @@ static NTSTATUS key_import_pair( struct algorithm *alg, const WCHAR *type, BCRYP
size = sizeof(*rsa_blob) + rsa_blob->cbPublicExp + rsa_blob->cbModulus;
return key_asymmetric_create( (struct key **)ret_key, alg, rsa_blob->BitLength, (BYTE *)rsa_blob, size );
}
- else if (!wcscmp( type, BCRYPT_RSAPRIVATE_BLOB ))
+ else if (!wcscmp( type, BCRYPT_RSAPRIVATE_BLOB ) || !wcscmp( type, BCRYPT_RSAFULLPRIVATE_BLOB ))
{
BCRYPT_RSAKEY_BLOB *rsa_blob = (BCRYPT_RSAKEY_BLOB *)input;
if (input_len < sizeof(*rsa_blob)) return STATUS_INVALID_PARAMETER;
- if (alg->id != ALG_ID_RSA || rsa_blob->Magic != BCRYPT_RSAPRIVATE_MAGIC)
- return STATUS_NOT_SUPPORTED;
+ if (alg->id != ALG_ID_RSA || (rsa_blob->Magic != BCRYPT_RSAPRIVATE_MAGIC &&
+ rsa_blob->Magic != BCRYPT_RSAFULLPRIVATE_MAGIC)) return STATUS_NOT_SUPPORTED;
size = sizeof(*rsa_blob) + rsa_blob->cbPublicExp + rsa_blob->cbModulus;
if ((status = key_asymmetric_create( &key, alg, rsa_blob->BitLength, (BYTE *)rsa_blob, size )))
diff --git a/dlls/bcrypt/gnutls.c b/dlls/bcrypt/gnutls.c
index 3a1eff1e7bd..c880c9c1d46 100644
--- a/dlls/bcrypt/gnutls.c
+++ b/dlls/bcrypt/gnutls.c
@@ -1028,6 +1028,64 @@ static NTSTATUS key_import_ecc( void *args )
return STATUS_SUCCESS;
}
+static NTSTATUS key_export_rsa( void *args )
+{
+ const struct key_export_params *params = args;
+ struct key *key = params->key;
+ BCRYPT_RSAKEY_BLOB *rsa_blob;
+ gnutls_datum_t m, e, d, p, q, u, e1, e2;
+ ULONG bitlen = key->u.a.bitlen;
+ UCHAR *dst;
+ int ret;
+
+ if ((ret = pgnutls_privkey_export_rsa_raw( key_data(key)->privkey, &m, &e, &d, &p, &q, &u, &e1, &e2 )))
+ {
+ pgnutls_perror( ret );
+ return STATUS_INTERNAL_ERROR;
+ }
+
+ *params->ret_len = sizeof(*rsa_blob) + EXPORT_SIZE(e,8,0) + EXPORT_SIZE(m,8,1) + EXPORT_SIZE(p,16,1) + EXPORT_SIZE(q,16,1);
+ if (params->full) *params->ret_len += EXPORT_SIZE(e1,16,1) + EXPORT_SIZE(e2,16,1) + EXPORT_SIZE(u,16,1) + EXPORT_SIZE(d,8,1);
+
+ if (params->len >= *params->ret_len && params->buf)
+ {
+ rsa_blob = (BCRYPT_RSAKEY_BLOB *)params->buf;
+ rsa_blob->Magic = params->full ? BCRYPT_RSAFULLPRIVATE_MAGIC : BCRYPT_RSAPRIVATE_MAGIC;
+ rsa_blob->BitLength = bitlen;
+
+ dst = (UCHAR *)(rsa_blob + 1);
+ rsa_blob->cbPublicExp = export_gnutls_datum( dst, bitlen / 8, &e, 0 );
+
+ dst += rsa_blob->cbPublicExp;
+ rsa_blob->cbModulus = export_gnutls_datum( dst, bitlen / 8, &m, 1 );
+
+ dst += rsa_blob->cbModulus;
+ rsa_blob->cbPrime1 = export_gnutls_datum( dst, bitlen / 16, &p, 1 );
+
+ dst += rsa_blob->cbPrime1;
+ rsa_blob->cbPrime2 = export_gnutls_datum( dst, bitlen / 16, &q, 1 );
+
+ if (params->full)
+ {
+ dst += rsa_blob->cbPrime2;
+ export_gnutls_datum( dst, bitlen / 16, &e1, 1 );
+
+ dst += rsa_blob->cbPrime1;
+ export_gnutls_datum( dst, bitlen / 16, &e2, 1 );
+
+ dst += rsa_blob->cbPrime2;
+ export_gnutls_datum( dst, bitlen / 16, &u, 1 );
+
+ dst += rsa_blob->cbPrime1;
+ export_gnutls_datum( dst, bitlen / 8, &d, 1 );
+ }
+ }
+
+ free( m.data ); free( e.data ); free( d.data ); free( p.data ); free( q.data ); free( u.data );
+ free( e1.data ); free( e2.data );
+ return STATUS_SUCCESS;
+}
+
static NTSTATUS key_import_rsa( void *args )
{
const struct key_import_params *params = args;
@@ -1805,6 +1863,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] =
key_asymmetric_destroy,
key_export_dsa_capi,
key_export_ecc,
+ key_export_rsa,
key_import_dsa_capi,
key_import_ecc,
key_import_rsa
@@ -2269,6 +2328,34 @@ static NTSTATUS wow64_key_import_ecc( void *args )
return ret;
}
+static NTSTATUS wow64_key_export_rsa( void *args )
+{
+ struct
+ {
+ PTR32 key;
+ PTR32 buf;
+ ULONG len;
+ PTR32 ret_len;
+ BOOL full;
+ } const *params32 = args;
+
+ NTSTATUS ret;
+ struct key key;
+ struct key32 *key32 = ULongToPtr( params32->key );
+ struct key_export_params params =
+ {
+ get_asymmetric_key( key32, &key ),
+ ULongToPtr(params32->buf),
+ params32->len,
+ ULongToPtr(params32->ret_len),
+ params32->full
+ };
+
+ ret = key_export_rsa( ¶ms );
+ put_asymmetric_key32( &key, key32 );
+ return ret;
+}
+
static NTSTATUS wow64_key_import_rsa( void *args )
{
struct
@@ -2311,6 +2398,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] =
wow64_key_asymmetric_destroy,
wow64_key_export_dsa_capi,
wow64_key_export_ecc,
+ wow64_key_export_rsa,
wow64_key_import_dsa_capi,
wow64_key_import_ecc,
wow64_key_import_rsa
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
index 4dd0f4195aa..a688d43657b 100644
--- a/dlls/bcrypt/tests/bcrypt.c
+++ b/dlls/bcrypt/tests/bcrypt.c
@@ -1977,6 +1977,44 @@ static UCHAR rsaSignature[] =
0xc1, 0x74, 0xe6, 0x7c, 0x18, 0x0f, 0x2b, 0x3b, 0xaa, 0xd1, 0x9d, 0x40, 0x71, 0x1d, 0x19, 0x53
};
+static UCHAR rsaPrivateBlob[] =
+{
+ 0x52, 0x53, 0x41, 0x32, 0x00, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0xa6, 0x8b, 0x46, 0x26, 0xb5,
+ 0xa9, 0x69, 0x83, 0x94, 0x66, 0xa7, 0xf3, 0x33, 0x95, 0x74, 0xe9, 0xeb, 0xc8, 0xcd, 0xd7, 0x81,
+ 0x9e, 0x45, 0x66, 0xb2, 0x48, 0x8b, 0x1f, 0xfe, 0xb3, 0x62, 0xc4, 0x0d, 0xa2, 0xf9, 0xf3, 0xe2,
+ 0xa6, 0x86, 0xd1, 0x1e, 0x8a, 0xbb, 0x1d, 0xa5, 0xc5, 0xe8, 0xa7, 0x50, 0x37, 0xfd, 0x69, 0x1f,
+ 0x6f, 0x99, 0x99, 0xca, 0x39, 0x13, 0xea, 0x5b, 0x6b, 0xe3, 0x91, 0xc0, 0xd2, 0x2c, 0x0b, 0x21,
+ 0xb1, 0xac, 0xa9, 0xe8, 0xa0, 0x6d, 0xa4, 0x1f, 0x1b, 0x34, 0xcb, 0x88, 0x7f, 0x2e, 0xeb, 0x7d,
+ 0x91, 0x38, 0x48, 0xce, 0x05, 0x73, 0x05, 0xdd, 0x22, 0x94, 0xc3, 0xdd, 0x1c, 0xfd, 0xc5, 0x41,
+ 0x2e, 0x94, 0xf9, 0xed, 0xe5, 0x92, 0x5f, 0x3f, 0x06, 0xf8, 0x49, 0x60, 0xb8, 0x92, 0x52, 0x6a,
+ 0x56, 0x6e, 0xd7, 0x04, 0x1a, 0xb5, 0xb5, 0x1c, 0x31, 0xd1, 0x1b,
+};
+
+static UCHAR rsaFullPrivateBlob[] =
+{
+ 0x52, 0x53, 0x41, 0x33, 0x00, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0xa6, 0x8b, 0x46, 0x26, 0xb5,
+ 0xa9, 0x69, 0x83, 0x94, 0x66, 0xa7, 0xf3, 0x33, 0x95, 0x74, 0xe9, 0xeb, 0xc8, 0xcd, 0xd7, 0x81,
+ 0x9e, 0x45, 0x66, 0xb2, 0x48, 0x8b, 0x1f, 0xfe, 0xb3, 0x62, 0xc4, 0x0d, 0xa2, 0xf9, 0xf3, 0xe2,
+ 0xa6, 0x86, 0xd1, 0x1e, 0x8a, 0xbb, 0x1d, 0xa5, 0xc5, 0xe8, 0xa7, 0x50, 0x37, 0xfd, 0x69, 0x1f,
+ 0x6f, 0x99, 0x99, 0xca, 0x39, 0x13, 0xea, 0x5b, 0x6b, 0xe3, 0x91, 0xc0, 0xd2, 0x2c, 0x0b, 0x21,
+ 0xb1, 0xac, 0xa9, 0xe8, 0xa0, 0x6d, 0xa4, 0x1f, 0x1b, 0x34, 0xcb, 0x88, 0x7f, 0x2e, 0xeb, 0x7d,
+ 0x91, 0x38, 0x48, 0xce, 0x05, 0x73, 0x05, 0xdd, 0x22, 0x94, 0xc3, 0xdd, 0x1c, 0xfd, 0xc5, 0x41,
+ 0x2e, 0x94, 0xf9, 0xed, 0xe5, 0x92, 0x5f, 0x3f, 0x06, 0xf8, 0x49, 0x60, 0xb8, 0x92, 0x52, 0x6a,
+ 0x56, 0x6e, 0xd7, 0x04, 0x1a, 0xb5, 0xb5, 0x1c, 0x31, 0xd1, 0x1b, 0xa3, 0xf3, 0xd1, 0x69, 0x61,
+ 0xab, 0xfe, 0xc1, 0xb6, 0x40, 0x7b, 0x19, 0xbb, 0x2d, 0x59, 0xf5, 0xda, 0x49, 0x32, 0x6f, 0x20,
+ 0x24, 0xd3, 0xb3, 0xec, 0x21, 0xec, 0x0c, 0xc7, 0x5b, 0xf9, 0x1b, 0xba, 0x6e, 0xe9, 0x61, 0xda,
+ 0x55, 0xc6, 0x72, 0xfd, 0x2d, 0x66, 0x3f, 0x3c, 0xcb, 0x49, 0xa9, 0xc5, 0x0d, 0x9b, 0x02, 0x36,
+ 0x7a, 0xee, 0x36, 0x09, 0x55, 0xe4, 0x03, 0xf2, 0xe3, 0xe6, 0x25, 0x14, 0x89, 0x7f, 0x2b, 0xfb,
+ 0x27, 0x0e, 0x8d, 0x37, 0x84, 0xfd, 0xad, 0x10, 0x79, 0x43, 0x4e, 0x38, 0x4a, 0xd4, 0x5e, 0xfa,
+ 0xda, 0x9f, 0x88, 0x21, 0x7c, 0xb4, 0x98, 0xb6, 0x6e, 0x1c, 0x24, 0x09, 0xe5, 0xe7, 0x22, 0x6f,
+ 0xd3, 0x84, 0xc0, 0xdc, 0x36, 0x09, 0xaf, 0x4b, 0x96, 0x8b, 0x5f, 0x47, 0xb3, 0x24, 0x80, 0xb5,
+ 0x64, 0x69, 0xad, 0x83, 0xd5, 0x09, 0xe7, 0xb9, 0xe4, 0x81, 0x6f, 0x1a, 0xe2, 0x6d, 0xf1, 0x5e,
+ 0x2b, 0xb3, 0x7a, 0xd0, 0x77, 0xef, 0x82, 0xcd, 0x55, 0x2e, 0xd5, 0xb1, 0xa7, 0x72, 0xec, 0x02,
+ 0x9d, 0xe2, 0xcc, 0x5a, 0xf1, 0x68, 0x30, 0xe5, 0xbc, 0x8d, 0xad,
+};
+
static void test_RSA(void)
{
static UCHAR hash[] =
@@ -1986,7 +2024,7 @@ static void test_RSA(void)
BCRYPT_KEY_HANDLE key;
BCRYPT_RSAKEY_BLOB *rsablob;
UCHAR sig[64];
- ULONG len, size, schemes;
+ ULONG len, size, size2, schemes;
NTSTATUS ret;
BYTE *buf;
@@ -2043,6 +2081,46 @@ static void test_RSA(void)
ret = pBCryptSignHash(key, &pad, hash, sizeof(hash), sig, sizeof(sig), &len, BCRYPT_PAD_PKCS1);
ok(!ret, "got %08x\n", ret);
+ /* export private key */
+ size = 0;
+ ret = pBCryptExportKey(key, NULL, BCRYPT_RSAPRIVATE_BLOB, NULL, 0, &size, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ ok(size, "size not set\n");
+
+ buf = HeapAlloc(GetProcessHeap(), 0, size);
+ ret = pBCryptExportKey(key, NULL, BCRYPT_RSAPRIVATE_BLOB, buf, size, &size, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ rsablob = (BCRYPT_RSAKEY_BLOB *)buf;
+ ok(rsablob->Magic == BCRYPT_RSAPRIVATE_MAGIC, "got %08x\n", rsablob->Magic);
+ ok(rsablob->BitLength == 512, "got %u\n", rsablob->BitLength);
+ ok(rsablob->cbPublicExp == 3, "got %u\n", rsablob->cbPublicExp);
+ ok(rsablob->cbModulus == 64, "got %u\n", rsablob->cbModulus);
+ ok(rsablob->cbPrime1 == 32, "got %u\n", rsablob->cbPrime1);
+ ok(rsablob->cbPrime2 == 32, "got %u\n", rsablob->cbPrime2);
+ size2 = sizeof(*rsablob) + rsablob->cbPublicExp + rsablob->cbModulus + rsablob->cbPrime1 + rsablob->cbPrime2;
+ ok(size == size2, "got %u expected %u\n", size2, size);
+ HeapFree(GetProcessHeap(), 0, buf);
+
+ size = 0;
+ ret = pBCryptExportKey(key, NULL, BCRYPT_RSAFULLPRIVATE_BLOB, NULL, 0, &size, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ ok(size, "size not set\n");
+
+ buf = HeapAlloc(GetProcessHeap(), 0, size);
+ ret = pBCryptExportKey(key, NULL, BCRYPT_RSAFULLPRIVATE_BLOB, buf, size, &size, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ rsablob = (BCRYPT_RSAKEY_BLOB *)buf;
+ ok(rsablob->Magic == BCRYPT_RSAFULLPRIVATE_MAGIC, "got %08x\n", rsablob->Magic);
+ ok(rsablob->BitLength == 512, "got %u\n", rsablob->BitLength);
+ ok(rsablob->cbPublicExp == 3, "got %u\n", rsablob->cbPublicExp);
+ ok(rsablob->cbModulus == 64, "got %u\n", rsablob->cbModulus);
+ ok(rsablob->cbPrime1 == 32, "got %u\n", rsablob->cbPrime1);
+ ok(rsablob->cbPrime2 == 32, "got %u\n", rsablob->cbPrime2);
+ size2 = sizeof(*rsablob) + rsablob->cbPublicExp + rsablob->cbModulus * 2 + rsablob->cbPrime1 * 3 + rsablob->cbPrime2 * 2;
+ ok(size == size2, "got %u expected %u\n", size2, size);
+ HeapFree(GetProcessHeap(), 0, buf);
+
+ /* export public key */
size = 0;
ret = pBCryptExportKey(key, NULL, BCRYPT_RSAPUBLIC_BLOB, NULL, 0, &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
@@ -2071,6 +2149,32 @@ static void test_RSA(void)
ret = pBCryptDestroyKey(key);
ok(!ret, "got %08x\n", ret);
+ /* import/export private key */
+ ret = pBCryptImportKeyPair(alg, NULL, BCRYPT_RSAPRIVATE_BLOB, &key, rsaPrivateBlob, sizeof(rsaPrivateBlob), 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+
+ size = 0;
+ buf = HeapAlloc(GetProcessHeap(), 0, sizeof(rsaPrivateBlob));
+ ret = pBCryptExportKey(key, NULL, BCRYPT_RSAPRIVATE_BLOB, buf, sizeof(rsaPrivateBlob), &size, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ ok(size == sizeof(rsaPrivateBlob), "got %u\n", size);
+ ok(!memcmp(buf, rsaPrivateBlob, size), "wrong data\n");
+ HeapFree(GetProcessHeap(), 0, buf);
+ pBCryptDestroyKey(key);
+
+ /* import/export full private key */
+ ret = pBCryptImportKeyPair(alg, NULL, BCRYPT_RSAFULLPRIVATE_BLOB, &key, rsaFullPrivateBlob, sizeof(rsaFullPrivateBlob), 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+
+ size = 0;
+ buf = HeapAlloc(GetProcessHeap(), 0, sizeof(rsaFullPrivateBlob));
+ ret = pBCryptExportKey(key, NULL, BCRYPT_RSAFULLPRIVATE_BLOB, buf, sizeof(rsaFullPrivateBlob), &size, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ ok(size == sizeof(rsaFullPrivateBlob), "got %u\n", size);
+ ok(!memcmp(buf, rsaFullPrivateBlob, size), "wrong data\n");
+ HeapFree(GetProcessHeap(), 0, buf);
+ pBCryptDestroyKey(key);
+
ret = pBCryptCloseAlgorithmProvider(alg, 0);
ok(!ret, "got %08x\n", ret);
}
@@ -2080,7 +2184,10 @@ static void test_RSA_SIGN(void)
BCRYPT_PKCS1_PADDING_INFO pad;
BCRYPT_ALG_HANDLE alg = NULL;
BCRYPT_KEY_HANDLE key = NULL;
+ BCRYPT_RSAKEY_BLOB *rsablob;
NTSTATUS ret;
+ ULONG size, size2;
+ BYTE *buf;
ret = pBCryptOpenAlgorithmProvider(&alg, BCRYPT_RSA_SIGN_ALGORITHM, NULL, 0);
if (ret)
@@ -2117,6 +2224,52 @@ static void test_RSA_SIGN(void)
ret = pBCryptDestroyKey(key);
ok(!ret, "pBCryptDestroyKey failed: %08x\n", ret);
+ /* export private key */
+ ret = pBCryptGenerateKeyPair(alg, &key, 512, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+
+ ret = pBCryptFinalizeKeyPair(key, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+
+ size = 0;
+ ret = pBCryptExportKey(key, NULL, BCRYPT_RSAPRIVATE_BLOB, NULL, 0, &size, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ ok(size, "size not set\n");
+
+ buf = HeapAlloc(GetProcessHeap(), 0, size);
+ ret = pBCryptExportKey(key, NULL, BCRYPT_RSAPRIVATE_BLOB, buf, size, &size, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ rsablob = (BCRYPT_RSAKEY_BLOB *)buf;
+ ok(rsablob->Magic == BCRYPT_RSAPRIVATE_MAGIC, "got %08x\n", rsablob->Magic);
+ ok(rsablob->BitLength == 512, "got %u\n", rsablob->BitLength);
+ ok(rsablob->cbPublicExp == 3, "got %u\n", rsablob->cbPublicExp);
+ ok(rsablob->cbModulus == 64, "got %u\n", rsablob->cbModulus);
+ ok(rsablob->cbPrime1 == 32, "got %u\n", rsablob->cbPrime1);
+ ok(rsablob->cbPrime2 == 32, "got %u\n", rsablob->cbPrime2);
+ size2 = sizeof(*rsablob) + rsablob->cbPublicExp + rsablob->cbModulus + rsablob->cbPrime1 + rsablob->cbPrime2;
+ ok(size == size2, "got %u expected %u\n", size2, size);
+ HeapFree(GetProcessHeap(), 0, buf);
+
+ size = 0;
+ ret = pBCryptExportKey(key, NULL, BCRYPT_RSAFULLPRIVATE_BLOB, NULL, 0, &size, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ ok(size, "size not set\n");
+
+ buf = HeapAlloc(GetProcessHeap(), 0, size);
+ ret = pBCryptExportKey(key, NULL, BCRYPT_RSAFULLPRIVATE_BLOB, buf, size, &size, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ rsablob = (BCRYPT_RSAKEY_BLOB *)buf;
+ ok(rsablob->Magic == BCRYPT_RSAFULLPRIVATE_MAGIC, "got %08x\n", rsablob->Magic);
+ ok(rsablob->BitLength == 512, "got %u\n", rsablob->BitLength);
+ ok(rsablob->cbPublicExp == 3, "got %u\n", rsablob->cbPublicExp);
+ ok(rsablob->cbModulus == 64, "got %u\n", rsablob->cbModulus);
+ ok(rsablob->cbPrime1 == 32, "got %u\n", rsablob->cbPrime1);
+ ok(rsablob->cbPrime2 == 32, "got %u\n", rsablob->cbPrime2);
+ size2 = sizeof(*rsablob) + rsablob->cbPublicExp + rsablob->cbModulus * 2 + rsablob->cbPrime1 * 3 + rsablob->cbPrime2 * 2;
+ ok(size == size2, "got %u expected %u\n", size2, size);
+ HeapFree(GetProcessHeap(), 0, buf);
+ pBCryptDestroyKey(key);
+
ret = pBCryptCloseAlgorithmProvider(alg, 0);
ok(!ret, "pBCryptCloseAlgorithmProvider failed: %08x\n", ret);
}
@@ -2370,7 +2523,6 @@ static void test_BCryptSignHash(void)
ULONG len;
/* RSA */
-
ret = pBCryptOpenAlgorithmProvider(&alg, BCRYPT_RSA_ALGORITHM, NULL, 0);
if (ret)
{
@@ -2424,7 +2576,6 @@ static void test_BCryptSignHash(void)
ok(!ret, "got %08x\n", ret);
/* ECDSA */
-
ret = pBCryptOpenAlgorithmProvider(&alg, BCRYPT_ECDSA_P256_ALGORITHM, NULL, 0);
if (ret)
{
diff --git a/include/bcrypt.h b/include/bcrypt.h
index a099f2f4b0e..15c26c1fb0a 100644
--- a/include/bcrypt.h
+++ b/include/bcrypt.h
@@ -66,6 +66,7 @@ typedef LONG NTSTATUS;
#define BCRYPT_ECCPRIVATE_BLOB L"ECCPRIVATEBLOB"
#define BCRYPT_RSAPUBLIC_BLOB L"RSAPUBLICBLOB"
#define BCRYPT_RSAPRIVATE_BLOB L"RSAPRIVATEBLOB"
+#define BCRYPT_RSAFULLPRIVATE_BLOB L"RSAFULLPRIVATEBLOB"
#define BCRYPT_DSA_PUBLIC_BLOB L"DSAPUBLICBLOB"
#define BCRYPT_DSA_PRIVATE_BLOB L"DSAPRIVATEBLOB"
#define BCRYPT_PUBLIC_KEY_BLOB L"PUBLICBLOB"
@@ -137,6 +138,7 @@ static const WCHAR BCRYPT_ECCPUBLIC_BLOB[] = {'E','C','C','P','U','B','L','I','C
static const WCHAR BCRYPT_ECCPRIVATE_BLOB[] = {'E','C','C','P','R','I','V','A','T','E','B','L','O','B',0};
static const WCHAR BCRYPT_RSAPUBLIC_BLOB[] = {'R','S','A','P','U','B','L','I','C','B','L','O','B',0};
static const WCHAR BCRYPT_RSAPRIVATE_BLOB[] = {'R','S','A','P','R','I','V','A','T','E','B','L','O','B',0};
+static const WCHAR BCRYPT_RSAFULLPRIVATE_BLOB[] = {'R','S','A','F','U','L','L','P','R','I','V','A','T','E','B','L','O','B',0};
static const WCHAR BCRYPT_DSA_PUBLIC_BLOB[] = {'D','S','A','P','U','B','L','I','C','B','L','O','B',0};
static const WCHAR BCRYPT_DSA_PRIVATE_BLOB[] = {'D','S','A','P','R','I','V','A','T','E','B','L','O','B',0};
static const WCHAR BCRYPT_PUBLIC_KEY_BLOB[] = {'P','U','B','L','I','C','B','L','O','B',0};
--
2.30.2
2
1
03 Dec '21
Signed-off-by: Torge Matthies <openglfreak(a)googlemail.com>
---
v1->v2: Fixed decoder leak and split up png_8M_tEXt to not add 8MiB to the
binary.
dlls/windowscodecs/tests/pngformat.c | 29 ++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/dlls/windowscodecs/tests/pngformat.c b/dlls/windowscodecs/tests/pngformat.c
index 8c33d3b9645..b44fd017fcf 100644
--- a/dlls/windowscodecs/tests/pngformat.c
+++ b/dlls/windowscodecs/tests/pngformat.c
@@ -922,6 +922,34 @@ todo_wine_if(td[i].todo)
#undef PNG_COLOR_TYPE_GRAY_ALPHA
#undef PNG_COLOR_TYPE_RGB_ALPHA
+/* 1 bpp 1x1 pixel PNG image with 8 MiB comment */
+static const char png_8M_tEXt_start[] = {
+ 0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a,
+ 0x00,0x00,0x00,0x0d,'I','H','D','R',0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x37,0x6e,0xf9,0x24,
+ 0x00,0x80,0x00,0x08,'t','E','X','t','C','o','m','m','e','n','t',0x00 /* ,[0x800030]=0x00,0x1e,0x13,0xe2,0xc7 */
+};
+static const char png_8M_tEXt_end[] = {
+ /* 0x00,0x80,0x00,0x08,'t','E','X','t','C','o','m','m','e','n','t',0x00,[0x800030]=0x00, */ 0x1e,0x13,0xe2,0xc7,
+ 0x00,0x00,0x00,0x0c,'I','D','A','T',0x78,0x9c,0x63,0x68,0x00,0x00,0x00,0x82,0x00,0x81,0x77,0xcd,0x72,0xb6,
+ 0x00,0x00,0x00,0x00,'I','E','N','D',0xae,0x42,0x60,0x82
+};
+
+static void test_chunk_size(void)
+{
+ static char png_8M_tEXt[sizeof(png_8M_tEXt_start) + 0x800000 + sizeof(png_8M_tEXt_end)] = {0};
+ HRESULT hr;
+ IWICBitmapDecoder *decoder;
+
+ memcpy(png_8M_tEXt, png_8M_tEXt_start, sizeof(png_8M_tEXt_start));
+ memcpy(png_8M_tEXt + sizeof(png_8M_tEXt) - sizeof(png_8M_tEXt_end), png_8M_tEXt_end, sizeof(png_8M_tEXt_end));
+
+ hr = create_decoder(png_8M_tEXt, sizeof(png_8M_tEXt), &decoder);
+ todo_wine ok(hr == S_OK, "Failed to load PNG image data %#x\n", hr);
+ if (hr != S_OK) return;
+
+ IWICBitmapDecoder_Release(decoder);
+}
+
START_TEST(pngformat)
{
HRESULT hr;
@@ -935,6 +963,7 @@ START_TEST(pngformat)
test_color_contexts();
test_png_palette();
test_color_formats();
+ test_chunk_size();
IWICImagingFactory_Release(factory);
CoUninitialize();
--
2.34.1
2
3
03 Dec '21
Signed-off-by: Torge Matthies <openglfreak(a)googlemail.com>
---
dlls/windowscodecs/tests/pngformat.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/dlls/windowscodecs/tests/pngformat.c b/dlls/windowscodecs/tests/pngformat.c
index 8c33d3b9645..79d8a6fbe7f 100644
--- a/dlls/windowscodecs/tests/pngformat.c
+++ b/dlls/windowscodecs/tests/pngformat.c
@@ -922,6 +922,25 @@ todo_wine_if(td[i].todo)
#undef PNG_COLOR_TYPE_GRAY_ALPHA
#undef PNG_COLOR_TYPE_RGB_ALPHA
+/* 1 bpp 1x1 pixel PNG image with 8 MiB comment */
+static const char png_8M_tEXt[] = {
+ 0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a,
+ 0x00,0x00,0x00,0x0d,'I','H','D','R',0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x37,0x6e,0xf9,0x24,
+ 0x00,0x80,0x00,0x08,'t','E','X','t','C','o','m','m','e','n','t',0x00,[0x800030]=0x00,0x1e,0x13,0xe2,0xc7,
+ 0x00,0x00,0x00,0x0c,'I','D','A','T',0x78,0x9c,0x63,0x68,0x00,0x00,0x00,0x82,0x00,0x81,0x77,0xcd,0x72,0xb6,
+ 0x00,0x00,0x00,0x00,'I','E','N','D',0xae,0x42,0x60,0x82
+};
+
+static void test_chunk_size(void)
+{
+ HRESULT hr;
+ IWICBitmapDecoder *decoder;
+
+ hr = create_decoder(png_8M_tEXt, sizeof(png_8M_tEXt), &decoder);
+ todo_wine ok(hr == S_OK, "Failed to load PNG image data %#x\n", hr);
+ if (hr != S_OK) return;
+}
+
START_TEST(pngformat)
{
HRESULT hr;
@@ -935,6 +954,7 @@ START_TEST(pngformat)
test_color_contexts();
test_png_palette();
test_color_formats();
+ test_chunk_size();
IWICImagingFactory_Release(factory);
CoUninitialize();
--
2.34.1
2
4
[PATCH v3] server: support inotify file change notifications on FreeBSD
by Damjan Jovanovic 03 Dec '21
by Damjan Jovanovic 03 Dec '21
03 Dec '21
The inotify code uses the Linux-specific /proc/self/fd/<FD> symlinks
to translate
file descriptors to filesystem paths. On FreeBSD, do this translation using
its own sysctl instead.
Try 3 makes the mib variable in fd_path() non-static, and moves the
fd_path() functions into the HAVE_SYS_INOTIFY_H block where they should be
invisible on MacOS.
Signed-off-by: Damjan Jovanovic <damjan.jov(a)gmail.com>
---
server/change.c | 132 ++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 111 insertions(+), 21 deletions(-)
1
0
[PATCH v2] server: support inotify file change notifications on FreeBSD
by Damjan Jovanovic 03 Dec '21
by Damjan Jovanovic 03 Dec '21
03 Dec '21
The inotify code uses the Linux-specific /proc/self/fd/<FD> symlinks
to translate
file descriptors to filesystem paths. On FreeBSD, do this translation using
its own sysctl instead.
Signed-off-by: Damjan Jovanovic <damjan.jov(a)gmail.com>
---
server/change.c | 132 ++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 111 insertions(+), 21 deletions(-)
2
2