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
75c13b8e
Commit
75c13b8e
authored
Oct 04, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Oct 05, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Don't assume a maximum of 32 valid usages.
parent
9abd47ca
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
3 deletions
+41
-3
cert.c
dlls/crypt32/cert.c
+41
-3
No files found.
dlls/crypt32/cert.c
View file @
75c13b8e
...
...
@@ -1922,6 +1922,42 @@ BOOL WINAPI CertRemoveEnhancedKeyUsageIdentifier(PCCERT_CONTEXT pCertContext,
return
ret
;
}
struct
BitField
{
DWORD
cIndexes
;
DWORD
*
indexes
;
};
#define BITS_PER_DWORD (sizeof(DWORD) * 8)
static
void
CRYPT_SetBitInField
(
struct
BitField
*
field
,
DWORD
bit
)
{
DWORD
indexIndex
=
bit
/
BITS_PER_DWORD
;
if
(
indexIndex
+
1
>
field
->
cIndexes
)
{
if
(
field
->
cIndexes
)
field
->
indexes
=
CryptMemRealloc
(
field
->
indexes
,
(
indexIndex
+
1
)
*
sizeof
(
DWORD
));
else
field
->
indexes
=
CryptMemAlloc
(
sizeof
(
DWORD
));
if
(
field
->
indexes
)
field
->
cIndexes
=
indexIndex
+
1
;
}
if
(
field
->
indexes
)
field
->
indexes
[
indexIndex
]
|=
1
<<
(
bit
%
BITS_PER_DWORD
);
}
static
BOOL
CRYPT_IsBitInFieldSet
(
struct
BitField
*
field
,
DWORD
bit
)
{
BOOL
set
=
FALSE
;
DWORD
indexIndex
=
bit
/
BITS_PER_DWORD
;
assert
(
field
->
cIndexes
);
set
=
field
->
indexes
[
indexIndex
]
&
(
1
<<
(
bit
%
BITS_PER_DWORD
));
return
set
;
}
BOOL
WINAPI
CertGetValidUsages
(
DWORD
cCerts
,
PCCERT_CONTEXT
*
rghCerts
,
int
*
cNumOIDs
,
LPSTR
*
rghOIDs
,
DWORD
*
pcbOIDs
)
{
...
...
@@ -1978,7 +2014,8 @@ BOOL WINAPI CertGetValidUsages(DWORD cCerts, PCCERT_CONTEXT *rghCerts,
}
else
{
DWORD
j
,
k
,
validIndexes
=
0
,
numRemoved
=
0
;
struct
BitField
validIndexes
=
{
0
,
NULL
};
DWORD
j
,
k
,
numRemoved
=
0
;
/* Merge: build a bitmap of all the indexes of
* validUsages.rgpszUsageIdentifier that are in pUsage.
...
...
@@ -1990,7 +2027,7 @@ BOOL WINAPI CertGetValidUsages(DWORD cCerts, PCCERT_CONTEXT *rghCerts,
if
(
!
strcmp
(
pUsage
->
rgpszUsageIdentifier
[
j
],
validUsages
.
rgpszUsageIdentifier
[
k
]))
{
validIndexes
|=
(
1
<<
k
);
CRYPT_SetBitInField
(
&
validIndexes
,
k
);
break
;
}
}
...
...
@@ -2000,7 +2037,7 @@ BOOL WINAPI CertGetValidUsages(DWORD cCerts, PCCERT_CONTEXT *rghCerts,
*/
for
(
j
=
0
;
j
<
validUsages
.
cUsageIdentifier
;
j
++
)
{
if
(
!
(
validIndexes
&
(
1
<<
j
)
))
if
(
!
CRYPT_IsBitInFieldSet
(
&
validIndexes
,
j
))
{
if
(
j
<
validUsages
.
cUsageIdentifier
-
1
)
{
...
...
@@ -2019,6 +2056,7 @@ BOOL WINAPI CertGetValidUsages(DWORD cCerts, PCCERT_CONTEXT *rghCerts,
validUsages
.
cUsageIdentifier
--
;
}
}
CryptMemFree
(
validIndexes
.
indexes
);
}
}
CryptMemFree
(
pUsage
);
...
...
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