Commit 2bd5a8d5 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

bcrypt: Support retrieving the PaddingSchemes property for RSA.

parent f29d4a43
......@@ -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;
}
......
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment