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
3a6196b7
Commit
3a6196b7
authored
May 03, 2011
by
Piotr Caban
Committed by
Alexandre Julliard
May 03, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wintrust: Added CryptSIPPutSignedDataMsg implementation (for PE files).
parent
0cd94ac5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
9 deletions
+59
-9
crypt.c
dlls/wintrust/crypt.c
+59
-9
No files found.
dlls/wintrust/crypt.c
View file @
3a6196b7
...
...
@@ -1087,6 +1087,42 @@ error:
return
ret
;
}
static
BOOL
WINTRUST_PutSignedMsgToPEFile
(
SIP_SUBJECTINFO
*
pSubjectInfo
,
DWORD
pdwEncodingType
,
DWORD
*
pdwIndex
,
DWORD
cbSignedDataMsg
,
BYTE
*
pbSignedDataMsg
)
{
WIN_CERTIFICATE
*
cert
;
HANDLE
file
;
DWORD
size
;
BOOL
ret
;
if
(
pSubjectInfo
->
hFile
&&
pSubjectInfo
->
hFile
!=
INVALID_HANDLE_VALUE
)
file
=
pSubjectInfo
->
hFile
;
else
{
file
=
CreateFileW
(
pSubjectInfo
->
pwsFileName
,
GENERIC_READ
|
GENERIC_WRITE
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
0
,
NULL
);
if
(
file
==
INVALID_HANDLE_VALUE
)
return
FALSE
;
}
/* int aligned WIN_CERTIFICATE structure with cbSignedDataMsg+1 bytes of data */
size
=
FIELD_OFFSET
(
WIN_CERTIFICATE
,
bCertificate
[
cbSignedDataMsg
+
4
])
&
(
~
3
);
cert
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
size
);
if
(
!
cert
)
return
FALSE
;
cert
->
dwLength
=
size
;
cert
->
wRevision
=
WIN_CERT_REVISION_2_0
;
cert
->
wCertificateType
=
WIN_CERT_TYPE_PKCS_SIGNED_DATA
;
memcpy
(
cert
->
bCertificate
,
pbSignedDataMsg
,
cbSignedDataMsg
);
ret
=
ImageAddCertificate
(
file
,
cert
,
pdwIndex
);
HeapFree
(
GetProcessHeap
(),
0
,
cert
);
if
(
file
!=
pSubjectInfo
->
hFile
)
CloseHandle
(
file
);
return
ret
;
}
/* structure offsets */
#define cfhead_Signature (0x00)
#define cfhead_CabinetSize (0x08)
...
...
@@ -1296,18 +1332,20 @@ static BOOL WINTRUST_GetSignedMsgFromCatFile(SIP_SUBJECTINFO *pSubjectInfo,
return
ret
;
}
/* GUIDs used by CryptSIPGetSignedDataMsg and CryptSIPPutSignedDataMsg */
static
const
GUID
unknown
=
{
0xC689AAB8
,
0x8E78
,
0x11D0
,
{
0x8C
,
0x47
,
0x00
,
0xC0
,
0x4F
,
0xC2
,
0x95
,
0xEE
}
};
static
const
GUID
cabGUID
=
{
0xC689AABA
,
0x8E78
,
0x11D0
,
{
0x8C
,
0x47
,
0x00
,
0xC0
,
0x4F
,
0xC2
,
0x95
,
0xEE
}
};
static
const
GUID
catGUID
=
{
0xDE351A43
,
0x8E59
,
0x11D0
,
{
0x8C
,
0x47
,
0x00
,
0xC0
,
0x4F
,
0xC2
,
0x95
,
0xEE
}};
/***********************************************************************
* CryptSIPGetSignedDataMsg (WINTRUST.@)
*/
BOOL
WINAPI
CryptSIPGetSignedDataMsg
(
SIP_SUBJECTINFO
*
pSubjectInfo
,
DWORD
*
pdwEncodingType
,
DWORD
dwIndex
,
DWORD
*
pcbSignedDataMsg
,
BYTE
*
pbSignedDataMsg
)
{
static
const
GUID
unknown
=
{
0xC689AAB8
,
0x8E78
,
0x11D0
,
{
0x8C
,
0x47
,
0x00
,
0xC0
,
0x4F
,
0xC2
,
0x95
,
0xEE
}
};
static
const
GUID
cabGUID
=
{
0xC689AABA
,
0x8E78
,
0x11D0
,
{
0x8C
,
0x47
,
0x00
,
0xC0
,
0x4F
,
0xC2
,
0x95
,
0xEE
}
};
static
const
GUID
catGUID
=
{
0xDE351A43
,
0x8E59
,
0x11D0
,
{
0x8C
,
0x47
,
0x00
,
0xC0
,
0x4F
,
0xC2
,
0x95
,
0xEE
}};
BOOL
ret
;
TRACE
(
"(%p %p %d %p %p)
\n
"
,
pSubjectInfo
,
pdwEncodingType
,
dwIndex
,
...
...
@@ -1337,11 +1375,23 @@ BOOL WINAPI CryptSIPGetSignedDataMsg(SIP_SUBJECTINFO* pSubjectInfo, DWORD* pdwEn
* CryptSIPPutSignedDataMsg (WINTRUST.@)
*/
BOOL
WINAPI
CryptSIPPutSignedDataMsg
(
SIP_SUBJECTINFO
*
pSubjectInfo
,
DWORD
pdwEncodingType
,
DWORD
*
pdwIndex
,
DWORD
cbSignedDataMsg
,
BYTE
*
pbSignedDataMsg
)
DWORD
*
pdwIndex
,
DWORD
cbSignedDataMsg
,
BYTE
*
pbSignedDataMsg
)
{
FIXME
(
"(%p %d %p %d %p) stub
\n
"
,
pSubjectInfo
,
pdwEncodingType
,
pdwIndex
,
TRACE
(
"(%p %d %p %d %p)
\n
"
,
pSubjectInfo
,
pdwEncodingType
,
pdwIndex
,
cbSignedDataMsg
,
pbSignedDataMsg
);
if
(
!
pSubjectInfo
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
if
(
!
memcmp
(
pSubjectInfo
->
pgSubjectType
,
&
unknown
,
sizeof
(
unknown
)))
return
WINTRUST_PutSignedMsgToPEFile
(
pSubjectInfo
,
pdwEncodingType
,
pdwIndex
,
cbSignedDataMsg
,
pbSignedDataMsg
);
else
FIXME
(
"unimplemented for subject type %s
\n
"
,
debugstr_guid
(
pSubjectInfo
->
pgSubjectType
));
return
FALSE
;
}
...
...
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