Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 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
September 2019
- 76 participants
- 1410 messages
Re: [PATCH v2 3/3] msscript.ocx/tests: Add tests for IScriptControl::Run.
by Gabriel Ivăncescu
On 9/30/19 5:38 PM, Jacek Caban wrote:
> Hi Gabriel,
>
> On 9/30/19 2:43 PM, Gabriel Ivăncescu wrote:
>> {
>> + if (!lstrcmpW(V_BSTR(pDispParams->rgvarg), L"change me"))
>> + {
>> + /* Change the string to check whether it's copied or
>> not */
>> + lstrcpyW(V_BSTR(pDispParams->rgvarg), L"changed");
>> + }
>> + else
>> + ok(!lstrcmpW(V_BSTR(pDispParams->rgvarg), L"changed"),
>> + "unexpected second parameter %s.\n",
>> wine_dbgstr_w(V_BSTR(pDispParams->rgvarg)));
>> + }
>> + else
>> + ok(0, "unexpected non-string second parameter V_VT =
>> %d.\n", V_VT(pDispParams->rgvarg));
>
>
> While I can see why it was interesting for your experimentations, this
> is not really nice nor something that seems important to have in tests.
> But please remove this part. The rest of the patch looks good.
>
>
> Thanks,
>
> Jacek
>
Ok, I will resend it tomorrow after the others committed so it succeeds. :-)
Sept. 30, 2019
[PATCH] wbemprox: Implement Win32_QuickFixEngineering.
by Hans Leidekker
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47755
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/wbemprox/builtin.c | 23 +++++++++++++++++++
dlls/wbemprox/tests/query.c | 44 +++++++++++++++++++++++++++++++++++++
2 files changed, 67 insertions(+)
diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c
index 2aca2f8693..96d1e0b850 100644
--- a/dlls/wbemprox/builtin.c
+++ b/dlls/wbemprox/builtin.c
@@ -111,6 +111,8 @@ static const WCHAR class_processor2W[] =
{'C','I','M','_','P','r','o','c','e','s','s','o','r',0};
static const WCHAR class_qualifiersW[] =
{'_','_','Q','U','A','L','I','F','I','E','R','S',0};
+static const WCHAR class_quickfixengineeringW[] =
+ {'W','i','n','3','2','_','Q','u','i','c','k','F','i','x','E','n','g','i','n','e','e','r','i','n','g',0};
static const WCHAR class_sidW[] =
{'W','i','n','3','2','_','S','I','D',0};
static const WCHAR class_sounddeviceW[] =
@@ -268,6 +270,8 @@ static const WCHAR prop_graphicsscoreW[] =
{'G','r','a','p','h','i','c','s','S','c','o','r','e',0};
static const WCHAR prop_horizontalresolutionW[] =
{'H','o','r','i','z','o','n','t','a','l','R','e','s','o','l','u','t','i','o','n',0};
+static const WCHAR prop_hotfixidW[] =
+ {'H','o','t','F','i','x','I','D',0};
static const WCHAR prop_idW[] =
{'I','D',0};
static const WCHAR prop_identificationcodeW[] =
@@ -754,6 +758,11 @@ static const struct column col_qualifier[] =
{ prop_strvalueW, CIM_STRING },
{ prop_boolvalueW, CIM_BOOLEAN }
};
+static const struct column col_quickfixengineering[] =
+{
+ { prop_captionW, CIM_STRING },
+ { prop_hotfixidW, CIM_STRING|COL_FLAG_KEY }
+};
static const struct column col_service[] =
{
{ prop_acceptpauseW, CIM_BOOLEAN },
@@ -920,6 +929,10 @@ static const WCHAR os_serialnumberW[] =
{'1','2','3','4','5','-','O','E','M','-','1','2','3','4','5','6','7','-','1','2','3','4','5',0};
static const WCHAR physicalmedia_tagW[] =
{'\\','\\','.','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','0',0};
+static const WCHAR quickfixengineering_captionW[] =
+ {'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g',0};
+static const WCHAR quickfixengineering_hotfixidW[] =
+ {'K','B','1','2','3','4','5','6','7',0};
static const WCHAR sounddevice_productnameW[] =
{'W','i','n','e',' ','A','u','d','i','o',' ','D','e','v','i','c','e',0};
static const WCHAR systemenclosure_systemenclosureW[] =
@@ -1224,6 +1237,11 @@ struct record_qualifier
const WCHAR *strvalue;
int boolvalue;
};
+struct record_quickfixengineering
+{
+ const WCHAR *caption;
+ const WCHAR *hotfixid;
+};
struct record_service
{
int accept_pause;
@@ -1364,6 +1382,10 @@ static const struct record_qualifier data_qualifier[] =
{ class_process_getowner_outW, param_userW, CIM_SINT32, FLAVOR_ID, prop_idW, 0 },
{ class_process_getowner_outW, param_domainW, CIM_SINT32, FLAVOR_ID, prop_idW, 1 }
};
+static const struct record_quickfixengineering data_quickfixengineering[] =
+{
+ { quickfixengineering_captionW, quickfixengineering_hotfixidW },
+};
static const struct record_sounddevice data_sounddevice[] =
{
{ sounddevice_productnameW, sounddevice_productnameW, 3 /* enabled */ }
@@ -4443,6 +4465,7 @@ static struct table builtin_classes[] =
{ class_processorW, C(col_processor), 0, 0, NULL, fill_processor },
{ class_processor2W, C(col_processor), 0, 0, NULL, fill_processor },
{ class_qualifiersW, C(col_qualifier), D(data_qualifier) },
+ { class_quickfixengineeringW, C(col_quickfixengineering), D(data_quickfixengineering) },
{ class_serviceW, C(col_service), 0, 0, NULL, fill_service },
{ class_sidW, C(col_sid), 0, 0, NULL, fill_sid },
{ class_sounddeviceW, C(col_sounddevice), D(data_sounddevice) },
diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c
index ee4eac88e9..cdbbc02820 100644
--- a/dlls/wbemprox/tests/query.c
+++ b/dlls/wbemprox/tests/query.c
@@ -1756,6 +1756,49 @@ static void test_Win32_DisplayControllerConfiguration( IWbemServices *services )
SysFreeString( wql );
}
+static void test_Win32_QuickFixEngineering( IWbemServices *services )
+{
+ static const WCHAR captionW[] =
+ {'C','a','p','t','i','o','n',0};
+ static const WCHAR hotfixidW[] =
+ {'H','o','t','F','i','x','I','D',0};
+ static const WCHAR queryW[] =
+ {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_',
+ 'Q','u','i','c','k','F','i','x','E','n','g','i','n','e','e','r','i','n','g',0};
+ BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW );
+ IEnumWbemClassObject *result;
+ IWbemClassObject *obj;
+ HRESULT hr;
+ DWORD count, total = 0;
+ VARIANT caption;
+ CIMTYPE type;
+
+ hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result );
+ ok( hr == S_OK, "got %08x\n", hr );
+
+ for (;;)
+ {
+ hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count );
+ if (hr != S_OK) break;
+
+ type = 0xdeadbeef;
+ VariantInit( &caption );
+ hr = IWbemClassObject_Get( obj, captionW, 0, &caption, &type, NULL );
+ ok( hr == S_OK, "failed to get caption %08x\n", hr );
+ ok( V_VT( &caption ) == VT_BSTR || V_VT( &caption ) == VT_NULL /* winxp */,
+ "unexpected variant type 0x%x\n", V_VT( &caption ) );
+ ok( type == CIM_STRING, "unexpected type 0x%x\n", type );
+
+ check_property( obj, hotfixidW, VT_BSTR, CIM_STRING );
+ IWbemClassObject_Release( obj );
+ if (total++ >= 10) break;
+ }
+
+ IEnumWbemClassObject_Release( result );
+ SysFreeString( query );
+ SysFreeString( wql );
+}
+
START_TEST(query)
{
static const WCHAR cimv2W[] = {'R','O','O','T','\\','C','I','M','V','2',0};
@@ -1804,6 +1847,7 @@ START_TEST(query)
test_Win32_Process( services, FALSE );
test_Win32_Process( services, TRUE );
test_Win32_Processor( services );
+ test_Win32_QuickFixEngineering( services );
test_Win32_Service( services );
test_Win32_SystemEnclosure( services );
test_Win32_VideoController( services );
--
2.20.1
Sept. 30, 2019
[PATCH] bcrypt: Implement BCryptEnumAlgorithms.
by Hans Leidekker
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/bcrypt/bcrypt_internal.h | 24 ++++--
dlls/bcrypt/bcrypt_main.c | 151 +++++++++++++++++++++-------------
dlls/bcrypt/gnutls.c | 7 +-
dlls/bcrypt/tests/bcrypt.c | 30 +++++++
include/bcrypt.h | 23 +++++-
5 files changed, 171 insertions(+), 64 deletions(-)
diff --git a/dlls/bcrypt/bcrypt_internal.h b/dlls/bcrypt/bcrypt_internal.h
index bc1bdc2e53..c6f5aebe1c 100644
--- a/dlls/bcrypt/bcrypt_internal.h
+++ b/dlls/bcrypt/bcrypt_internal.h
@@ -115,19 +115,31 @@ struct object
enum alg_id
{
+ /* cipher */
ALG_ID_AES,
- ALG_ID_MD2,
- ALG_ID_MD4,
- ALG_ID_MD5,
- ALG_ID_RNG,
- ALG_ID_RSA,
- ALG_ID_SHA1,
+
+ /* hash */
ALG_ID_SHA256,
ALG_ID_SHA384,
ALG_ID_SHA512,
+ ALG_ID_SHA1,
+ ALG_ID_MD5,
+ ALG_ID_MD4,
+ ALG_ID_MD2,
+
+ /* asymmetric encryption */
+ ALG_ID_RSA,
+
+ /* secret agreement */
ALG_ID_ECDH_P256,
+
+ /* signature */
+ ALG_ID_RSA_SIGN,
ALG_ID_ECDSA_P256,
ALG_ID_ECDSA_P384,
+
+ /* rng */
+ ALG_ID_RNG,
};
enum mode_id
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
index 647b46cb29..10e0b98869 100644
--- a/dlls/bcrypt/bcrypt_main.c
+++ b/dlls/bcrypt/bcrypt_main.c
@@ -92,45 +92,87 @@ NTSTATUS WINAPI BCryptUnregisterProvider(LPCWSTR provider)
return STATUS_NOT_IMPLEMENTED;
}
-NTSTATUS WINAPI BCryptEnumAlgorithms(ULONG dwAlgOperations, ULONG *pAlgCount,
- BCRYPT_ALGORITHM_IDENTIFIER **ppAlgList, ULONG dwFlags)
-{
- FIXME("%08x, %p, %p, %08x - stub\n", dwAlgOperations, pAlgCount, ppAlgList, dwFlags);
-
- *ppAlgList=NULL;
- *pAlgCount=0;
-
- return STATUS_NOT_IMPLEMENTED;
-}
-
#define MAX_HASH_OUTPUT_BYTES 64
#define MAX_HASH_BLOCK_BITS 1024
+/* ordered by class, keep in sync with enum alg_id */
static const struct
{
+ const WCHAR *name;
+ ULONG class;
ULONG object_length;
ULONG hash_length;
ULONG block_bits;
- const WCHAR *alg_name;
- BOOL symmetric;
-}
-alg_props[] =
-{
- /* ALG_ID_AES */ { 654, 0, 0, BCRYPT_AES_ALGORITHM, TRUE },
- /* ALG_ID_MD2 */ { 270, 16, 128, BCRYPT_MD2_ALGORITHM, FALSE },
- /* ALG_ID_MD4 */ { 270, 16, 512, BCRYPT_MD4_ALGORITHM, FALSE },
- /* ALG_ID_MD5 */ { 274, 16, 512, BCRYPT_MD5_ALGORITHM, FALSE },
- /* ALG_ID_RNG */ { 0, 0, 0, BCRYPT_RNG_ALGORITHM, FALSE },
- /* ALG_ID_RSA */ { 0, 0, 0, BCRYPT_RSA_ALGORITHM, FALSE },
- /* ALG_ID_SHA1 */ { 278, 20, 512, BCRYPT_SHA1_ALGORITHM, FALSE },
- /* ALG_ID_SHA256 */ { 286, 32, 512, BCRYPT_SHA256_ALGORITHM, FALSE },
- /* ALG_ID_SHA384 */ { 382, 48, 1024, BCRYPT_SHA384_ALGORITHM, FALSE },
- /* ALG_ID_SHA512 */ { 382, 64, 1024, BCRYPT_SHA512_ALGORITHM, FALSE },
- /* ALG_ID_ECDH_P256 */ { 0, 0, 0, BCRYPT_ECDH_P256_ALGORITHM, FALSE },
- /* ALG_ID_ECDSA_P256 */ { 0, 0, 0, BCRYPT_ECDSA_P256_ALGORITHM, FALSE },
- /* ALG_ID_ECDSA_P384 */ { 0, 0, 0, BCRYPT_ECDSA_P384_ALGORITHM, FALSE },
+}
+builtin_algorithms[] =
+{
+ { BCRYPT_AES_ALGORITHM, BCRYPT_CIPHER_INTERFACE, 654, 0, 0 },
+ { BCRYPT_SHA256_ALGORITHM, BCRYPT_HASH_INTERFACE, 286, 32, 512 },
+ { BCRYPT_SHA384_ALGORITHM, BCRYPT_HASH_INTERFACE, 382, 48, 1024 },
+ { BCRYPT_SHA512_ALGORITHM, BCRYPT_HASH_INTERFACE, 382, 64, 1024 },
+ { BCRYPT_SHA1_ALGORITHM, BCRYPT_HASH_INTERFACE, 278, 20, 512 },
+ { BCRYPT_MD5_ALGORITHM, BCRYPT_HASH_INTERFACE, 274, 16, 512 },
+ { BCRYPT_MD4_ALGORITHM, BCRYPT_HASH_INTERFACE, 270, 16, 512 },
+ { BCRYPT_MD2_ALGORITHM, BCRYPT_HASH_INTERFACE, 270, 16, 128 },
+ { BCRYPT_RSA_ALGORITHM, BCRYPT_ASYMMETRIC_ENCRYPTION_INTERFACE, 0, 0, 0 },
+ { BCRYPT_ECDH_P256_ALGORITHM, BCRYPT_SECRET_AGREEMENT_INTERFACE, 0, 0, 0 },
+ { BCRYPT_RSA_SIGN_ALGORITHM, BCRYPT_SIGNATURE_INTERFACE, 0, 0, 0 },
+ { BCRYPT_ECDSA_P256_ALGORITHM, BCRYPT_SIGNATURE_INTERFACE, 0, 0, 0 },
+ { BCRYPT_ECDSA_P384_ALGORITHM, BCRYPT_SIGNATURE_INTERFACE, 0, 0, 0 },
+ { BCRYPT_RNG_ALGORITHM, BCRYPT_RNG_INTERFACE, 0, 0, 0 },
};
+static BOOL match_operation_type( ULONG type, ULONG class )
+{
+ if (!type) return TRUE;
+ switch (class)
+ {
+ case BCRYPT_CIPHER_INTERFACE: return type & BCRYPT_CIPHER_OPERATION;
+ case BCRYPT_HASH_INTERFACE: return type & BCRYPT_HASH_OPERATION;
+ case BCRYPT_ASYMMETRIC_ENCRYPTION_INTERFACE: return type & BCRYPT_ASYMMETRIC_ENCRYPTION_OPERATION;
+ case BCRYPT_SECRET_AGREEMENT_INTERFACE: return type & BCRYPT_SECRET_AGREEMENT_OPERATION;
+ case BCRYPT_SIGNATURE_INTERFACE: return type & BCRYPT_SIGNATURE_OPERATION;
+ case BCRYPT_RNG_INTERFACE: return type & BCRYPT_RNG_OPERATION;
+ default: break;
+ }
+ return FALSE;
+}
+
+NTSTATUS WINAPI BCryptEnumAlgorithms( ULONG type, ULONG *ret_count, BCRYPT_ALGORITHM_IDENTIFIER **ret_list, ULONG flags )
+{
+ static const ULONG supported = BCRYPT_CIPHER_OPERATION |\
+ BCRYPT_HASH_OPERATION |\
+ BCRYPT_ASYMMETRIC_ENCRYPTION_OPERATION |\
+ BCRYPT_SECRET_AGREEMENT_OPERATION |\
+ BCRYPT_SIGNATURE_OPERATION |\
+ BCRYPT_RNG_OPERATION;
+ BCRYPT_ALGORITHM_IDENTIFIER *list;
+ ULONG i, count = 0;
+
+ TRACE( "%08x, %p, %p, %08x\n", type, ret_count, ret_list, flags );
+
+ if (!ret_count || !ret_list || (type & ~supported)) return STATUS_INVALID_PARAMETER;
+
+ for (i = 0; i < ARRAY_SIZE( builtin_algorithms ); i++)
+ {
+ if (match_operation_type( type, builtin_algorithms[i].class )) count++;
+ }
+
+ if (!(list = heap_alloc( count * sizeof(*list) ))) return STATUS_NO_MEMORY;
+
+ for (i = 0; i < ARRAY_SIZE( builtin_algorithms ); i++)
+ {
+ if (!match_operation_type( type, builtin_algorithms[i].class )) continue;
+ list[i].pszName = (WCHAR *)builtin_algorithms[i].name;
+ list[i].dwClass = builtin_algorithms[i].class;
+ list[i].dwFlags = 0;
+ }
+
+ *ret_count = count;
+ *ret_list = list;
+ return STATUS_SUCCESS;
+}
+
NTSTATUS WINAPI BCryptGenRandom(BCRYPT_ALG_HANDLE handle, UCHAR *buffer, ULONG count, ULONG flags)
{
const DWORD supported_flags = BCRYPT_USE_SYSTEM_PREFERRED_RNG;
@@ -177,6 +219,7 @@ NTSTATUS WINAPI BCryptOpenAlgorithmProvider( BCRYPT_ALG_HANDLE *handle, LPCWSTR
const DWORD supported_flags = BCRYPT_ALG_HANDLE_HMAC_FLAG;
struct algorithm *alg;
enum alg_id alg_id;
+ ULONG i;
TRACE( "%p, %s, %s, %08x\n", handle, wine_dbgstr_w(id), wine_dbgstr_w(implementation), flags );
@@ -187,25 +230,20 @@ NTSTATUS WINAPI BCryptOpenAlgorithmProvider( BCRYPT_ALG_HANDLE *handle, LPCWSTR
return STATUS_NOT_IMPLEMENTED;
}
- if (!strcmpW( id, BCRYPT_AES_ALGORITHM )) alg_id = ALG_ID_AES;
- else if (!strcmpW( id, BCRYPT_MD2_ALGORITHM )) alg_id = ALG_ID_MD2;
- else if (!strcmpW( id, BCRYPT_MD4_ALGORITHM )) alg_id = ALG_ID_MD4;
- else if (!strcmpW( id, BCRYPT_MD5_ALGORITHM )) alg_id = ALG_ID_MD5;
- else if (!strcmpW( id, BCRYPT_RNG_ALGORITHM )) alg_id = ALG_ID_RNG;
- else if (!strcmpW( id, BCRYPT_RSA_ALGORITHM )) alg_id = ALG_ID_RSA;
- else if (!strcmpW( id, BCRYPT_RSA_SIGN_ALGORITHM )) alg_id = ALG_ID_RSA;
- else if (!strcmpW( id, BCRYPT_SHA1_ALGORITHM )) alg_id = ALG_ID_SHA1;
- else if (!strcmpW( id, BCRYPT_SHA256_ALGORITHM )) alg_id = ALG_ID_SHA256;
- else if (!strcmpW( id, BCRYPT_SHA384_ALGORITHM )) alg_id = ALG_ID_SHA384;
- else if (!strcmpW( id, BCRYPT_SHA512_ALGORITHM )) alg_id = ALG_ID_SHA512;
- else if (!strcmpW( id, BCRYPT_ECDH_P256_ALGORITHM )) alg_id = ALG_ID_ECDH_P256;
- else if (!strcmpW( id, BCRYPT_ECDSA_P256_ALGORITHM )) alg_id = ALG_ID_ECDSA_P256;
- else if (!strcmpW( id, BCRYPT_ECDSA_P384_ALGORITHM )) alg_id = ALG_ID_ECDSA_P384;
- else
+ for (i = 0; i < ARRAY_SIZE( builtin_algorithms ); i++)
+ {
+ if (!strcmpW( id, builtin_algorithms[i].name))
+ {
+ alg_id = i;
+ break;
+ }
+ }
+ if (i == ARRAY_SIZE( builtin_algorithms ))
{
FIXME( "algorithm %s not supported\n", debugstr_w(id) );
return STATUS_NOT_IMPLEMENTED;
}
+
if (implementation && strcmpW( implementation, MS_PRIMITIVE_PROVIDER ))
{
FIXME( "implementation %s not supported\n", debugstr_w(implementation) );
@@ -398,35 +436,35 @@ static NTSTATUS generic_alg_property( enum alg_id id, const WCHAR *prop, UCHAR *
{
if (!strcmpW( prop, BCRYPT_OBJECT_LENGTH ))
{
- if (!alg_props[id].object_length)
+ if (!builtin_algorithms[id].object_length)
return STATUS_NOT_SUPPORTED;
*ret_size = sizeof(ULONG);
if (size < sizeof(ULONG))
return STATUS_BUFFER_TOO_SMALL;
if (buf)
- *(ULONG *)buf = alg_props[id].object_length;
+ *(ULONG *)buf = builtin_algorithms[id].object_length;
return STATUS_SUCCESS;
}
if (!strcmpW( prop, BCRYPT_HASH_LENGTH ))
{
- if (!alg_props[id].hash_length)
+ if (!builtin_algorithms[id].hash_length)
return STATUS_NOT_SUPPORTED;
*ret_size = sizeof(ULONG);
if (size < sizeof(ULONG))
return STATUS_BUFFER_TOO_SMALL;
if(buf)
- *(ULONG*)buf = alg_props[id].hash_length;
+ *(ULONG*)buf = builtin_algorithms[id].hash_length;
return STATUS_SUCCESS;
}
if (!strcmpW( prop, BCRYPT_ALGORITHM_NAME ))
{
- *ret_size = (strlenW(alg_props[id].alg_name)+1)*sizeof(WCHAR);
+ *ret_size = (strlenW(builtin_algorithms[id].name) + 1) * sizeof(WCHAR);
if (size < *ret_size)
return STATUS_BUFFER_TOO_SMALL;
if(buf)
- memcpy(buf, alg_props[id].alg_name, *ret_size);
+ memcpy(buf, builtin_algorithms[id].name, *ret_size);
return STATUS_SUCCESS;
}
@@ -616,14 +654,14 @@ static NTSTATUS prepare_hash( struct hash *hash )
/* initialize hmac */
if ((status = hash_init( &hash->outer, hash->alg_id ))) return status;
- block_bytes = alg_props[hash->alg_id].block_bits / 8;
+ block_bytes = builtin_algorithms[hash->alg_id].block_bits / 8;
if (hash->secret_len > block_bytes)
{
struct hash_impl temp;
if ((status = hash_init( &temp, hash->alg_id ))) return status;
if ((status = hash_update( &temp, hash->alg_id, hash->secret, hash->secret_len ))) return status;
if ((status = hash_finish( &temp, hash->alg_id, buffer,
- alg_props[hash->alg_id].hash_length ))) return status;
+ builtin_algorithms[hash->alg_id].hash_length ))) return status;
}
else memcpy( buffer, hash->secret, hash->secret_len );
@@ -747,7 +785,7 @@ NTSTATUS WINAPI BCryptFinishHash( BCRYPT_HASH_HANDLE handle, UCHAR *output, ULON
return STATUS_SUCCESS;
}
- hash_length = alg_props[hash->alg_id].hash_length;
+ hash_length = builtin_algorithms[hash->alg_id].hash_length;
if ((status = hash_finish( &hash->inner, hash->alg_id, buffer, hash_length ))) return status;
if ((status = hash_update( &hash->outer, hash->alg_id, buffer, hash_length ))) return status;
if ((status = hash_finish( &hash->outer, hash->alg_id, output, size ))) return status;
@@ -790,7 +828,7 @@ NTSTATUS WINAPI BCryptHash( BCRYPT_ALG_HANDLE algorithm, UCHAR *secret, ULONG se
#if defined(HAVE_GNUTLS_CIPHER_INIT) || defined(HAVE_COMMONCRYPTO_COMMONCRYPTOR_H) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
BOOL key_is_symmetric( struct key *key )
{
- return alg_props[key->alg_id].symmetric;
+ return builtin_algorithms[key->alg_id].class == BCRYPT_CIPHER_INTERFACE;
}
static NTSTATUS key_import( BCRYPT_ALG_HANDLE algorithm, const WCHAR *type, BCRYPT_KEY_HANDLE *key, UCHAR *object,
@@ -1156,7 +1194,8 @@ static NTSTATUS key_import_pair( struct algorithm *alg, const WCHAR *type, BCRYP
ULONG size;
if (input_len < sizeof(*rsa_blob)) return STATUS_INVALID_PARAMETER;
- if (alg->id != ALG_ID_RSA || rsa_blob->Magic != BCRYPT_RSAPUBLIC_MAGIC) return STATUS_NOT_SUPPORTED;
+ if ((alg->id != ALG_ID_RSA && alg->id != ALG_ID_RSA_SIGN) || rsa_blob->Magic != BCRYPT_RSAPUBLIC_MAGIC)
+ return STATUS_NOT_SUPPORTED;
if (!(key = heap_alloc_zero( sizeof(*key) ))) return STATUS_NO_MEMORY;
key->hdr.magic = MAGIC_KEY;
@@ -1601,7 +1640,7 @@ NTSTATUS WINAPI BCryptDeriveKeyPBKDF2( BCRYPT_ALG_HANDLE handle, UCHAR *pwd, ULO
if (!alg || alg->hdr.magic != MAGIC_ALG) return STATUS_INVALID_HANDLE;
- hash_len = alg_props[alg->id].hash_length;
+ hash_len = builtin_algorithms[alg->id].hash_length;
if (dk_len <= 0 || dk_len > ((((ULONGLONG)1) << 32) - 1) * hash_len) return STATUS_INVALID_PARAMETER;
block_count = 1 + ((dk_len - 1) / hash_len); /* ceil(dk_len / hash_len) */
diff --git a/dlls/bcrypt/gnutls.c b/dlls/bcrypt/gnutls.c
index 5b59b617aa..41bba0b821 100644
--- a/dlls/bcrypt/gnutls.c
+++ b/dlls/bcrypt/gnutls.c
@@ -672,6 +672,7 @@ NTSTATUS key_asymmetric_generate( struct key *key )
switch (key->alg_id)
{
case ALG_ID_RSA:
+ case ALG_ID_RSA_SIGN:
pk_alg = GNUTLS_PK_RSA;
bitlen = key->u.a.bitlen;
break;
@@ -841,6 +842,7 @@ NTSTATUS key_asymmetric_init( struct key *key, struct algorithm *alg, ULONG bitl
case ALG_ID_ECDSA_P256:
case ALG_ID_ECDSA_P384:
case ALG_ID_RSA:
+ case ALG_ID_RSA_SIGN:
break;
default:
@@ -936,6 +938,7 @@ static NTSTATUS import_gnutls_pubkey( struct key *key, gnutls_pubkey_t *gnutls_k
return import_gnutls_pubkey_ecc( key, gnutls_key );
case ALG_ID_RSA:
+ case ALG_ID_RSA_SIGN:
return import_gnutls_pubkey_rsa( key, gnutls_key );
default:
@@ -984,6 +987,7 @@ static NTSTATUS prepare_gnutls_signature( struct key *key, UCHAR *signature, ULO
return prepare_gnutls_signature_ecc( key, signature, signature_len, gnutls_signature );
case ALG_ID_RSA:
+ case ALG_ID_RSA_SIGN:
return prepare_gnutls_signature_rsa( key, signature, signature_len, gnutls_signature );
default:
@@ -1024,6 +1028,7 @@ NTSTATUS key_asymmetric_verify( struct key *key, void *padding, UCHAR *hash, ULO
break;
}
case ALG_ID_RSA:
+ case ALG_ID_RSA_SIGN:
{
BCRYPT_PKCS1_PADDING_INFO *info = (BCRYPT_PKCS1_PADDING_INFO *)padding;
@@ -1076,7 +1081,7 @@ NTSTATUS key_asymmetric_sign( struct key *key, void *padding, UCHAR *input, ULON
gnutls_datum_t hash, signature;
int ret;
- if (key->alg_id != ALG_ID_RSA)
+ if (key->alg_id != ALG_ID_RSA && key->alg_id != ALG_ID_RSA_SIGN)
{
FIXME( "algorithm %u not supported\n", key->alg_id );
return STATUS_NOT_IMPLEMENTED;
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
index 8975800f43..5ae847ca6e 100644
--- a/dlls/bcrypt/tests/bcrypt.c
+++ b/dlls/bcrypt/tests/bcrypt.c
@@ -40,6 +40,7 @@ static NTSTATUS (WINAPI *pBCryptDuplicateHash)(BCRYPT_HASH_HANDLE, BCRYPT_HASH_H
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);
@@ -2100,6 +2101,33 @@ static void test_BCryptSignHash(void)
ok(!ret, "got %08x\n", ret);
}
+static void test_BCryptEnumAlgorithms(void)
+{
+ BCRYPT_ALGORITHM_IDENTIFIER *list;
+ NTSTATUS ret;
+ ULONG count;
+
+ ret = pBCryptEnumAlgorithms(0, NULL, NULL, 0);
+ ok(ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret);
+
+ ret = pBCryptEnumAlgorithms(0, &count, NULL, 0);
+ ok(ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret);
+
+ ret = pBCryptEnumAlgorithms(0, NULL, &list, 0);
+ ok(ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret);
+
+ ret = pBCryptEnumAlgorithms(~0u, &count, &list, 0);
+ ok(ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret);
+
+ count = 0;
+ list = NULL;
+ ret = pBCryptEnumAlgorithms(0, &count, &list, 0);
+ ok(!ret, "got %08x\n", ret);
+ ok(list != NULL, "NULL list\n");
+ ok(count, "got %u\n", count);
+ pBCryptFreeBuffer( list );
+}
+
START_TEST(bcrypt)
{
HMODULE module;
@@ -2120,6 +2148,7 @@ START_TEST(bcrypt)
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");
@@ -2156,6 +2185,7 @@ START_TEST(bcrypt)
test_ECDH();
test_BCryptEnumContextFunctions();
test_BCryptSignHash();
+ test_BCryptEnumAlgorithms();
FreeLibrary(module);
}
diff --git a/include/bcrypt.h b/include/bcrypt.h
index 4638e51dcf..4546aea394 100644
--- a/include/bcrypt.h
+++ b/include/bcrypt.h
@@ -162,6 +162,21 @@ static const WCHAR BCRYPT_CHAIN_MODE_GCM[] = {'C','h','a','i','n','i','n','g','M
#define BCRYPT_ECDH_PUBLIC_P521_MAGIC 0x354b4345
#define BCRYPT_ECDH_PRIVATE_P521_MAGIC 0x364b4345
+#define BCRYPT_CIPHER_OPERATION 0x00000001
+#define BCRYPT_HASH_OPERATION 0x00000002
+#define BCRYPT_ASYMMETRIC_ENCRYPTION_OPERATION 0x00000004
+#define BCRYPT_SECRET_AGREEMENT_OPERATION 0x00000008
+#define BCRYPT_SIGNATURE_OPERATION 0x00000010
+#define BCRYPT_RNG_OPERATION 0x00000020
+
+#define BCRYPT_CIPHER_INTERFACE 0x00000001
+#define BCRYPT_HASH_INTERFACE 0x00000002
+#define BCRYPT_ASYMMETRIC_ENCRYPTION_INTERFACE 0x00000003
+#define BCRYPT_SECRET_AGREEMENT_INTERFACE 0x00000004
+#define BCRYPT_SIGNATURE_INTERFACE 0x00000005
+#define BCRYPT_RNG_INTERFACE 0x00000006
+#define BCRYPT_KEY_DERIVATION_INTERFACE 0x00000007
+
typedef struct _BCRYPT_ALGORITHM_IDENTIFIER
{
LPWSTR pszName;
@@ -304,6 +319,7 @@ typedef struct _CRYPT_CONTEXT_FUNCTIONS
WCHAR **rgpszFunctions;
} CRYPT_CONTEXT_FUNCTIONS, *PCRYPT_CONTEXT_FUNCTIONS;
+NTSTATUS WINAPI BCryptAddContextFunction(ULONG, LPCWSTR, ULONG, LPCWSTR, ULONG);
NTSTATUS WINAPI BCryptCloseAlgorithmProvider(BCRYPT_ALG_HANDLE, ULONG);
NTSTATUS WINAPI BCryptCreateHash(BCRYPT_ALG_HANDLE, BCRYPT_HASH_HANDLE *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG);
NTSTATUS WINAPI BCryptDecrypt(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG *, ULONG);
@@ -313,23 +329,28 @@ NTSTATUS WINAPI BCryptDestroyHash(BCRYPT_HASH_HANDLE);
NTSTATUS WINAPI BCryptDestroyKey(BCRYPT_KEY_HANDLE);
NTSTATUS WINAPI BCryptDestroySecret(BCRYPT_SECRET_HANDLE);
NTSTATUS WINAPI BCryptDuplicateHash(BCRYPT_HASH_HANDLE, BCRYPT_HASH_HANDLE *, UCHAR *, ULONG, ULONG);
+NTSTATUS WINAPI BCryptDuplicateKey(BCRYPT_KEY_HANDLE, BCRYPT_KEY_HANDLE *, PUCHAR, ULONG, ULONG);
NTSTATUS WINAPI BCryptEncrypt(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG *, ULONG);
NTSTATUS WINAPI BCryptEnumAlgorithms(ULONG, ULONG *, BCRYPT_ALGORITHM_IDENTIFIER **, ULONG);
NTSTATUS WINAPI BCryptEnumContextFunctions(ULONG, const WCHAR *, ULONG, ULONG *, CRYPT_CONTEXT_FUNCTIONS **);
+NTSTATUS WINAPI BCryptExportKey(BCRYPT_KEY_HANDLE, BCRYPT_KEY_HANDLE, LPCWSTR, PUCHAR, ULONG, ULONG *, ULONG);
NTSTATUS WINAPI BCryptFinalizeKeyPair(BCRYPT_KEY_HANDLE, ULONG);
NTSTATUS WINAPI BCryptFinishHash(BCRYPT_HASH_HANDLE, PUCHAR, ULONG, ULONG);
void WINAPI BCryptFreeBuffer(void *);
+NTSTATUS WINAPI BCryptGenRandom(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, ULONG);
NTSTATUS WINAPI BCryptGenerateKeyPair(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE *, ULONG, ULONG);
NTSTATUS WINAPI BCryptGenerateSymmetricKey(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG);
-NTSTATUS WINAPI BCryptGenRandom(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, ULONG);
NTSTATUS WINAPI BCryptGetFipsAlgorithmMode(BOOLEAN *);
NTSTATUS WINAPI BCryptGetProperty(BCRYPT_HANDLE, LPCWSTR, PUCHAR, ULONG, ULONG *, ULONG);
NTSTATUS WINAPI BCryptHash(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, PUCHAR, ULONG, PUCHAR, ULONG);
NTSTATUS WINAPI BCryptHashData(BCRYPT_HASH_HANDLE, PUCHAR, ULONG, ULONG);
+NTSTATUS WINAPI BCryptImportKey(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE, LPCWSTR, BCRYPT_KEY_HANDLE *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG);
NTSTATUS WINAPI BCryptImportKeyPair(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE, LPCWSTR, BCRYPT_KEY_HANDLE *, UCHAR *, ULONG, ULONG);
NTSTATUS WINAPI BCryptOpenAlgorithmProvider(BCRYPT_ALG_HANDLE *, LPCWSTR, LPCWSTR, ULONG);
+NTSTATUS WINAPI BCryptRemoveContextFunction(ULONG, LPCWSTR, ULONG, LPCWSTR);
NTSTATUS WINAPI BCryptSecretAgreement(BCRYPT_KEY_HANDLE, BCRYPT_KEY_HANDLE, BCRYPT_SECRET_HANDLE *, ULONG);
NTSTATUS WINAPI BCryptSetProperty(BCRYPT_HANDLE, LPCWSTR, PUCHAR, ULONG, ULONG);
+NTSTATUS WINAPI BCryptSignHash(BCRYPT_KEY_HANDLE, void *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG *, ULONG);
NTSTATUS WINAPI BCryptVerifySignature(BCRYPT_KEY_HANDLE, void *, UCHAR *, ULONG, UCHAR *, ULONG, ULONG);
#endif /* __WINE_BCRYPT_H */
--
2.20.1
Sept. 30, 2019
Re: [PATCH] msvcrt: Implement %R format for strftime
by Piotr Caban
Hi Vijay,
On 9/30/19 4:17 PM, Vijay Kiran Kamuju wrote:
> + case 'R':
> + if(!strftime_int(str, &ret, max, mstm->tm_hour, alternate ? 0 : 2, 0, 23))
> + return 0;
> + str[ret++] = ':';
I've sent changed version of the patch that takes str buffer size into
account when writing ':'.
Thanks,
Piotr
Sept. 30, 2019
[PATCH 2/2 v2] msvcrt: Implement %R format for strftime
by Piotr Caban
From: Vijay Kiran Kamuju <infyquest(a)gmail.com>
Signed-off-by: Vijay Kiran Kamuju <infyquest(a)gmail.com>
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
---
dlls/msvcrt/tests/time.c | 5 +++++
dlls/msvcrt/time.c | 10 ++++++++++
dlls/ucrtbase/tests/misc.c | 8 ++++++++
3 files changed, 23 insertions(+)
Sept. 30, 2019
[PATCH 1/2] msvcrt: Don't write past buffer in strftime.
by Piotr Caban
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
---
dlls/msvcrt/time.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Sept. 30, 2019
Re: [PATCH v2 3/3] msscript.ocx/tests: Add tests for IScriptControl::Run.
by Jacek Caban
Hi Gabriel,
On 9/30/19 2:43 PM, Gabriel Ivăncescu wrote:
> {
> + if (!lstrcmpW(V_BSTR(pDispParams->rgvarg), L"change me"))
> + {
> + /* Change the string to check whether it's copied or not */
> + lstrcpyW(V_BSTR(pDispParams->rgvarg), L"changed");
> + }
> + else
> + ok(!lstrcmpW(V_BSTR(pDispParams->rgvarg), L"changed"),
> + "unexpected second parameter %s.\n", wine_dbgstr_w(V_BSTR(pDispParams->rgvarg)));
> + }
> + else
> + ok(0, "unexpected non-string second parameter V_VT = %d.\n", V_VT(pDispParams->rgvarg));
While I can see why it was interesting for your experimentations, this
is not really nice nor something that seems important to have in tests.
But please remove this part. The rest of the patch looks good.
Thanks,
Jacek
Sept. 30, 2019
Re: [PATCH v2 2/3] msscript.ocx: Implement IScriptControl::Run.
by Jacek Caban
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
Sept. 30, 2019
Re: [PATCH v2 1/3] msscript.ocx: Move set_script_state to the top.
by Jacek Caban
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
Sept. 30, 2019
[PATCH] scrrun: Add support for TristateUseDefault text stream format.
by Jacek Caban
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
dlls/scrrun/filesystem.c | 62 ++++++++++-------
dlls/scrrun/tests/filesystem.c | 121 +++++++++++++++++++++++++++++++++
2 files changed, 159 insertions(+), 24 deletions(-)
Sept. 30, 2019