Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
1d7800bd
Commit
1d7800bd
authored
Jan 03, 2005
by
Michael Jung
Committed by
Alexandre Julliard
Jan 03, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented parallel hashing in CPEncrypt and CPDecrypt.
Implemented CPHashSessionKey.
parent
054f9ecc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
7 deletions
+61
-7
rsaenh.c
dlls/rsaenh/rsaenh.c
+56
-7
wincrypt.h
include/wincrypt.h
+5
-0
No files found.
dlls/rsaenh/rsaenh.c
View file @
1d7800bd
...
...
@@ -240,6 +240,15 @@ RSAENH_CPImportKey(
HCRYPTKEY
*
phKey
);
BOOL
WINAPI
RSAENH_CPHashData
(
HCRYPTPROV
hProv
,
HCRYPTHASH
hHash
,
CONST
BYTE
*
pbData
,
DWORD
dwDataLen
,
DWORD
dwFlags
);
/******************************************************************************
* CSP's handle table (used by all acquired key containers)
*/
...
...
@@ -1317,9 +1326,6 @@ BOOL WINAPI RSAENH_CPDuplicateKey(HCRYPTPROV hUID, HCRYPTKEY hKey, DWORD *pdwRes
* This is useful for message signatures.
*
* This function uses the standard WINAPI protocol for querying data of dynamic length.
*
* FIXME
* Parallel hashing not yet implemented.
*/
BOOL
WINAPI
RSAENH_CPEncrypt
(
HCRYPTPROV
hProv
,
HCRYPTKEY
hKey
,
HCRYPTHASH
hHash
,
BOOL
Final
,
DWORD
dwFlags
,
BYTE
*
pbData
,
DWORD
*
pdwDataLen
,
DWORD
dwBufLen
)
...
...
@@ -1359,6 +1365,10 @@ BOOL WINAPI RSAENH_CPEncrypt(HCRYPTPROV hProv, HCRYPTKEY hKey, HCRYPTHASH hHash,
return
FALSE
;
}
if
(
is_valid_handle
(
&
handle_table
,
hHash
,
RSAENH_MAGIC_HASH
))
{
if
(
!
RSAENH_CPHashData
(
hProv
,
hHash
,
pbData
,
*
pdwDataLen
,
0
))
return
FALSE
;
}
if
(
GET_ALG_TYPE
(
pCryptKey
->
aiAlgid
)
==
ALG_TYPE_BLOCK
)
{
if
(
!
Final
&&
(
*
pdwDataLen
%
pCryptKey
->
dwBlockLen
))
{
SetLastError
(
NTE_BAD_DATA
);
...
...
@@ -1438,9 +1448,6 @@ BOOL WINAPI RSAENH_CPEncrypt(HCRYPTPROV hProv, HCRYPTKEY hKey, HCRYPTHASH hHash,
* This is useful for message signatures.
*
* This function uses the standard WINAPI protocol for querying data of dynamic length.
*
* FIXME
* Parallel hashing not yet implemented.
*/
BOOL
WINAPI
RSAENH_CPDecrypt
(
HCRYPTPROV
hProv
,
HCRYPTKEY
hKey
,
HCRYPTHASH
hHash
,
BOOL
Final
,
DWORD
dwFlags
,
BYTE
*
pbData
,
DWORD
*
pdwDataLen
)
...
...
@@ -1520,6 +1527,10 @@ BOOL WINAPI RSAENH_CPDecrypt(HCRYPTPROV hProv, HCRYPTKEY hKey, HCRYPTHASH hHash,
}
if
(
Final
)
setup_key
(
pCryptKey
);
if
(
is_valid_handle
(
&
handle_table
,
hHash
,
RSAENH_MAGIC_HASH
))
{
if
(
!
RSAENH_CPHashData
(
hProv
,
hHash
,
pbData
,
*
pdwDataLen
,
0
))
return
FALSE
;
}
return
TRUE
;
}
...
...
@@ -2533,12 +2544,50 @@ BOOL WINAPI RSAENH_CPHashData(HCRYPTPROV hProv, HCRYPTHASH hHash, CONST BYTE *pb
/******************************************************************************
* CPHashSessionKey (RSAENH.@)
*
* Updates a hash object with the binary representation of a symmetric key.
*
* PARAMS
* hProv [I] Key container to which the hash object belongs.
* hHash [I] Hash object which is to be updated.
* hKey [I] The symmetric key, whose binary value will be added to the hash.
* dwFlags [I] CRYPT_LITTLE_ENDIAN, if the binary key value shall be interpreted as little endian.
*
* RETURNS
* Success: TRUE.
* Failure: FALSE.
*/
BOOL
WINAPI
RSAENH_CPHashSessionKey
(
HCRYPTPROV
hProv
,
HCRYPTHASH
hHash
,
HCRYPTKEY
hKey
,
DWORD
dwFlags
)
{
FIXME
(
"(stub)
\n
"
);
BYTE
abKeyValue
[
RSAENH_MAX_KEY_SIZE
],
bTemp
;
CRYPTKEY
*
pKey
;
DWORD
i
;
TRACE
(
"(hProv=%08lx, hHash=%08lx, hKey=%08lx, dwFlags=%08lx)
\n
"
,
hProv
,
hHash
,
hKey
,
dwFlags
);
if
(
!
lookup_handle
(
&
handle_table
,
(
unsigned
int
)
hKey
,
RSAENH_MAGIC_KEY
,
(
OBJECTHDR
**
)
&
pKey
)
||
(
GET_ALG_CLASS
(
pKey
->
aiAlgid
)
!=
ALG_CLASS_DATA_ENCRYPT
))
{
SetLastError
(
NTE_BAD_KEY
);
return
FALSE
;
}
if
(
dwFlags
&
~
CRYPT_LITTLE_ENDIAN
)
{
SetLastError
(
NTE_BAD_FLAGS
);
return
FALSE
;
}
memcpy
(
abKeyValue
,
pKey
->
abKeyValue
,
pKey
->
dwKeyLen
);
if
(
!
(
dwFlags
&
CRYPT_LITTLE_ENDIAN
))
{
for
(
i
=
0
;
i
<
pKey
->
dwKeyLen
/
2
;
i
++
)
{
bTemp
=
abKeyValue
[
i
];
abKeyValue
[
i
]
=
abKeyValue
[
pKey
->
dwKeyLen
-
i
-
1
];
abKeyValue
[
pKey
->
dwKeyLen
-
i
-
1
]
=
bTemp
;
}
}
return
RSAENH_CPHashData
(
hProv
,
hHash
,
abKeyValue
,
pKey
->
dwKeyLen
,
0
);
}
/******************************************************************************
...
...
include/wincrypt.h
View file @
1d7800bd
...
...
@@ -748,10 +748,15 @@ static const WCHAR MS_SCARD_PROV_W[] = { 'M','i','c','r','o','s','o','
#define CRYPT_NO_SALT 0x00000010
#define CRYPT_PREGEN 0x00000040
#define CRYPT_ARCHIVABLE 0x00004000
/* CryptExportKey */
#define CRYPT_SSL2_FALLBACK 0x00000002
#define CRYPT_DESTROYKEY 0x00000004
#define CRYPT_OAEP 0x00000040
/* CryptHashSessionKey */
#define CRYPT_LITTLE_ENDIAN 0x00000001
/* Blob Types */
#define SIMPLEBLOB 0x1
#define PUBLICKEYBLOB 0x6
...
...
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