Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
a88cc503
Commit
a88cc503
authored
Dec 14, 2022
by
Paul Gofman
Committed by
Alexandre Julliard
Dec 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcrypt/tests: Test BCRYPT_PAD_NONE encryption result in test_rsa_encrypt().
parent
e1fb6316
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletion
+18
-1
bcrypt.c
dlls/bcrypt/tests/bcrypt.c
+18
-1
No files found.
dlls/bcrypt/tests/bcrypt.c
View file @
a88cc503
...
...
@@ -2262,6 +2262,14 @@ static UCHAR rsaPublicBlobWithInvalidPublicExpSize[] =
0x87
,
0x75
,
0x33
,
0x15
,
0xb8
,
0xde
,
0x32
,
0x30
,
0xb4
,
0x5e
,
0xfd
};
static
const
UCHAR
rsa_encrypted_no_padding
[]
=
{
0x4a
,
0xc1
,
0xfa
,
0x4f
,
0xe0
,
0x3f
,
0x36
,
0x9a
,
0x64
,
0xbf
,
0x2e
,
0x00
,
0xb4
,
0xb5
,
0x40
,
0xbe
,
0x2d
,
0x9a
,
0x14
,
0xf6
,
0x8f
,
0xa5
,
0xc2
,
0xe2
,
0x20
,
0xaf
,
0x21
,
0x79
,
0xc6
,
0x32
,
0x7e
,
0xea
,
0x73
,
0x00
,
0x01
,
0xbb
,
0x9a
,
0x19
,
0x73
,
0x41
,
0x96
,
0xae
,
0x88
,
0x6e
,
0x36
,
0x56
,
0xe9
,
0x9c
,
0xac
,
0x04
,
0x82
,
0xa8
,
0x00
,
0xdb
,
0x4e
,
0x29
,
0x61
,
0x7e
,
0xaf
,
0x64
,
0xdb
,
0xa2
,
0x70
,
0x0f
,
};
static
void
test_rsa_encrypt
(
void
)
{
static
UCHAR
input
[]
=
"Hello World!"
;
...
...
@@ -2287,7 +2295,15 @@ static void test_rsa_encrypt(void)
/* Not finalized key */
ret
=
BCryptEncrypt
(
key
,
input
,
sizeof
(
input
),
NULL
,
NULL
,
0
,
NULL
,
0
,
&
encrypted_size
,
0
);
ok
(
ret
==
STATUS_INVALID_HANDLE
,
"got %lx
\n
"
,
ret
);
BCryptFinalizeKeyPair
(
key
,
0
);
BCryptDestroyKey
(
key
);
/* Import a different public key first to make sure a public key from private key improted next
* overrides it. */
ret
=
BCryptImportKeyPair
(
rsa
,
NULL
,
BCRYPT_RSAPUBLIC_BLOB
,
&
key
,
rsaPublicBlob
,
sizeof
(
rsaPublicBlob
),
0
);
ok
(
ret
==
STATUS_SUCCESS
,
"got %#lx
\n
"
,
ret
);
ret
=
BCryptImportKeyPair
(
rsa
,
NULL
,
BCRYPT_RSAPRIVATE_BLOB
,
&
key
,
rsaPrivateBlob
,
sizeof
(
rsaPrivateBlob
),
0
);
ok
(
ret
==
STATUS_SUCCESS
,
"got %#lx
\n
"
,
ret
);
todo_wine
{
/* No padding */
...
...
@@ -2313,6 +2329,7 @@ static void test_rsa_encrypt(void)
ret
=
BCryptEncrypt
(
key
,
input_no_padding
,
sizeof
(
input_no_padding
),
NULL
,
NULL
,
0
,
encrypted_b
,
encrypted_size
,
&
encrypted_size
,
BCRYPT_PAD_NONE
);
ok
(
ret
==
STATUS_SUCCESS
,
"got %lx
\n
"
,
ret
);
ok
(
!
memcmp
(
encrypted_a
,
encrypted_b
,
encrypted_size
),
"Both outputs should be the same
\n
"
);
ok
(
!
memcmp
(
encrypted_b
,
rsa_encrypted_no_padding
,
encrypted_size
),
"Data mismatch.
\n
"
);
BCryptDecrypt
(
key
,
encrypted_a
,
encrypted_size
,
NULL
,
NULL
,
0
,
NULL
,
0
,
&
decrypted_size
,
BCRYPT_PAD_NONE
);
decrypted
=
malloc
(
decrypted_size
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment