Signed-off-by: Hans Leidekker hans@codeweavers.com --- dlls/bcrypt/bcrypt_main.c | 17 +++++++++++++++++ dlls/bcrypt/tests/bcrypt.c | 8 +++++++- include/bcrypt.h | 6 ++++++ 3 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c index 298bfb4007..c2939ea815 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -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; } diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c index 0dc2085111..f7404057fa 100644 --- a/dlls/bcrypt/tests/bcrypt.c +++ b/dlls/bcrypt/tests/bcrypt.c @@ -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);
diff --git a/include/bcrypt.h b/include/bcrypt.h index 0bc4dea910..3dcab5f75a 100644 --- a/include/bcrypt.h +++ b/include/bcrypt.h @@ -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;