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
68fceb5e
Commit
68fceb5e
authored
Oct 14, 2010
by
Juan Lang
Committed by
Alexandre Julliard
Oct 15, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wintrust: Get time to verify from cryptographic message when present.
parent
a4c1b341
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
94 additions
and
1 deletion
+94
-1
softpub.c
dlls/wintrust/softpub.c
+94
-1
No files found.
dlls/wintrust/softpub.c
View file @
68fceb5e
...
...
@@ -24,6 +24,7 @@
#include "wintrust.h"
#include "mssip.h"
#include "softpub.h"
#include "winnls.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
wintrust
);
...
...
@@ -469,6 +470,98 @@ static CMSG_SIGNER_INFO *WINTRUST_GetSigner(CRYPT_PROVIDER_DATA *data,
return
signerInfo
;
}
static
BOOL
WINTRUST_GetTimeFromCounterSigner
(
const
CMSG_CMS_SIGNER_INFO
*
counterSignerInfo
,
FILETIME
*
time
)
{
DWORD
i
;
BOOL
foundTimeStamp
=
FALSE
;
for
(
i
=
0
;
!
foundTimeStamp
&&
i
<
counterSignerInfo
->
AuthAttrs
.
cAttr
;
i
++
)
{
if
(
!
strcmp
(
counterSignerInfo
->
AuthAttrs
.
rgAttr
[
i
].
pszObjId
,
szOID_RSA_signingTime
))
{
const
CRYPT_ATTRIBUTE
*
attr
=
&
counterSignerInfo
->
AuthAttrs
.
rgAttr
[
i
];
DWORD
j
;
for
(
j
=
0
;
!
foundTimeStamp
&&
j
<
attr
->
cValue
;
j
++
)
{
static
const
DWORD
encoding
=
X509_ASN_ENCODING
|
PKCS_7_ASN_ENCODING
;
DWORD
size
=
sizeof
(
FILETIME
);
foundTimeStamp
=
CryptDecodeObjectEx
(
encoding
,
X509_CHOICE_OF_TIME
,
attr
->
rgValue
[
j
].
pbData
,
attr
->
rgValue
[
j
].
cbData
,
0
,
NULL
,
time
,
&
size
);
}
}
}
return
foundTimeStamp
;
}
static
LPCSTR
filetime_to_str
(
const
FILETIME
*
time
)
{
static
char
date
[
80
];
char
dateFmt
[
80
];
/* sufficient for all versions of LOCALE_SSHORTDATE */
SYSTEMTIME
sysTime
;
if
(
!
time
)
return
NULL
;
GetLocaleInfoA
(
LOCALE_SYSTEM_DEFAULT
,
LOCALE_SSHORTDATE
,
dateFmt
,
sizeof
(
dateFmt
)
/
sizeof
(
dateFmt
[
0
]));
FileTimeToSystemTime
(
time
,
&
sysTime
);
GetDateFormatA
(
LOCALE_SYSTEM_DEFAULT
,
0
,
&
sysTime
,
dateFmt
,
date
,
sizeof
(
date
)
/
sizeof
(
date
[
0
]));
return
date
;
}
static
FILETIME
WINTRUST_GetTimeFromSigner
(
const
CRYPT_PROVIDER_DATA
*
data
,
const
CMSG_SIGNER_INFO
*
signerInfo
)
{
DWORD
i
;
FILETIME
time
;
BOOL
foundTimeStamp
=
FALSE
;
for
(
i
=
0
;
!
foundTimeStamp
&&
i
<
signerInfo
->
UnauthAttrs
.
cAttr
;
i
++
)
{
if
(
!
strcmp
(
signerInfo
->
UnauthAttrs
.
rgAttr
[
i
].
pszObjId
,
szOID_RSA_counterSign
))
{
const
CRYPT_ATTRIBUTE
*
attr
=
&
signerInfo
->
UnauthAttrs
.
rgAttr
[
i
];
DWORD
j
;
for
(
j
=
0
;
j
<
attr
->
cValue
;
j
++
)
{
static
const
DWORD
encoding
=
X509_ASN_ENCODING
|
PKCS_7_ASN_ENCODING
;
CMSG_CMS_SIGNER_INFO
*
counterSignerInfo
;
DWORD
size
;
BOOL
ret
=
CryptDecodeObjectEx
(
encoding
,
CMS_SIGNER_INFO
,
attr
->
rgValue
[
j
].
pbData
,
attr
->
rgValue
[
j
].
cbData
,
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
counterSignerInfo
,
&
size
);
if
(
ret
)
{
/* FIXME: need to verify countersigner signature too */
foundTimeStamp
=
WINTRUST_GetTimeFromCounterSigner
(
counterSignerInfo
,
&
time
);
LocalFree
(
counterSignerInfo
);
}
}
}
}
if
(
!
foundTimeStamp
)
{
TRACE
(
"returning system time %s
\n
"
,
filetime_to_str
(
&
data
->
sftSystemTime
));
time
=
data
->
sftSystemTime
;
}
else
TRACE
(
"returning time from message %s
\n
"
,
filetime_to_str
(
&
time
));
return
time
;
}
static
DWORD
WINTRUST_SaveSigner
(
CRYPT_PROVIDER_DATA
*
data
,
DWORD
signerIdx
)
{
DWORD
err
;
...
...
@@ -479,7 +572,7 @@ static DWORD WINTRUST_SaveSigner(CRYPT_PROVIDER_DATA *data, DWORD signerIdx)
CRYPT_PROVIDER_SGNR
sgnr
=
{
sizeof
(
sgnr
),
{
0
}
};
sgnr
.
psSigner
=
signerInfo
;
sgnr
.
sftVerifyAsOf
=
data
->
sftSystemTime
;
sgnr
.
sftVerifyAsOf
=
WINTRUST_GetTimeFromSigner
(
data
,
signerInfo
)
;
if
(
!
data
->
psPfns
->
pfnAddSgnr2Chain
(
data
,
FALSE
,
signerIdx
,
&
sgnr
))
err
=
GetLastError
();
else
...
...
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