bcrypt: Support retrieving the PaddingSchemes property for RSA.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2020-02-17 13:35:42 +01:00 committed by Alexandre Julliard
parent f29d4a43e2
commit 2bd5a8d572
3 changed files with 30 additions and 1 deletions

View File

@ -528,6 +528,20 @@ static NTSTATUS get_aes_property( enum mode_id mode, const WCHAR *prop, UCHAR *b
return STATUS_NOT_IMPLEMENTED;
}
static NTSTATUS get_rsa_property( enum mode_id mode, const WCHAR *prop, UCHAR *buf, ULONG size, ULONG *ret_size )
{
if (!strcmpW( prop, BCRYPT_PADDING_SCHEMES ))
{
*ret_size = sizeof(ULONG);
if (size < sizeof(ULONG)) return STATUS_BUFFER_TOO_SMALL;
if (buf) *(ULONG *)buf = BCRYPT_SUPPORTED_PAD_PKCS1_SIG;
return STATUS_SUCCESS;
}
FIXME( "unsupported property %s\n", debugstr_w(prop) );
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS get_alg_property( const struct algorithm *alg, const WCHAR *prop, UCHAR *buf, ULONG size, ULONG *ret_size )
{
NTSTATUS status;
@ -541,6 +555,9 @@ NTSTATUS get_alg_property( const struct algorithm *alg, const WCHAR *prop, UCHAR
case ALG_ID_AES:
return get_aes_property( alg->mode, prop, buf, size, ret_size );
case ALG_ID_RSA:
return get_rsa_property( alg->mode, prop, buf, size, ret_size );
default:
break;
}

View File

@ -1786,7 +1786,7 @@ static void test_RSA(void)
BCRYPT_KEY_HANDLE key;
BCRYPT_RSAKEY_BLOB *rsablob;
UCHAR sig[64];
ULONG len, size;
ULONG len, size, schemes;
NTSTATUS ret;
BYTE *buf;
@ -1797,6 +1797,12 @@ static void test_RSA(void)
return;
}
schemes = size = 0;
ret = pBCryptGetProperty(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);

View File

@ -189,6 +189,12 @@ static const WCHAR BCRYPT_KDF_RAW_SECRET[] = {'T','R','U','N','C','A','T','E',0}
#define BCRYPT_RNG_INTERFACE 0x00000006
#define BCRYPT_KEY_DERIVATION_INTERFACE 0x00000007
#define BCRYPT_SUPPORTED_PAD_ROUTER 0x00000001
#define BCRYPT_SUPPORTED_PAD_PKCS1_ENC 0x00000002
#define BCRYPT_SUPPORTED_PAD_PKCS1_SIG 0x00000004
#define BCRYPT_SUPPORTED_PAD_OAEP 0x00000008
#define BCRYPT_SUPPORTED_PAD_PSS 0x00000010
typedef struct _BCRYPT_ALGORITHM_IDENTIFIER
{
LPWSTR pszName;