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
4120fb99
Commit
4120fb99
authored
Nov 09, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Use wide-character string literals.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
03bf2369
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
211 additions
and
396 deletions
+211
-396
base64.c
dlls/crypt32/base64.c
+13
-29
cert.c
dlls/crypt32/cert.c
+2
-3
chain.c
dlls/crypt32/chain.c
+5
-11
filestore.c
dlls/crypt32/filestore.c
+1
-3
main.c
dlls/crypt32/main.c
+1
-7
object.c
dlls/crypt32/object.c
+19
-31
oid.c
dlls/crypt32/oid.c
+117
-199
protectdata.c
dlls/crypt32/protectdata.c
+1
-2
regstore.c
dlls/crypt32/regstore.c
+9
-16
rootstore.c
dlls/crypt32/rootstore.c
+2
-9
sip.c
dlls/crypt32/sip.c
+27
-59
store.c
dlls/crypt32/store.c
+3
-6
str.c
dlls/crypt32/str.c
+11
-21
No files found.
dlls/crypt32/base64.c
View file @
4120fb99
...
...
@@ -38,30 +38,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(crypt);
#define X509_HEADER "-----BEGIN X509 CRL-----"
#define X509_TRAILER "-----END X509 CRL-----"
static
const
WCHAR
CERT_HEADER_W
[]
=
{
'-'
,
'-'
,
'-'
,
'-'
,
'-'
,
'B'
,
'E'
,
'G'
,
'I'
,
'N'
,
' '
,
'C'
,
'E'
,
'R'
,
'T'
,
'I'
,
'F'
,
'I'
,
'C'
,
'A'
,
'T'
,
'E'
,
'-'
,
'-'
,
'-'
,
'-'
,
'-'
,
0
};
static
const
WCHAR
CERT_HEADER_START_W
[]
=
{
'-'
,
'-'
,
'-'
,
'-'
,
'-'
,
'B'
,
'E'
,
'G'
,
'I'
,
'N'
,
' '
,
0
};
static
const
WCHAR
CERT_DELIMITER_W
[]
=
{
'-'
,
'-'
,
'-'
,
'-'
,
'-'
,
0
};
static
const
WCHAR
CERT_TRAILER_W
[]
=
{
'-'
,
'-'
,
'-'
,
'-'
,
'-'
,
'E'
,
'N'
,
'D'
,
' '
,
'C'
,
'E'
,
'R'
,
'T'
,
'I'
,
'F'
,
'I'
,
'C'
,
'A'
,
'T'
,
'E'
,
'-'
,
'-'
,
'-'
,
'-'
,
'-'
,
0
};
static
const
WCHAR
CERT_TRAILER_START_W
[]
=
{
'-'
,
'-'
,
'-'
,
'-'
,
'-'
,
'E'
,
'N'
,
'D'
,
' '
,
0
};
static
const
WCHAR
CERT_REQUEST_HEADER_W
[]
=
{
'-'
,
'-'
,
'-'
,
'-'
,
'-'
,
'B'
,
'E'
,
'G'
,
'I'
,
'N'
,
' '
,
'N'
,
'E'
,
'W'
,
' '
,
'C'
,
'E'
,
'R'
,
'T'
,
'I'
,
'F'
,
'I'
,
'C'
,
'A'
,
'T'
,
'E'
,
' '
,
'R'
,
'E'
,
'Q'
,
'U'
,
'E'
,
'S'
,
'T'
,
'-'
,
'-'
,
'-'
,
'-'
,
'-'
,
0
};
static
const
WCHAR
CERT_REQUEST_TRAILER_W
[]
=
{
'-'
,
'-'
,
'-'
,
'-'
,
'-'
,
'E'
,
'N'
,
'D'
,
' '
,
'N'
,
'E'
,
'W'
,
' '
,
'C'
,
'E'
,
'R'
,
'T'
,
'I'
,
'F'
,
'I'
,
'C'
,
'A'
,
'T'
,
'E'
,
' '
,
'R'
,
'E'
,
'Q'
,
'U'
,
'E'
,
'S'
,
'T'
,
'-'
,
'-'
,
'-'
,
'-'
,
'-'
,
0
};
static
const
WCHAR
X509_HEADER_W
[]
=
{
'-'
,
'-'
,
'-'
,
'-'
,
'-'
,
'B'
,
'E'
,
'G'
,
'I'
,
'N'
,
' '
,
'X'
,
'5'
,
'0'
,
'9'
,
' '
,
'C'
,
'R'
,
'L'
,
'-'
,
'-'
,
'-'
,
'-'
,
'-'
,
0
};
static
const
WCHAR
X509_TRAILER_W
[]
=
{
'-'
,
'-'
,
'-'
,
'-'
,
'-'
,
'E'
,
'N'
,
'D'
,
' '
,
'X'
,
'5'
,
'0'
,
'9'
,
' '
,
'C'
,
'R'
,
'L'
,
'-'
,
'-'
,
'-'
,
'-'
,
'-'
,
0
};
static
const
WCHAR
CERT_HEADER_W
[]
=
L"-----BEGIN CERTIFICATE-----"
;
static
const
WCHAR
CERT_HEADER_START_W
[]
=
L"-----BEGIN "
;
static
const
WCHAR
CERT_DELIMITER_W
[]
=
L"-----"
;
static
const
WCHAR
CERT_TRAILER_W
[]
=
L"-----END CERTIFICATE-----"
;
static
const
WCHAR
CERT_TRAILER_START_W
[]
=
L"-----END "
;
static
const
WCHAR
CERT_REQUEST_HEADER_W
[]
=
L"-----BEGIN NEW CERTIFICATE REQUEST-----"
;
static
const
WCHAR
CERT_REQUEST_TRAILER_W
[]
=
L"-----END NEW CERTIFICATE REQUEST-----"
;
static
const
WCHAR
X509_HEADER_W
[]
=
L"-----BEGIN X509 CRL-----"
;
static
const
WCHAR
X509_TRAILER_W
[]
=
L"-----END X509 CRL-----"
;
static
const
char
b64
[]
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
;
...
...
@@ -402,17 +387,16 @@ static LONG encodeBase64W(const BYTE *in_buf, int in_len, LPCWSTR sep,
static
BOOL
BinaryToBase64W
(
const
BYTE
*
pbBinary
,
DWORD
cbBinary
,
DWORD
dwFlags
,
LPWSTR
pszString
,
DWORD
*
pcchString
)
{
static
const
WCHAR
crlf
[]
=
{
'\r'
,
'\n'
,
0
},
lf
[]
=
{
'\n'
,
0
},
empty
[]
=
{
0
};
BOOL
ret
=
TRUE
;
LPCWSTR
header
=
NULL
,
trailer
=
NULL
,
sep
;
DWORD
charsNeeded
;
if
(
dwFlags
&
CRYPT_STRING_NOCR
)
sep
=
lf
;
sep
=
L"
\n
"
;
else
if
(
dwFlags
&
CRYPT_STRING_NOCRLF
)
sep
=
empty
;
sep
=
L""
;
else
sep
=
crlf
;
sep
=
L"
\r\n
"
;
switch
(
dwFlags
&
0x0fffffff
)
{
case
CRYPT_STRING_BASE64
:
...
...
@@ -478,7 +462,7 @@ static BOOL BinaryToBase64W(const BYTE *pbBinary,
static
BOOL
BinaryToHexW
(
const
BYTE
*
bin
,
DWORD
nbin
,
DWORD
flags
,
LPWSTR
str
,
DWORD
*
nstr
)
{
static
const
WCHAR
hex
[]
=
{
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
}
;
static
const
WCHAR
hex
[]
=
L"0123456789abcdef"
;
DWORD
needed
;
if
(
flags
&
CRYPT_STRING_NOCRLF
)
...
...
dlls/crypt32/cert.c
View file @
4120fb99
...
...
@@ -984,11 +984,10 @@ BOOL WINAPI CryptAcquireCertificatePrivateKey(PCCERT_CONTEXT pCert,
if
(
!
ret
)
{
static
const
WCHAR
myW
[]
=
{
'M'
,
'y'
,
0
};
HCERTSTORE
hstore
;
hstore
=
CertOpenStore
(
CERT_STORE_PROV_SYSTEM_W
,
0
,
0
,
CERT_SYSTEM_STORE_CURRENT_USER
,
myW
);
CERT_SYSTEM_STORE_CURRENT_USER
,
L"My"
);
if
(
hstore
)
{
cert_in_store
=
CertFindCertificateInStore
(
hstore
,
pCert
->
dwCertEncodingType
,
0
,
...
...
@@ -3670,7 +3669,7 @@ typedef RPC_STATUS (RPC_ENTRY *RpcStringFreeFunc)(unsigned char **);
static
HCRYPTPROV
CRYPT_CreateKeyProv
(
void
)
{
HCRYPTPROV
hProv
=
0
;
HMODULE
rpcrt
=
LoadLibrary
A
(
"rpcrt4"
);
HMODULE
rpcrt
=
LoadLibrary
W
(
L
"rpcrt4"
);
if
(
rpcrt
)
{
...
...
dlls/crypt32/chain.c
View file @
4120fb99
...
...
@@ -68,8 +68,6 @@ static inline void CRYPT_CloseStores(DWORD cStores, HCERTSTORE *stores)
CertCloseStore
(
stores
[
i
],
0
);
}
static
const
WCHAR
rootW
[]
=
{
'R'
,
'o'
,
'o'
,
't'
,
0
};
/* Finds cert in store by comparing the cert's hashes. */
static
PCCERT_CONTEXT
CRYPT_FindCertInStore
(
HCERTSTORE
store
,
PCCERT_CONTEXT
cert
)
...
...
@@ -94,7 +92,7 @@ static BOOL CRYPT_CheckRestrictedRoot(HCERTSTORE store)
if
(
store
)
{
HCERTSTORE
rootStore
=
CertOpenSystemStoreW
(
0
,
rootW
);
HCERTSTORE
rootStore
=
CertOpenSystemStoreW
(
0
,
L"Root"
);
PCCERT_CONTEXT
cert
=
NULL
,
check
;
do
{
...
...
@@ -119,17 +117,13 @@ HCERTCHAINENGINE CRYPT_CreateChainEngine(HCERTSTORE root, DWORD system_store, co
CertificateChainEngine
*
engine
;
HCERTSTORE
worldStores
[
4
];
static
const
WCHAR
caW
[]
=
{
'C'
,
'A'
,
0
};
static
const
WCHAR
myW
[]
=
{
'M'
,
'y'
,
0
};
static
const
WCHAR
trustW
[]
=
{
'T'
,
'r'
,
'u'
,
's'
,
't'
,
0
};
if
(
!
root
)
{
if
(
config
->
cbSize
>=
sizeof
(
CERT_CHAIN_ENGINE_CONFIG
)
&&
config
->
hExclusiveRoot
)
root
=
CertDuplicateStore
(
config
->
hExclusiveRoot
);
else
if
(
config
->
hRestrictedRoot
)
root
=
CertDuplicateStore
(
config
->
hRestrictedRoot
);
else
root
=
CertOpenStore
(
CERT_STORE_PROV_SYSTEM_W
,
0
,
0
,
system_store
,
rootW
);
root
=
CertOpenStore
(
CERT_STORE_PROV_SYSTEM_W
,
0
,
0
,
system_store
,
L"Root"
);
if
(
!
root
)
return
NULL
;
}
...
...
@@ -144,9 +138,9 @@ HCERTCHAINENGINE CRYPT_CreateChainEngine(HCERTSTORE root, DWORD system_store, co
engine
->
hRoot
=
root
;
engine
->
hWorld
=
CertOpenStore
(
CERT_STORE_PROV_COLLECTION
,
0
,
0
,
CERT_STORE_CREATE_NEW_FLAG
,
NULL
);
worldStores
[
0
]
=
CertDuplicateStore
(
engine
->
hRoot
);
worldStores
[
1
]
=
CertOpenStore
(
CERT_STORE_PROV_SYSTEM_W
,
0
,
0
,
system_store
,
caW
);
worldStores
[
2
]
=
CertOpenStore
(
CERT_STORE_PROV_SYSTEM_W
,
0
,
0
,
system_store
,
myW
);
worldStores
[
3
]
=
CertOpenStore
(
CERT_STORE_PROV_SYSTEM_W
,
0
,
0
,
system_store
,
trustW
);
worldStores
[
1
]
=
CertOpenStore
(
CERT_STORE_PROV_SYSTEM_W
,
0
,
0
,
system_store
,
L"CA"
);
worldStores
[
2
]
=
CertOpenStore
(
CERT_STORE_PROV_SYSTEM_W
,
0
,
0
,
system_store
,
L"My"
);
worldStores
[
3
]
=
CertOpenStore
(
CERT_STORE_PROV_SYSTEM_W
,
0
,
0
,
system_store
,
L"Trust"
);
CRYPT_AddStoresToCollection
(
engine
->
hWorld
,
ARRAY_SIZE
(
worldStores
),
worldStores
);
CRYPT_AddStoresToCollection
(
engine
->
hWorld
,
config
->
cAdditionalStore
,
config
->
rghAdditionalStore
);
...
...
dlls/crypt32/filestore.c
View file @
4120fb99
...
...
@@ -353,14 +353,12 @@ WINECRYPT_CERTSTORE *CRYPT_FileNameOpenStoreW(HCRYPTPROV hCryptProv,
}
else
{
static
const
WCHAR
spc
[]
=
{
's'
,
'p'
,
'c'
,
0
};
static
const
WCHAR
p7c
[]
=
{
'p'
,
'7'
,
'c'
,
0
};
LPCWSTR
ext
=
wcsrchr
(
fileName
,
'.'
);
if
(
ext
)
{
ext
++
;
if
(
!
lstrcmpiW
(
ext
,
spc
)
||
!
lstrcmpiW
(
ext
,
p7c
))
if
(
!
lstrcmpiW
(
ext
,
L"spc"
)
||
!
lstrcmpiW
(
ext
,
L"p7c"
))
type
=
CERT_STORE_SAVE_AS_PKCS7
;
}
if
(
!
type
)
...
...
dlls/crypt32/main.c
View file @
4120fb99
...
...
@@ -255,12 +255,6 @@ HCRYPTPROV WINAPI DECLSPEC_HOTPATCH I_CryptGetDefaultCryptProv(ALG_ID algid)
BOOL
WINAPI
I_CryptReadTrustedPublisherDWORDValueFromRegistry
(
LPCWSTR
name
,
DWORD
*
value
)
{
static
const
WCHAR
safer
[]
=
{
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'P'
,
'o'
,
'l'
,
'i'
,
'c'
,
'i'
,
'e'
,
's'
,
'\\'
,
'M'
,
'i'
,
'c'
,
'r'
,
'o'
,
's'
,
'o'
,
'f'
,
't'
,
'\\'
,
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
'C'
,
'e'
,
'r'
,
't'
,
'i'
,
'f'
,
'i'
,
'c'
,
'a'
,
't'
,
'e'
,
's'
,
'\\'
,
'T'
,
'r'
,
'u'
,
's'
,
't'
,
'e'
,
'd'
,
'P'
,
'u'
,
'b'
,
'l'
,
'i'
,
's'
,
'h'
,
'e'
,
'r'
,
'\\'
,
'S'
,
'a'
,
'f'
,
'e'
,
'r'
,
0
};
HKEY
key
;
LONG
rc
;
BOOL
ret
=
FALSE
;
...
...
@@ -268,7 +262,7 @@ BOOL WINAPI I_CryptReadTrustedPublisherDWORDValueFromRegistry(LPCWSTR name,
TRACE
(
"(%s, %p)
\n
"
,
debugstr_w
(
name
),
value
);
*
value
=
0
;
rc
=
RegCreateKeyW
(
HKEY_LOCAL_MACHINE
,
safer
,
&
key
);
rc
=
RegCreateKeyW
(
HKEY_LOCAL_MACHINE
,
L"Software
\\
Policies
\\
Microsoft
\\
SystemCertificates
\\
TrustedPublisher
\\
Safer"
,
&
key
);
if
(
rc
==
ERROR_SUCCESS
)
{
DWORD
size
=
sizeof
(
DWORD
);
...
...
dlls/crypt32/object.c
View file @
4120fb99
...
...
@@ -858,8 +858,6 @@ static BOOL WINAPI CRYPT_FormatHexString(DWORD dwCertEncodingType,
}
else
{
static
const
WCHAR
fmt
[]
=
{
'%'
,
'0'
,
'2'
,
'x'
,
' '
,
0
};
static
const
WCHAR
endFmt
[]
=
{
'%'
,
'0'
,
'2'
,
'x'
,
0
};
DWORD
i
;
LPWSTR
ptr
=
pbFormat
;
...
...
@@ -869,9 +867,9 @@ static BOOL WINAPI CRYPT_FormatHexString(DWORD dwCertEncodingType,
for
(
i
=
0
;
i
<
cbEncoded
;
i
++
)
{
if
(
i
<
cbEncoded
-
1
)
ptr
+=
swprintf
(
ptr
,
4
,
fmt
,
pbEncoded
[
i
]);
ptr
+=
swprintf
(
ptr
,
4
,
L"%02x "
,
pbEncoded
[
i
]);
else
ptr
+=
swprintf
(
ptr
,
3
,
endFmt
,
pbEncoded
[
i
]);
ptr
+=
swprintf
(
ptr
,
3
,
L"%02x"
,
pbEncoded
[
i
]);
}
}
else
...
...
@@ -883,7 +881,7 @@ static BOOL WINAPI CRYPT_FormatHexString(DWORD dwCertEncodingType,
#define MAX_STRING_RESOURCE_LEN 128
static
const
WCHAR
commaSpace
[]
=
{
','
,
' '
,
0
}
;
static
const
WCHAR
commaSpace
[]
=
L", "
;
struct
BitToString
{
...
...
@@ -1063,7 +1061,7 @@ static BOOL WINAPI CRYPT_FormatKeyUsage(DWORD dwCertEncodingType,
return
ret
;
}
static
const
WCHAR
crlf
[]
=
{
'\r'
,
'\n'
,
0
}
;
static
const
WCHAR
crlf
[]
=
L"
\r\n
"
;
static
WCHAR
subjectTypeHeader
[
MAX_STRING_RESOURCE_LEN
];
static
WCHAR
subjectTypeCA
[
MAX_STRING_RESOURCE_LEN
];
...
...
@@ -1087,7 +1085,6 @@ static BOOL WINAPI CRYPT_FormatBasicConstraints2(DWORD dwCertEncodingType,
if
((
ret
=
CryptDecodeObjectEx
(
dwCertEncodingType
,
X509_BASIC_CONSTRAINTS2
,
pbEncoded
,
cbEncoded
,
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
info
,
&
size
)))
{
static
const
WCHAR
pathFmt
[]
=
{
'%'
,
'd'
,
0
};
static
BOOL
stringsLoaded
=
FALSE
;
DWORD
bytesNeeded
=
sizeof
(
WCHAR
);
/* space for the NULL terminator */
WCHAR
pathLength
[
MAX_STRING_RESOURCE_LEN
];
...
...
@@ -1122,7 +1119,7 @@ static BOOL WINAPI CRYPT_FormatBasicConstraints2(DWORD dwCertEncodingType,
bytesNeeded
+=
sepLen
;
bytesNeeded
+=
lstrlenW
(
pathLengthHeader
)
*
sizeof
(
WCHAR
);
if
(
info
->
fPathLenConstraint
)
swprintf
(
pathLength
,
ARRAY_SIZE
(
pathLength
),
pathFmt
,
info
->
dwPathLenConstraint
);
swprintf
(
pathLength
,
ARRAY_SIZE
(
pathLength
),
L"%d"
,
info
->
dwPathLenConstraint
);
else
LoadStringW
(
hInstance
,
IDS_PATH_LENGTH_NONE
,
pathLength
,
ARRAY_SIZE
(
pathLength
));
bytesNeeded
+=
lstrlenW
(
pathLength
)
*
sizeof
(
WCHAR
);
...
...
@@ -1201,8 +1198,8 @@ static BOOL CRYPT_FormatCertSerialNumber(const CRYPT_DATA_BLOB *serialNum, LPWST
str
,
pcbStr
);
}
static
const
WCHAR
indent
[]
=
{
' '
,
' '
,
' '
,
' '
,
' '
,
0
}
;
static
const
WCHAR
colonCrlf
[]
=
{
':'
,
'\r'
,
'\n'
,
0
}
;
static
const
WCHAR
indent
[]
=
L" "
;
static
const
WCHAR
colonCrlf
[]
=
L":
\r\n
"
;
static
BOOL
CRYPT_FormatAltNameEntry
(
DWORD
dwFormatStrType
,
DWORD
indentLevel
,
const
CERT_ALT_NAME_ENTRY
*
entry
,
LPWSTR
str
,
DWORD
*
pcbStr
)
...
...
@@ -1253,12 +1250,6 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel,
break
;
case
CERT_ALT_NAME_IP_ADDRESS
:
{
static
const
WCHAR
ipAddrWithMaskFmt
[]
=
{
'%'
,
'd'
,
'.'
,
'%'
,
'd'
,
'.'
,
'%'
,
'd'
,
'.'
,
'%'
,
'd'
,
'/'
,
'%'
,
'd'
,
'.'
,
'%'
,
'd'
,
'.'
,
'%'
,
'd'
,
'.'
,
'%'
,
'd'
,
0
};
static
const
WCHAR
ipAddrFmt
[]
=
{
'%'
,
'd'
,
'.'
,
'%'
,
'd'
,
'.'
,
'%'
,
'd'
,
'.'
,
'%'
,
'd'
,
0
};
LoadStringW
(
hInstance
,
IDS_ALT_NAME_IP_ADDRESS
,
buf
,
ARRAY_SIZE
(
buf
));
if
(
entry
->
u
.
IPAddress
.
cbData
==
8
)
{
...
...
@@ -1266,7 +1257,7 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel,
{
LoadStringW
(
hInstance
,
IDS_ALT_NAME_MASK
,
mask
,
ARRAY_SIZE
(
mask
));
bytesNeeded
+=
lstrlenW
(
mask
)
*
sizeof
(
WCHAR
);
swprintf
(
ipAddrBuf
,
ARRAY_SIZE
(
ipAddrBuf
),
ipAddrFmt
,
swprintf
(
ipAddrBuf
,
ARRAY_SIZE
(
ipAddrBuf
),
L"%d.%d.%d.%d"
,
entry
->
u
.
IPAddress
.
pbData
[
0
],
entry
->
u
.
IPAddress
.
pbData
[
1
],
entry
->
u
.
IPAddress
.
pbData
[
2
],
...
...
@@ -1274,7 +1265,7 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel,
bytesNeeded
+=
lstrlenW
(
ipAddrBuf
)
*
sizeof
(
WCHAR
);
/* indent again, for the mask line */
bytesNeeded
+=
indentLevel
*
lstrlenW
(
indent
)
*
sizeof
(
WCHAR
);
swprintf
(
maskBuf
,
ARRAY_SIZE
(
maskBuf
),
ipAddrFmt
,
swprintf
(
maskBuf
,
ARRAY_SIZE
(
maskBuf
),
L"%d.%d.%d.%d"
,
entry
->
u
.
IPAddress
.
pbData
[
4
],
entry
->
u
.
IPAddress
.
pbData
[
5
],
entry
->
u
.
IPAddress
.
pbData
[
6
],
...
...
@@ -1284,7 +1275,7 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel,
}
else
{
swprintf
(
ipAddrBuf
,
ARRAY_SIZE
(
ipAddrBuf
),
ipAddrWithMaskFmt
,
swprintf
(
ipAddrBuf
,
ARRAY_SIZE
(
ipAddrBuf
),
L"%d.%d.%d.%d/%d.%d.%d.%d"
,
entry
->
u
.
IPAddress
.
pbData
[
0
],
entry
->
u
.
IPAddress
.
pbData
[
1
],
entry
->
u
.
IPAddress
.
pbData
[
2
],
...
...
@@ -1445,7 +1436,7 @@ static BOOL CRYPT_FormatAltNameInfo(DWORD dwFormatStrType, DWORD indentLevel,
return
ret
;
}
static
const
WCHAR
colonSep
[]
=
{
':'
,
' '
,
0
}
;
static
const
WCHAR
colonSep
[]
=
L": "
;
static
BOOL
WINAPI
CRYPT_FormatAltName
(
DWORD
dwCertEncodingType
,
DWORD
dwFormatType
,
DWORD
dwFormatStrType
,
void
*
pFormatStruct
,
...
...
@@ -1695,8 +1686,7 @@ static BOOL WINAPI CRYPT_FormatAuthorityInfoAccess(DWORD dwCertEncodingType,
}
else
{
static
const
WCHAR
numFmt
[]
=
{
'%'
,
'd'
,
0
};
static
const
WCHAR
equal
[]
=
{
'='
,
0
};
static
const
WCHAR
equal
[]
=
L"="
;
static
BOOL
stringsLoaded
=
FALSE
;
DWORD
i
;
LPCWSTR
headingSep
,
accessMethodSep
,
locationSep
;
...
...
@@ -1729,7 +1719,7 @@ static BOOL WINAPI CRYPT_FormatAuthorityInfoAccess(DWORD dwCertEncodingType,
{
/* Heading */
bytesNeeded
+=
sizeof
(
WCHAR
);
/* left bracket */
swprintf
(
accessDescrNum
,
ARRAY_SIZE
(
accessDescrNum
),
numFmt
,
i
+
1
);
swprintf
(
accessDescrNum
,
ARRAY_SIZE
(
accessDescrNum
),
L"%d"
,
i
+
1
);
bytesNeeded
+=
lstrlenW
(
accessDescrNum
)
*
sizeof
(
WCHAR
);
bytesNeeded
+=
sizeof
(
WCHAR
);
/* right bracket */
bytesNeeded
+=
lstrlenW
(
aia
)
*
sizeof
(
WCHAR
);
...
...
@@ -1786,7 +1776,7 @@ static BOOL WINAPI CRYPT_FormatAuthorityInfoAccess(DWORD dwCertEncodingType,
LPCSTR
oidPtr
;
*
str
++
=
'['
;
swprintf
(
accessDescrNum
,
ARRAY_SIZE
(
accessDescrNum
),
numFmt
,
i
+
1
);
swprintf
(
accessDescrNum
,
ARRAY_SIZE
(
accessDescrNum
),
L"%d"
,
i
+
1
);
lstrcpyW
(
str
,
accessDescrNum
);
str
+=
lstrlenW
(
accessDescrNum
);
*
str
++
=
']'
;
...
...
@@ -1887,8 +1877,7 @@ static struct reason_map_entry reason_map[] = {
static
BOOL
CRYPT_FormatReason
(
DWORD
dwFormatStrType
,
const
CRYPT_BIT_BLOB
*
reasonFlags
,
LPWSTR
str
,
DWORD
*
pcbStr
)
{
static
const
WCHAR
sep
[]
=
{
','
,
' '
,
0
};
static
const
WCHAR
bitsFmt
[]
=
{
' '
,
'('
,
'%'
,
'0'
,
'2'
,
'x'
,
')'
,
0
};
static
const
WCHAR
sep
[]
=
L", "
;
static
BOOL
stringsLoaded
=
FALSE
;
unsigned
int
i
,
numReasons
=
0
;
BOOL
ret
=
TRUE
;
...
...
@@ -1914,7 +1903,7 @@ static BOOL CRYPT_FormatReason(DWORD dwFormatStrType,
bytesNeeded
+=
lstrlenW
(
sep
)
*
sizeof
(
WCHAR
);
}
}
swprintf
(
bits
,
ARRAY_SIZE
(
bits
),
bitsFmt
,
reasonFlags
->
pbData
[
0
]);
swprintf
(
bits
,
ARRAY_SIZE
(
bits
),
L" (%02x)"
,
reasonFlags
->
pbData
[
0
]);
bytesNeeded
+=
lstrlenW
(
bits
);
if
(
!
str
)
*
pcbStr
=
bytesNeeded
;
...
...
@@ -1969,8 +1958,7 @@ static BOOL WINAPI CRYPT_FormatCRLDistPoints(DWORD dwCertEncodingType,
if
((
ret
=
CryptDecodeObjectEx
(
dwCertEncodingType
,
X509_CRL_DIST_POINTS
,
pbEncoded
,
cbEncoded
,
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
info
,
&
size
)))
{
static
const
WCHAR
numFmt
[]
=
{
'%'
,
'd'
,
0
};
static
const
WCHAR
colon
[]
=
{
':'
,
0
};
static
const
WCHAR
colon
[]
=
L":"
;
static
BOOL
stringsLoaded
=
FALSE
;
DWORD
bytesNeeded
=
sizeof
(
WCHAR
);
/* space for NULL terminator */
BOOL
haveAnEntry
=
FALSE
;
...
...
@@ -2048,7 +2036,7 @@ static BOOL WINAPI CRYPT_FormatCRLDistPoints(DWORD dwCertEncodingType,
if
(
haveAnEntry
)
{
bytesNeeded
+=
sizeof
(
WCHAR
);
/* left bracket */
swprintf
(
distPointNum
,
ARRAY_SIZE
(
distPointNum
),
numFmt
,
i
+
1
);
swprintf
(
distPointNum
,
ARRAY_SIZE
(
distPointNum
),
L"%d"
,
i
+
1
);
bytesNeeded
+=
lstrlenW
(
distPointNum
)
*
sizeof
(
WCHAR
);
bytesNeeded
+=
sizeof
(
WCHAR
);
/* right bracket */
bytesNeeded
+=
lstrlenW
(
crlDistPoint
)
*
sizeof
(
WCHAR
);
...
...
@@ -2097,7 +2085,7 @@ static BOOL WINAPI CRYPT_FormatCRLDistPoints(DWORD dwCertEncodingType,
CRL_DIST_POINT
*
distPoint
=
&
info
->
rgDistPoint
[
i
];
*
str
++
=
'['
;
swprintf
(
distPointNum
,
ARRAY_SIZE
(
distPointNum
),
numFmt
,
i
+
1
);
swprintf
(
distPointNum
,
ARRAY_SIZE
(
distPointNum
),
L"%d"
,
i
+
1
);
lstrcpyW
(
str
,
distPointNum
);
str
+=
lstrlenW
(
distPointNum
);
*
str
++
=
']'
;
...
...
dlls/crypt32/oid.c
View file @
4120fb99
...
...
@@ -36,8 +36,6 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
crypt
);
static
const
WCHAR
DllW
[]
=
{
'D'
,
'l'
,
'l'
,
0
};
static
CRITICAL_SECTION
funcSetCS
;
static
CRITICAL_SECTION_DEBUG
funcSetCSDebug
=
{
...
...
@@ -64,22 +62,17 @@ struct OIDFunction
struct
list
next
;
};
static
const
WCHAR
ROOT
[]
=
{
'R'
,
'O'
,
'O'
,
'T'
,
0
};
static
const
WCHAR
MY
[]
=
{
'M'
,
'Y'
,
0
};
static
const
WCHAR
CA
[]
=
{
'C'
,
'A'
,
0
};
static
const
WCHAR
ADDRESSBOOK
[]
=
{
'A'
,
'D'
,
'D'
,
'R'
,
'E'
,
'S'
,
'S'
,
'B'
,
'O'
,
'O'
,
'K'
,
0
};
static
const
WCHAR
TRUSTEDPUBLISHER
[]
=
{
'T'
,
'r'
,
'u'
,
's'
,
't'
,
'e'
,
'd'
,
'P'
,
'u'
,
'b'
,
'l'
,
'i'
,
's'
,
'h'
,
'e'
,
'r'
,
0
};
static
const
WCHAR
DISALLOWED
[]
=
{
'D'
,
'i'
,
's'
,
'a'
,
'l'
,
'l'
,
'o'
,
'w'
,
'e'
,
'd'
,
0
};
static
const
LPCWSTR
LocalizedKeys
[]
=
{
ROOT
,
MY
,
CA
,
ADDRESSBOOK
,
TRUSTEDPUBLISHER
,
DISALLOWED
};
static
const
LPCWSTR
LocalizedKeys
[]
=
{
L"ROOT"
,
L"MY"
,
L"CA"
,
L"ADDRESSBOOK"
,
L"TrustedPublisher"
,
L"Disallowed"
};
static
WCHAR
LocalizedNames
[
ARRAY_SIZE
(
LocalizedKeys
)][
256
];
static
const
WCHAR
nameW
[]
=
{
'N'
,
'a'
,
'm'
,
'e'
,
0
};
static
const
WCHAR
algidW
[]
=
{
'A'
,
'l'
,
'g'
,
'i'
,
'd'
,
0
};
static
const
WCHAR
extraW
[]
=
{
'E'
,
'x'
,
't'
,
'r'
,
'a'
,
'I'
,
'n'
,
'f'
,
'o'
,
0
};
static
const
WCHAR
cngalgidW
[]
=
{
'C'
,
'N'
,
'G'
,
'A'
,
'l'
,
'g'
,
'i'
,
'd'
,
0
};
static
const
WCHAR
cngextraalgidW
[]
=
{
'C'
,
'N'
,
'G'
,
'E'
,
'x'
,
't'
,
'r'
,
'a'
,
'A'
,
'l'
,
'g'
,
'i'
,
'd'
,
0
};
static
const
WCHAR
flagsW
[]
=
{
'F'
,
'l'
,
'a'
,
'g'
,
's'
,
0
};
static
void
free_function_sets
(
void
)
{
struct
OIDFunctionSet
*
setCursor
,
*
setNext
;
...
...
@@ -204,7 +197,7 @@ BOOL WINAPI CryptGetDefaultOIDDllList(HCRYPTOIDFUNCSET hFuncSet,
{
DWORD
size
=
*
pcchDllList
*
sizeof
(
WCHAR
);
rc
=
RegQueryValueExW
(
key
,
DllW
,
NULL
,
NULL
,
(
LPBYTE
)
pwszDllList
,
rc
=
RegQueryValueExW
(
key
,
L"Dll"
,
NULL
,
NULL
,
(
LPBYTE
)
pwszDllList
,
&
size
);
if
(
!
rc
)
*
pcchDllList
=
size
/
sizeof
(
WCHAR
);
...
...
@@ -314,14 +307,14 @@ static BOOL CRYPT_GetFuncFromReg(DWORD dwEncodingType, LPCSTR pszOID,
}
else
funcName
=
szFuncName
;
rc
=
RegQueryValueExW
(
key
,
DllW
,
NULL
,
&
type
,
NULL
,
&
size
);
rc
=
RegQueryValueExW
(
key
,
L"Dll"
,
NULL
,
&
type
,
NULL
,
&
size
);
if
((
!
rc
||
rc
==
ERROR_MORE_DATA
)
&&
type
==
REG_SZ
)
{
LPWSTR
dllName
=
CryptMemAlloc
(
size
);
if
(
dllName
)
{
rc
=
RegQueryValueExW
(
key
,
DllW
,
NULL
,
NULL
,
rc
=
RegQueryValueExW
(
key
,
L"Dll"
,
NULL
,
NULL
,
(
LPBYTE
)
dllName
,
&
size
);
if
(
!
rc
)
{
...
...
@@ -681,7 +674,7 @@ BOOL WINAPI CryptRegisterOIDFunction(DWORD dwEncodingType, LPCSTR pszFuncName,
(
const
BYTE
*
)
pszOverrideFuncName
,
lstrlenA
(
pszOverrideFuncName
)
+
1
);
if
(
r
!=
ERROR_SUCCESS
)
goto
error_close_key
;
}
r
=
RegSetValueExW
(
hKey
,
DllW
,
0
,
REG_SZ
,
(
const
BYTE
*
)
pwszDll
,
r
=
RegSetValueExW
(
hKey
,
L"Dll"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
pwszDll
,
(
lstrlenW
(
pwszDll
)
+
1
)
*
sizeof
(
WCHAR
));
error_close_key:
...
...
@@ -714,7 +707,7 @@ BOOL WINAPI CryptUnregisterOIDInfo(PCCRYPT_OID_INFO info)
return
FALSE
;
}
err
=
RegOpenKeyEx
A
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Microsoft
\\
Cryptography
\\
OID
\\
EncodingType 0
\\
CryptDllFindOIDInfo"
,
0
,
KEY_ALL_ACCESS
,
&
root
);
err
=
RegOpenKeyEx
W
(
HKEY_LOCAL_MACHINE
,
L
"Software
\\
Microsoft
\\
Cryptography
\\
OID
\\
EncodingType 0
\\
CryptDllFindOIDInfo"
,
0
,
KEY_ALL_ACCESS
,
&
root
);
if
(
err
!=
ERROR_SUCCESS
)
{
SetLastError
(
err
);
...
...
@@ -765,7 +758,7 @@ BOOL WINAPI CryptRegisterOIDInfo(PCCRYPT_OID_INFO info, DWORD flags)
goto
done
;
}
err
=
RegCreateKeyEx
A
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Microsoft
\\
Cryptography
\\
OID
\\
EncodingType 0
\\
CryptDllFindOIDInfo"
,
err
=
RegCreateKeyEx
W
(
HKEY_LOCAL_MACHINE
,
L
"Software
\\
Microsoft
\\
Cryptography
\\
OID
\\
EncodingType 0
\\
CryptDllFindOIDInfo"
,
0
,
NULL
,
0
,
KEY_ALL_ACCESS
,
NULL
,
&
root
,
NULL
);
if
(
err
!=
ERROR_SUCCESS
)
goto
done
;
...
...
@@ -775,37 +768,37 @@ BOOL WINAPI CryptRegisterOIDInfo(PCCRYPT_OID_INFO info, DWORD flags)
if
(
flags
)
{
err
=
RegSetValueExW
(
key
,
flagsW
,
0
,
REG_DWORD
,
(
const
BYTE
*
)
&
flags
,
sizeof
(
flags
));
err
=
RegSetValueExW
(
key
,
L"Flags"
,
0
,
REG_DWORD
,
(
const
BYTE
*
)
&
flags
,
sizeof
(
flags
));
if
(
err
!=
ERROR_SUCCESS
)
goto
done
;
}
if
(
info
->
pwszName
)
{
err
=
RegSetValueExW
(
key
,
nameW
,
0
,
REG_SZ
,
(
const
BYTE
*
)
info
->
pwszName
,
(
lstrlenW
(
info
->
pwszName
)
+
1
)
*
sizeof
(
WCHAR
));
err
=
RegSetValueExW
(
key
,
L"Name"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
info
->
pwszName
,
(
lstrlenW
(
info
->
pwszName
)
+
1
)
*
sizeof
(
WCHAR
));
if
(
err
!=
ERROR_SUCCESS
)
goto
done
;
}
if
(
info
->
u
.
Algid
)
{
err
=
RegSetValueExW
(
key
,
algidW
,
0
,
REG_DWORD
,
(
const
BYTE
*
)
&
info
->
u
.
Algid
,
sizeof
(
info
->
u
.
Algid
));
err
=
RegSetValueExW
(
key
,
L"Algid"
,
0
,
REG_DWORD
,
(
const
BYTE
*
)
&
info
->
u
.
Algid
,
sizeof
(
info
->
u
.
Algid
));
if
(
err
!=
ERROR_SUCCESS
)
goto
done
;
}
if
(
info
->
ExtraInfo
.
cbData
&&
info
->
ExtraInfo
.
pbData
)
{
err
=
RegSetValueExW
(
key
,
extraW
,
0
,
REG_BINARY
,
info
->
ExtraInfo
.
pbData
,
info
->
ExtraInfo
.
cbData
);
err
=
RegSetValueExW
(
key
,
L"ExtraInfo"
,
0
,
REG_BINARY
,
info
->
ExtraInfo
.
pbData
,
info
->
ExtraInfo
.
cbData
);
if
(
err
!=
ERROR_SUCCESS
)
goto
done
;
}
if
(
info
->
pwszCNGAlgid
)
{
err
=
RegSetValueExW
(
key
,
cngalgidW
,
0
,
REG_SZ
,
(
const
BYTE
*
)
info
->
pwszCNGAlgid
,
(
lstrlenW
(
info
->
pwszCNGAlgid
)
+
1
)
*
sizeof
(
WCHAR
));
err
=
RegSetValueExW
(
key
,
L"CNGAlgid"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
info
->
pwszCNGAlgid
,
(
lstrlenW
(
info
->
pwszCNGAlgid
)
+
1
)
*
sizeof
(
WCHAR
));
if
(
err
!=
ERROR_SUCCESS
)
goto
done
;
}
if
(
info
->
pwszCNGExtraAlgid
)
{
err
=
RegSetValueExW
(
key
,
cngextraalgidW
,
0
,
REG_SZ
,
(
const
BYTE
*
)
info
->
pwszCNGExtraAlgid
,
(
lstrlenW
(
info
->
pwszCNGExtraAlgid
)
+
1
)
*
sizeof
(
WCHAR
));
err
=
RegSetValueExW
(
key
,
L"CNGExtraAlgid"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
info
->
pwszCNGExtraAlgid
,
(
lstrlenW
(
info
->
pwszCNGExtraAlgid
)
+
1
)
*
sizeof
(
WCHAR
));
if
(
err
!=
ERROR_SUCCESS
)
goto
done
;
}
...
...
@@ -1071,11 +1064,11 @@ static LPWSTR CRYPT_GetDefaultOIDDlls(HKEY key)
DWORD
type
,
size
;
LPWSTR
dlls
;
r
=
RegQueryValueExW
(
key
,
DllW
,
NULL
,
&
type
,
NULL
,
&
size
);
r
=
RegQueryValueExW
(
key
,
L"Dll"
,
NULL
,
&
type
,
NULL
,
&
size
);
if
(
r
==
ERROR_SUCCESS
&&
type
==
REG_MULTI_SZ
)
{
dlls
=
CryptMemAlloc
(
size
);
r
=
RegQueryValueExW
(
key
,
DllW
,
NULL
,
&
type
,
(
LPBYTE
)
dlls
,
&
size
);
r
=
RegQueryValueExW
(
key
,
L"Dll"
,
NULL
,
&
type
,
(
LPBYTE
)
dlls
,
&
size
);
if
(
r
!=
ERROR_SUCCESS
)
{
CryptMemFree
(
dlls
);
...
...
@@ -1092,7 +1085,7 @@ static inline BOOL CRYPT_SetDefaultOIDDlls(HKEY key, LPCWSTR dlls)
DWORD
len
=
CRYPT_GetMultiStringCharacterLen
(
dlls
);
LONG
r
;
if
((
r
=
RegSetValueExW
(
key
,
DllW
,
0
,
REG_MULTI_SZ
,
(
const
BYTE
*
)
dlls
,
if
((
r
=
RegSetValueExW
(
key
,
L"Dll"
,
0
,
REG_MULTI_SZ
,
(
const
BYTE
*
)
dlls
,
len
*
sizeof
(
WCHAR
))))
SetLastError
(
r
);
return
r
==
ERROR_SUCCESS
;
...
...
@@ -1200,79 +1193,6 @@ static CRITICAL_SECTION_DEBUG oidInfoCSDebug =
static
CRITICAL_SECTION
oidInfoCS
=
{
&
oidInfoCSDebug
,
-
1
,
0
,
0
,
0
,
0
};
static
struct
list
oidInfo
=
{
&
oidInfo
,
&
oidInfo
};
static
const
WCHAR
tripledes
[]
=
{
'3'
,
'd'
,
'e'
,
's'
,
0
};
static
const
WCHAR
cms3deswrap
[]
=
{
'C'
,
'M'
,
'S'
,
'3'
,
'D'
,
'E'
,
'S'
,
'w'
,
'r'
,
'a'
,
'p'
,
0
};
static
const
WCHAR
cmsrc2wrap
[]
=
{
'C'
,
'M'
,
'S'
,
'R'
,
'C'
,
'2'
,
'w'
,
'r'
,
'a'
,
'p'
,
0
};
static
const
WCHAR
des
[]
=
{
'd'
,
'e'
,
's'
,
0
};
static
const
WCHAR
md2
[]
=
{
'm'
,
'd'
,
'2'
,
0
};
static
const
WCHAR
md4
[]
=
{
'm'
,
'd'
,
'4'
,
0
};
static
const
WCHAR
md5
[]
=
{
'm'
,
'd'
,
'5'
,
0
};
static
const
WCHAR
rc2
[]
=
{
'r'
,
'c'
,
'2'
,
0
};
static
const
WCHAR
rc4
[]
=
{
'r'
,
'c'
,
'4'
,
0
};
static
const
WCHAR
sha
[]
=
{
's'
,
'h'
,
'a'
,
0
};
static
const
WCHAR
sha1
[]
=
{
's'
,
'h'
,
'a'
,
'1'
,
0
};
static
const
WCHAR
sha256
[]
=
{
's'
,
'h'
,
'a'
,
'2'
,
'5'
,
'6'
,
0
};
static
const
WCHAR
sha384
[]
=
{
's'
,
'h'
,
'a'
,
'3'
,
'8'
,
'4'
,
0
};
static
const
WCHAR
sha512
[]
=
{
's'
,
'h'
,
'a'
,
'5'
,
'1'
,
'2'
,
0
};
static
const
WCHAR
RSA
[]
=
{
'R'
,
'S'
,
'A'
,
0
};
static
const
WCHAR
RSA_KEYX
[]
=
{
'R'
,
'S'
,
'A'
,
'_'
,
'K'
,
'E'
,
'Y'
,
'X'
,
0
};
static
const
WCHAR
RSA_SIGN
[]
=
{
'R'
,
'S'
,
'A'
,
'_'
,
'S'
,
'I'
,
'G'
,
'N'
,
0
};
static
const
WCHAR
DSA
[]
=
{
'D'
,
'S'
,
'A'
,
0
};
static
const
WCHAR
DSA_SIGN
[]
=
{
'D'
,
'S'
,
'A'
,
'_'
,
'S'
,
'I'
,
'G'
,
'N'
,
0
};
static
const
WCHAR
DH
[]
=
{
'D'
,
'H'
,
0
};
static
const
WCHAR
DSS
[]
=
{
'D'
,
'S'
,
'S'
,
0
};
static
const
WCHAR
mosaicKMandUpdSig
[]
=
{
'm'
,
'o'
,
's'
,
'a'
,
'i'
,
'c'
,
'K'
,
'M'
,
'a'
,
'n'
,
'd'
,
'U'
,
'p'
,
'd'
,
'S'
,
'i'
,
'g'
,
0
};
static
const
WCHAR
ESDH
[]
=
{
'E'
,
'S'
,
'D'
,
'H'
,
0
};
static
const
WCHAR
NO_SIGN
[]
=
{
'N'
,
'O'
,
'S'
,
'I'
,
'G'
,
'N'
,
0
};
static
const
WCHAR
dsaSHA1
[]
=
{
'd'
,
's'
,
'a'
,
'S'
,
'H'
,
'A'
,
'1'
,
0
};
static
const
WCHAR
md2RSA
[]
=
{
'm'
,
'd'
,
'2'
,
'R'
,
'S'
,
'A'
,
0
};
static
const
WCHAR
md4RSA
[]
=
{
'm'
,
'd'
,
'4'
,
'R'
,
'S'
,
'A'
,
0
};
static
const
WCHAR
md5RSA
[]
=
{
'm'
,
'd'
,
'5'
,
'R'
,
'S'
,
'A'
,
0
};
static
const
WCHAR
shaDSA
[]
=
{
's'
,
'h'
,
'a'
,
'D'
,
'S'
,
'A'
,
0
};
static
const
WCHAR
sha1DSA
[]
=
{
's'
,
'h'
,
'a'
,
'1'
,
'D'
,
'S'
,
'A'
,
0
};
static
const
WCHAR
shaRSA
[]
=
{
's'
,
'h'
,
'a'
,
'R'
,
'S'
,
'A'
,
0
};
static
const
WCHAR
sha1RSA
[]
=
{
's'
,
'h'
,
'a'
,
'1'
,
'R'
,
'S'
,
'A'
,
0
};
static
const
WCHAR
sha256RSA
[]
=
{
's'
,
'h'
,
'a'
,
'2'
,
'5'
,
'6'
,
'R'
,
'S'
,
'A'
,
0
};
static
const
WCHAR
sha384RSA
[]
=
{
's'
,
'h'
,
'a'
,
'3'
,
'8'
,
'4'
,
'R'
,
'S'
,
'A'
,
0
};
static
const
WCHAR
sha512RSA
[]
=
{
's'
,
'h'
,
'a'
,
'5'
,
'1'
,
'2'
,
'R'
,
'S'
,
'A'
,
0
};
static
const
WCHAR
mosaicUpdatedSig
[]
=
{
'm'
,
'o'
,
's'
,
'a'
,
'i'
,
'c'
,
'U'
,
'p'
,
'd'
,
'a'
,
't'
,
'e'
,
'd'
,
'S'
,
'i'
,
'g'
,
0
};
static
const
WCHAR
sha256ECDSA
[]
=
{
's'
,
'h'
,
'a'
,
'2'
,
'5'
,
'6'
,
'E'
,
'C'
,
'D'
,
'S'
,
'A'
,
0
};
static
const
WCHAR
sha384ECDSA
[]
=
{
's'
,
'h'
,
'a'
,
'3'
,
'8'
,
'4'
,
'E'
,
'C'
,
'D'
,
'S'
,
'A'
,
0
};
static
const
WCHAR
CN
[]
=
{
'C'
,
'N'
,
0
};
static
const
WCHAR
L
[]
=
{
'L'
,
0
};
static
const
WCHAR
O
[]
=
{
'O'
,
0
};
static
const
WCHAR
OU
[]
=
{
'O'
,
'U'
,
0
};
static
const
WCHAR
E
[]
=
{
'E'
,
0
};
static
const
WCHAR
C
[]
=
{
'C'
,
0
};
static
const
WCHAR
S
[]
=
{
'S'
,
0
};
static
const
WCHAR
ST
[]
=
{
'S'
,
'T'
,
0
};
static
const
WCHAR
STREET
[]
=
{
'S'
,
'T'
,
'R'
,
'E'
,
'E'
,
'T'
,
0
};
static
const
WCHAR
T
[]
=
{
'T'
,
0
};
static
const
WCHAR
Title
[]
=
{
'T'
,
'i'
,
't'
,
'l'
,
'e'
,
0
};
static
const
WCHAR
G
[]
=
{
'G'
,
0
};
static
const
WCHAR
GivenName
[]
=
{
'G'
,
'i'
,
'v'
,
'e'
,
'n'
,
'N'
,
'a'
,
'm'
,
'e'
,
0
};
static
const
WCHAR
I
[]
=
{
'I'
,
0
};
static
const
WCHAR
Initials
[]
=
{
'I'
,
'n'
,
'i'
,
't'
,
'i'
,
'a'
,
'l'
,
's'
,
0
};
static
const
WCHAR
SN
[]
=
{
'S'
,
'N'
,
0
};
static
const
WCHAR
DC
[]
=
{
'D'
,
'C'
,
0
};
static
const
WCHAR
Description
[]
=
{
'D'
,
'e'
,
's'
,
'c'
,
'r'
,
'i'
,
'p'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
static
const
WCHAR
PostalCode
[]
=
{
'P'
,
'o'
,
's'
,
't'
,
'a'
,
'l'
,
'C'
,
'o'
,
'd'
,
'e'
,
0
};
static
const
WCHAR
POBox
[]
=
{
'P'
,
'O'
,
'B'
,
'o'
,
'x'
,
0
};
static
const
WCHAR
Phone
[]
=
{
'P'
,
'h'
,
'o'
,
'n'
,
'e'
,
0
};
static
const
WCHAR
X21Address
[]
=
{
'X'
,
'2'
,
'1'
,
'A'
,
'd'
,
'd'
,
'r'
,
'e'
,
's'
,
's'
,
0
};
static
const
WCHAR
dnQualifier
[]
=
{
'd'
,
'n'
,
'Q'
,
'u'
,
'a'
,
'l'
,
'i'
,
'f'
,
'i'
,
'e'
,
'r'
,
0
};
static
const
WCHAR
SpcSpAgencyInfo
[]
=
{
'S'
,
'p'
,
'c'
,
'S'
,
'p'
,
'A'
,
'g'
,
'e'
,
'n'
,
'c'
,
'y'
,
'I'
,
'n'
,
'f'
,
'o'
,
0
};
static
const
WCHAR
SpcFinancialCriteria
[]
=
{
'S'
,
'p'
,
'c'
,
'F'
,
'i'
,
'n'
,
'a'
,
'n'
,
'c'
,
'i'
,
'a'
,
'l'
,
'C'
,
'r'
,
'i'
,
't'
,
'e'
,
'r'
,
'i'
,
'a'
,
0
};
static
const
WCHAR
SpcMinimalCriteria
[]
=
{
'S'
,
'p'
,
'c'
,
'M'
,
'i'
,
'n'
,
'i'
,
'm'
,
'a'
,
'l'
,
'C'
,
'r'
,
'i'
,
't'
,
'e'
,
'r'
,
'i'
,
'a'
,
0
};
static
const
WCHAR
Email
[]
=
{
'E'
,
'm'
,
'a'
,
'i'
,
'l'
,
0
};
static
const
WCHAR
GN
[]
=
{
'G'
,
'N'
,
0
};
static
const
WCHAR
SERIALNUMBER
[]
=
{
'S'
,
'E'
,
'R'
,
'I'
,
'A'
,
'L'
,
'N'
,
'U'
,
'M'
,
'B'
,
'E'
,
'R'
,
0
};
static
const
DWORD
noNullFlag
=
CRYPT_OID_NO_NULL_ALGORITHM_PARA_FLAG
;
static
const
DWORD
mosaicFlags
=
CRYPT_OID_INHIBIT_SIGNATURE_FORMAT_FLAG
|
CRYPT_OID_NO_NULL_ALGORITHM_PARA_FLAG
;
...
...
@@ -1319,91 +1239,89 @@ static const struct OIDInfoConstructor {
const
WCHAR
*
pwszCNGAlgid
;
const
WCHAR
*
pwszCNGExtraAlgid
;
}
oidInfoConstructors
[]
=
{
{
1
,
szOID_OIWSEC_sha1
,
CALG_SHA1
,
sha1
,
NULL
},
{
1
,
szOID_OIWSEC_sha1
,
CALG_SHA1
,
sha
,
NULL
},
{
1
,
szOID_OIWSEC_sha
,
CALG_SHA
,
sha
,
NULL
},
{
1
,
szOID_RSA_MD5
,
CALG_MD5
,
md5
,
NULL
},
{
1
,
szOID_RSA_MD4
,
CALG_MD4
,
md4
,
NULL
},
{
1
,
szOID_RSA_MD2
,
CALG_MD2
,
md2
,
NULL
},
{
1
,
szOID_OIWSEC_sha1
,
CALG_SHA1
,
L"sha1"
,
NULL
},
{
1
,
szOID_OIWSEC_sha1
,
CALG_SHA1
,
L"sha"
,
NULL
},
{
1
,
szOID_OIWSEC_sha
,
CALG_SHA
,
L"sha"
,
NULL
},
{
1
,
szOID_RSA_MD5
,
CALG_MD5
,
L"md5"
,
NULL
},
{
1
,
szOID_RSA_MD4
,
CALG_MD4
,
L"md4"
,
NULL
},
{
1
,
szOID_RSA_MD2
,
CALG_MD2
,
L"md2"
,
NULL
},
/* NOTE: Windows Vista+ uses -1 instead of CALG_SHA_* following SHA entries. */
{
1
,
szOID_NIST_sha256
,
CALG_SHA_256
,
sha256
,
NULL
},
{
1
,
szOID_NIST_sha384
,
CALG_SHA_384
,
sha384
,
NULL
},
{
1
,
szOID_NIST_sha512
,
CALG_SHA_512
,
sha512
,
NULL
},
{
2
,
szOID_OIWSEC_desCBC
,
CALG_DES
,
des
,
NULL
},
{
2
,
szOID_RSA_DES_EDE3_CBC
,
CALG_3DES
,
tripledes
,
NULL
},
{
2
,
szOID_RSA_RC2CBC
,
CALG_RC2
,
rc2
,
NULL
},
{
2
,
szOID_RSA_RC4
,
CALG_RC4
,
rc4
,
NULL
},
{
2
,
szOID_RSA_SMIMEalgCMS3DESwrap
,
CALG_3DES
,
cms3deswrap
,
NULL
},
{
2
,
szOID_RSA_SMIMEalgCMSRC2wrap
,
CALG_RC2
,
cmsrc2wrap
,
NULL
},
{
3
,
szOID_RSA_RSA
,
CALG_RSA_KEYX
,
RSA
,
NULL
},
{
3
,
szOID_X957_DSA
,
CALG_DSS_SIGN
,
DSA
,
&
noNullBlob
},
{
3
,
szOID_ANSI_X942_DH
,
CALG_DH_SF
,
DH
,
&
noNullBlob
},
{
3
,
szOID_RSA_RSA
,
CALG_RSA_KEYX
,
RSA_KEYX
,
NULL
},
{
3
,
szOID_RSA_RSA
,
CALG_RSA_SIGN
,
RSA
,
NULL
},
{
3
,
szOID_RSA_RSA
,
CALG_RSA_SIGN
,
RSA_SIGN
,
NULL
},
{
3
,
szOID_OIWSEC_dsa
,
CALG_DSS_SIGN
,
DSA
,
&
noNullBlob
},
{
3
,
szOID_OIWSEC_dsa
,
CALG_DSS_SIGN
,
DSS
,
&
noNullBlob
},
{
3
,
szOID_OIWSEC_dsa
,
CALG_DSS_SIGN
,
DSA_SIGN
,
&
noNullBlob
},
{
3
,
szOID_RSA_DH
,
CALG_DH_SF
,
DH
,
&
noNullBlob
},
{
3
,
szOID_OIWSEC_rsaXchg
,
CALG_RSA_KEYX
,
RSA_KEYX
,
NULL
},
{
3
,
szOID_INFOSEC_mosaicKMandUpdSig
,
CALG_DSS_SIGN
,
mosaicKMandUpdSig
,
&
mosaicFlagsBlob
},
{
3
,
szOID_RSA_SMIMEalgESDH
,
CALG_DH_EPHEM
,
ESDH
,
&
noNullBlob
},
{
3
,
szOID_PKIX_NO_SIGNATURE
,
CALG_NO_SIGN
,
NO_SIGN
,
NULL
},
{
4
,
szOID_RSA_SHA1RSA
,
CALG_SHA1
,
sha1RSA
,
&
rsaSignBlob
},
{
4
,
szOID_RSA_SHA256RSA
,
CALG_SHA_256
,
sha256RSA
,
&
rsaSignBlob
},
{
4
,
szOID_RSA_SHA384RSA
,
CALG_SHA_384
,
sha384RSA
,
&
rsaSignBlob
},
{
4
,
szOID_RSA_SHA512RSA
,
CALG_SHA_512
,
sha512RSA
,
&
rsaSignBlob
},
{
4
,
szOID_RSA_MD5RSA
,
CALG_MD5
,
md5RSA
,
&
rsaSignBlob
},
{
4
,
szOID_X957_SHA1DSA
,
CALG_SHA1
,
sha1DSA
,
&
dssSignBlob
},
{
4
,
szOID_OIWSEC_sha1RSASign
,
CALG_SHA1
,
sha1RSA
,
&
rsaSignBlob
},
{
4
,
szOID_OIWSEC_sha1RSASign
,
CALG_SHA1
,
shaRSA
,
&
rsaSignBlob
},
{
4
,
szOID_OIWSEC_shaRSA
,
CALG_SHA1
,
shaRSA
,
&
rsaSignBlob
},
{
4
,
szOID_OIWSEC_md5RSA
,
CALG_MD5
,
md5RSA
,
&
rsaSignBlob
},
{
4
,
szOID_RSA_MD2RSA
,
CALG_MD2
,
md2RSA
,
&
rsaSignBlob
},
{
4
,
szOID_RSA_MD4RSA
,
CALG_MD4
,
md4RSA
,
&
rsaSignBlob
},
{
4
,
szOID_OIWSEC_md4RSA
,
CALG_MD4
,
md4RSA
,
&
rsaSignBlob
},
{
4
,
szOID_OIWSEC_md4RSA2
,
CALG_MD4
,
md4RSA
,
&
rsaSignBlob
},
{
4
,
szOID_OIWDIR_md2RSA
,
CALG_MD2
,
md2RSA
,
&
rsaSignBlob
},
{
4
,
szOID_OIWSEC_shaDSA
,
CALG_SHA1
,
sha1DSA
,
&
dssSignBlob
},
{
4
,
szOID_OIWSEC_shaDSA
,
CALG_SHA1
,
shaDSA
,
&
dssSignBlob
},
{
4
,
szOID_OIWSEC_dsaSHA1
,
CALG_SHA1
,
dsaSHA1
,
&
dssSignBlob
},
{
4
,
szOID_INFOSEC_mosaicUpdatedSig
,
CALG_SHA1
,
mosaicUpdatedSig
,
&
mosaicSignBlob
},
{
4
,
szOID_ECDSA_SHA256
,
CALG_OID_INFO_CNG_ONLY
,
sha256ECDSA
,
&
ecdsaSignBlob
,
{
1
,
szOID_NIST_sha256
,
CALG_SHA_256
,
L"sha256"
,
NULL
},
{
1
,
szOID_NIST_sha384
,
CALG_SHA_384
,
L"sha384"
,
NULL
},
{
1
,
szOID_NIST_sha512
,
CALG_SHA_512
,
L"sha512"
,
NULL
},
{
2
,
szOID_OIWSEC_desCBC
,
CALG_DES
,
L"des"
,
NULL
},
{
2
,
szOID_RSA_DES_EDE3_CBC
,
CALG_3DES
,
L"3des"
,
NULL
},
{
2
,
szOID_RSA_RC2CBC
,
CALG_RC2
,
L"rc2"
,
NULL
},
{
2
,
szOID_RSA_RC4
,
CALG_RC4
,
L"rc4"
,
NULL
},
{
2
,
szOID_RSA_SMIMEalgCMS3DESwrap
,
CALG_3DES
,
L"CMS3DESwrap"
,
NULL
},
{
2
,
szOID_RSA_SMIMEalgCMSRC2wrap
,
CALG_RC2
,
L"CMSRC2wrap"
,
NULL
},
{
3
,
szOID_RSA_RSA
,
CALG_RSA_KEYX
,
L"RSA"
,
NULL
},
{
3
,
szOID_X957_DSA
,
CALG_DSS_SIGN
,
L"DSA"
,
&
noNullBlob
},
{
3
,
szOID_ANSI_X942_DH
,
CALG_DH_SF
,
L"DH"
,
&
noNullBlob
},
{
3
,
szOID_RSA_RSA
,
CALG_RSA_KEYX
,
L"RSA_KEYX"
,
NULL
},
{
3
,
szOID_RSA_RSA
,
CALG_RSA_SIGN
,
L"RSA"
,
NULL
},
{
3
,
szOID_RSA_RSA
,
CALG_RSA_SIGN
,
L"RSA_SIGN"
,
NULL
},
{
3
,
szOID_OIWSEC_dsa
,
CALG_DSS_SIGN
,
L"DSA"
,
&
noNullBlob
},
{
3
,
szOID_OIWSEC_dsa
,
CALG_DSS_SIGN
,
L"DSS"
,
&
noNullBlob
},
{
3
,
szOID_OIWSEC_dsa
,
CALG_DSS_SIGN
,
L"DSA_SIGN"
,
&
noNullBlob
},
{
3
,
szOID_RSA_DH
,
CALG_DH_SF
,
L"DH"
,
&
noNullBlob
},
{
3
,
szOID_OIWSEC_rsaXchg
,
CALG_RSA_KEYX
,
L"RSA_KEYX"
,
NULL
},
{
3
,
szOID_INFOSEC_mosaicKMandUpdSig
,
CALG_DSS_SIGN
,
L"mosaicKMandUpdSig"
,
&
mosaicFlagsBlob
},
{
3
,
szOID_RSA_SMIMEalgESDH
,
CALG_DH_EPHEM
,
L"ESDH"
,
&
noNullBlob
},
{
3
,
szOID_PKIX_NO_SIGNATURE
,
CALG_NO_SIGN
,
L"NOSIGN"
,
NULL
},
{
4
,
szOID_RSA_SHA1RSA
,
CALG_SHA1
,
L"sha1RSA"
,
&
rsaSignBlob
},
{
4
,
szOID_RSA_SHA256RSA
,
CALG_SHA_256
,
L"sha256RSA"
,
&
rsaSignBlob
},
{
4
,
szOID_RSA_SHA384RSA
,
CALG_SHA_384
,
L"sha384RSA"
,
&
rsaSignBlob
},
{
4
,
szOID_RSA_SHA512RSA
,
CALG_SHA_512
,
L"sha512RSA"
,
&
rsaSignBlob
},
{
4
,
szOID_RSA_MD5RSA
,
CALG_MD5
,
L"md5RSA"
,
&
rsaSignBlob
},
{
4
,
szOID_X957_SHA1DSA
,
CALG_SHA1
,
L"sha1DSA"
,
&
dssSignBlob
},
{
4
,
szOID_OIWSEC_sha1RSASign
,
CALG_SHA1
,
L"sha1RSA"
,
&
rsaSignBlob
},
{
4
,
szOID_OIWSEC_sha1RSASign
,
CALG_SHA1
,
L"shaRSA"
,
&
rsaSignBlob
},
{
4
,
szOID_OIWSEC_shaRSA
,
CALG_SHA1
,
L"shaRSA"
,
&
rsaSignBlob
},
{
4
,
szOID_OIWSEC_md5RSA
,
CALG_MD5
,
L"md5RSA"
,
&
rsaSignBlob
},
{
4
,
szOID_RSA_MD2RSA
,
CALG_MD2
,
L"md2RSA"
,
&
rsaSignBlob
},
{
4
,
szOID_RSA_MD4RSA
,
CALG_MD4
,
L"md4RSA"
,
&
rsaSignBlob
},
{
4
,
szOID_OIWSEC_md4RSA
,
CALG_MD4
,
L"md4RSA"
,
&
rsaSignBlob
},
{
4
,
szOID_OIWSEC_md4RSA2
,
CALG_MD4
,
L"md4RSA"
,
&
rsaSignBlob
},
{
4
,
szOID_OIWDIR_md2RSA
,
CALG_MD2
,
L"md2RSA"
,
&
rsaSignBlob
},
{
4
,
szOID_OIWSEC_shaDSA
,
CALG_SHA1
,
L"sha1DSA"
,
&
dssSignBlob
},
{
4
,
szOID_OIWSEC_shaDSA
,
CALG_SHA1
,
L"shaDSA"
,
&
dssSignBlob
},
{
4
,
szOID_OIWSEC_dsaSHA1
,
CALG_SHA1
,
L"dsaSHA1"
,
&
dssSignBlob
},
{
4
,
szOID_INFOSEC_mosaicUpdatedSig
,
CALG_SHA1
,
L"mosaicUpdatedSig"
,
&
mosaicSignBlob
},
{
4
,
szOID_ECDSA_SHA256
,
CALG_OID_INFO_CNG_ONLY
,
L"sha256ECDSA"
,
&
ecdsaSignBlob
,
BCRYPT_SHA256_ALGORITHM
,
CRYPT_OID_INFO_ECC_PARAMETERS_ALGORITHM
},
{
4
,
szOID_ECDSA_SHA384
,
CALG_OID_INFO_CNG_ONLY
,
sha384ECDSA
,
&
ecdsaSignBlob
,
{
4
,
szOID_ECDSA_SHA384
,
CALG_OID_INFO_CNG_ONLY
,
L"sha384ECDSA"
,
&
ecdsaSignBlob
,
BCRYPT_SHA384_ALGORITHM
,
CRYPT_OID_INFO_ECC_PARAMETERS_ALGORITHM
},
{
5
,
szOID_COMMON_NAME
,
0
,
CN
,
NULL
},
{
5
,
szOID_LOCALITY_NAME
,
0
,
L
,
NULL
},
{
5
,
szOID_ORGANIZATION_NAME
,
0
,
O
,
NULL
},
{
5
,
szOID_ORGANIZATIONAL_UNIT_NAME
,
0
,
OU
,
NULL
},
{
5
,
szOID_RSA_emailAddr
,
0
,
E
,
&
ia5StringBlob
},
{
5
,
szOID_RSA_emailAddr
,
0
,
Email
,
&
ia5StringBlob
},
{
5
,
szOID_COUNTRY_NAME
,
0
,
C
,
&
printableStringBlob
},
{
5
,
szOID_STATE_OR_PROVINCE_NAME
,
0
,
S
,
NULL
},
{
5
,
szOID_STATE_OR_PROVINCE_NAME
,
0
,
ST
,
NULL
},
{
5
,
szOID_STREET_ADDRESS
,
0
,
STREET
,
NULL
},
{
5
,
szOID_TITLE
,
0
,
T
,
NULL
},
{
5
,
szOID_TITLE
,
0
,
Title
,
NULL
},
{
5
,
szOID_GIVEN_NAME
,
0
,
G
,
NULL
},
{
5
,
szOID_GIVEN_NAME
,
0
,
GN
,
NULL
},
{
5
,
szOID_GIVEN_NAME
,
0
,
GivenName
,
NULL
},
{
5
,
szOID_INITIALS
,
0
,
I
,
NULL
},
{
5
,
szOID_INITIALS
,
0
,
Initials
,
NULL
},
{
5
,
szOID_SUR_NAME
,
0
,
SN
,
NULL
},
{
5
,
szOID_DOMAIN_COMPONENT
,
0
,
DC
,
&
domainCompTypesBlob
},
{
5
,
szOID_DESCRIPTION
,
0
,
Description
,
NULL
},
{
5
,
szOID_POSTAL_CODE
,
0
,
PostalCode
,
NULL
},
{
5
,
szOID_POST_OFFICE_BOX
,
0
,
POBox
,
NULL
},
{
5
,
szOID_TELEPHONE_NUMBER
,
0
,
Phone
,
&
printableStringBlob
},
{
5
,
szOID_X21_ADDRESS
,
0
,
X21Address
,
&
numericStringBlob
},
{
5
,
szOID_DN_QUALIFIER
,
0
,
dnQualifier
,
NULL
},
{
5
,
szOID_DEVICE_SERIAL_NUMBER
,
0
,
SERIALNUMBER
,
NULL
},
{
5
,
szOID_COMMON_NAME
,
0
,
L"CN"
,
NULL
},
{
5
,
szOID_LOCALITY_NAME
,
0
,
L
"L"
,
NULL
},
{
5
,
szOID_ORGANIZATION_NAME
,
0
,
L"O"
,
NULL
},
{
5
,
szOID_ORGANIZATIONAL_UNIT_NAME
,
0
,
L"OU"
,
NULL
},
{
5
,
szOID_RSA_emailAddr
,
0
,
L"E"
,
&
ia5StringBlob
},
{
5
,
szOID_RSA_emailAddr
,
0
,
L"Email"
,
&
ia5StringBlob
},
{
5
,
szOID_COUNTRY_NAME
,
0
,
L"C"
,
&
printableStringBlob
},
{
5
,
szOID_STATE_OR_PROVINCE_NAME
,
0
,
L"S"
,
NULL
},
{
5
,
szOID_STATE_OR_PROVINCE_NAME
,
0
,
L"ST"
,
NULL
},
{
5
,
szOID_STREET_ADDRESS
,
0
,
L"STREET"
,
NULL
},
{
5
,
szOID_TITLE
,
0
,
L"T"
,
NULL
},
{
5
,
szOID_TITLE
,
0
,
L"Title"
,
NULL
},
{
5
,
szOID_GIVEN_NAME
,
0
,
L"G"
,
NULL
},
{
5
,
szOID_GIVEN_NAME
,
0
,
L"GN"
,
NULL
},
{
5
,
szOID_GIVEN_NAME
,
0
,
L"GivenName"
,
NULL
},
{
5
,
szOID_INITIALS
,
0
,
L"I"
,
NULL
},
{
5
,
szOID_INITIALS
,
0
,
L"Initials"
,
NULL
},
{
5
,
szOID_SUR_NAME
,
0
,
L"SN"
,
NULL
},
{
5
,
szOID_DOMAIN_COMPONENT
,
0
,
L"DC"
,
&
domainCompTypesBlob
},
{
5
,
szOID_DESCRIPTION
,
0
,
L"Description"
,
NULL
},
{
5
,
szOID_POSTAL_CODE
,
0
,
L"PostalCode"
,
NULL
},
{
5
,
szOID_POST_OFFICE_BOX
,
0
,
L"POBox"
,
NULL
},
{
5
,
szOID_TELEPHONE_NUMBER
,
0
,
L"Phone"
,
&
printableStringBlob
},
{
5
,
szOID_X21_ADDRESS
,
0
,
L"X21Address"
,
&
numericStringBlob
},
{
5
,
szOID_DN_QUALIFIER
,
0
,
L"dnQualifier"
,
NULL
},
{
5
,
szOID_DEVICE_SERIAL_NUMBER
,
0
,
L"SERIALNUMBER"
,
NULL
},
{
6
,
szOID_AUTHORITY_KEY_IDENTIFIER2
,
0
,
(
LPCWSTR
)
IDS_AUTHORITY_KEY_ID
,
NULL
},
{
6
,
szOID_AUTHORITY_KEY_IDENTIFIER
,
0
,
(
LPCWSTR
)
IDS_AUTHORITY_KEY_ID
,
NULL
},
...
...
@@ -1451,9 +1369,9 @@ static const struct OIDInfoConstructor {
{
6
,
szOID_NETSCAPE_CA_POLICY_URL
,
0
,
(
LPCWSTR
)
IDS_NETSCAPE_CA_POLICY_URL
,
NULL
},
{
6
,
szOID_NETSCAPE_SSL_SERVER_NAME
,
0
,
(
LPCWSTR
)
IDS_NETSCAPE_SSL_SERVER_NAME
,
NULL
},
{
6
,
szOID_NETSCAPE_COMMENT
,
0
,
(
LPCWSTR
)
IDS_NETSCAPE_COMMENT
,
NULL
},
{
6
,
"1.3.6.1.4.1.311.2.1.10"
,
0
,
SpcSpAgencyInfo
,
NULL
},
{
6
,
"1.3.6.1.4.1.311.2.1.27"
,
0
,
SpcFinancialCriteria
,
NULL
},
{
6
,
"1.3.6.1.4.1.311.2.1.26"
,
0
,
SpcMinimalCriteria
,
NULL
},
{
6
,
"1.3.6.1.4.1.311.2.1.10"
,
0
,
L"SpcSpAgencyInfo"
,
NULL
},
{
6
,
"1.3.6.1.4.1.311.2.1.27"
,
0
,
L"SpcFinancialCriteria"
,
NULL
},
{
6
,
"1.3.6.1.4.1.311.2.1.26"
,
0
,
L"SpcMinimalCriteria"
,
NULL
},
{
6
,
szOID_COUNTRY_NAME
,
0
,
(
LPCWSTR
)
IDS_COUNTRY
,
NULL
},
{
6
,
szOID_ORGANIZATION_NAME
,
0
,
(
LPCWSTR
)
IDS_ORGANIZATION
,
NULL
},
{
6
,
szOID_ORGANIZATIONAL_UNIT_NAME
,
0
,
(
LPCWSTR
)
IDS_ORGANIZATIONAL_UNIT
,
NULL
},
...
...
@@ -1582,17 +1500,17 @@ static struct OIDInfo *read_oid_info(HKEY root, char *key_name, DWORD *flags)
oid_len
=
strlen
(
key_name
)
+
1
;
RegQueryValueExW
(
key
,
nameW
,
NULL
,
NULL
,
NULL
,
&
name_len
);
RegQueryValueExW
(
key
,
extraW
,
NULL
,
NULL
,
NULL
,
&
extra_len
);
RegQueryValueExW
(
key
,
cngalgidW
,
NULL
,
NULL
,
NULL
,
&
cngalgid_len
);
RegQueryValueExW
(
key
,
cngextraalgidW
,
NULL
,
NULL
,
NULL
,
&
cngextra_len
);
RegQueryValueExW
(
key
,
L"Name"
,
NULL
,
NULL
,
NULL
,
&
name_len
);
RegQueryValueExW
(
key
,
L"ExtraInfo"
,
NULL
,
NULL
,
NULL
,
&
extra_len
);
RegQueryValueExW
(
key
,
L"CNGAlgid"
,
NULL
,
NULL
,
NULL
,
&
cngalgid_len
);
RegQueryValueExW
(
key
,
L"CNGExtraAlgid"
,
NULL
,
NULL
,
NULL
,
&
cngextra_len
);
info
=
CryptMemAlloc
(
sizeof
(
*
info
)
+
oid_len
+
name_len
+
extra_len
+
cngalgid_len
+
cngextra_len
);
if
(
info
)
{
*
flags
=
0
;
len
=
sizeof
(
*
flags
);
RegQueryValueExW
(
key
,
flagsW
,
NULL
,
NULL
,
(
BYTE
*
)
flags
,
&
len
);
RegQueryValueExW
(
key
,
L"Flags"
,
NULL
,
NULL
,
(
BYTE
*
)
flags
,
&
len
);
memset
(
info
,
0
,
sizeof
(
*
info
));
info
->
info
.
cbSize
=
sizeof
(
info
->
info
);
...
...
@@ -1606,34 +1524,34 @@ static struct OIDInfo *read_oid_info(HKEY root, char *key_name, DWORD *flags)
if
(
name_len
)
{
info
->
info
.
pwszName
=
(
WCHAR
*
)
p
;
RegQueryValueExW
(
key
,
nameW
,
NULL
,
NULL
,
(
BYTE
*
)
info
->
info
.
pwszName
,
&
name_len
);
RegQueryValueExW
(
key
,
L"Name"
,
NULL
,
NULL
,
(
BYTE
*
)
info
->
info
.
pwszName
,
&
name_len
);
p
+=
name_len
;
}
info
->
info
.
dwGroupId
=
group_id
;
len
=
sizeof
(
info
->
info
.
u
.
Algid
);
RegQueryValueExW
(
key
,
algidW
,
NULL
,
NULL
,
(
BYTE
*
)
&
info
->
info
.
u
.
Algid
,
&
len
);
RegQueryValueExW
(
key
,
L"Algid"
,
NULL
,
NULL
,
(
BYTE
*
)
&
info
->
info
.
u
.
Algid
,
&
len
);
if
(
extra_len
)
{
info
->
info
.
ExtraInfo
.
cbData
=
extra_len
;
info
->
info
.
ExtraInfo
.
pbData
=
(
BYTE
*
)
p
;
RegQueryValueExW
(
key
,
extraW
,
NULL
,
NULL
,
info
->
info
.
ExtraInfo
.
pbData
,
&
extra_len
);
RegQueryValueExW
(
key
,
L"ExtraInfo"
,
NULL
,
NULL
,
info
->
info
.
ExtraInfo
.
pbData
,
&
extra_len
);
p
+=
extra_len
;
}
if
(
cngalgid_len
)
{
info
->
info
.
pwszCNGAlgid
=
(
WCHAR
*
)
p
;
RegQueryValueExW
(
key
,
cngalgidW
,
NULL
,
NULL
,
(
BYTE
*
)
info
->
info
.
pwszCNGAlgid
,
&
cngalgid_len
);
RegQueryValueExW
(
key
,
L"CNGAlgid"
,
NULL
,
NULL
,
(
BYTE
*
)
info
->
info
.
pwszCNGAlgid
,
&
cngalgid_len
);
p
+=
cngalgid_len
;
}
if
(
cngextra_len
)
{
info
->
info
.
pwszCNGExtraAlgid
=
(
WCHAR
*
)
p
;
RegQueryValueExW
(
key
,
cngextraalgidW
,
NULL
,
NULL
,
(
BYTE
*
)
info
->
info
.
pwszCNGExtraAlgid
,
&
cngalgid_len
);
RegQueryValueExW
(
key
,
L"CNGExtraAlgid"
,
NULL
,
NULL
,
(
BYTE
*
)
info
->
info
.
pwszCNGExtraAlgid
,
&
cngalgid_len
);
}
}
...
...
@@ -1647,7 +1565,7 @@ static void init_registered_oid_info(void)
DWORD
err
,
idx
;
HKEY
root
;
err
=
RegOpenKeyEx
A
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Microsoft
\\
Cryptography
\\
OID
\\
EncodingType 0
\\
CryptDllFindOIDInfo"
,
err
=
RegOpenKeyEx
W
(
HKEY_LOCAL_MACHINE
,
L
"Software
\\
Microsoft
\\
Cryptography
\\
OID
\\
EncodingType 0
\\
CryptDllFindOIDInfo"
,
0
,
KEY_ALL_ACCESS
,
&
root
);
if
(
err
!=
ERROR_SUCCESS
)
return
;
...
...
dlls/crypt32/protectdata.c
View file @
4120fb99
...
...
@@ -826,7 +826,6 @@ BOOL WINAPI CryptProtectData(DATA_BLOB* pDataIn,
DWORD
dwFlags
,
DATA_BLOB
*
pDataOut
)
{
static
const
WCHAR
empty_str
[
1
];
BOOL
rc
=
FALSE
;
HCRYPTPROV
hProv
;
struct
protect_data_t
protect_data
;
...
...
@@ -852,7 +851,7 @@ BOOL WINAPI CryptProtectData(DATA_BLOB* pDataIn,
/* Windows appears to create an empty szDataDescr instead of maintaining
* a NULL */
if
(
!
szDataDescr
)
szDataDescr
=
empty_str
;
szDataDescr
=
L""
;
/* get crypt context */
if
(
!
CryptAcquireContextW
(
&
hProv
,
NULL
,
MS_ENHANCED_PROV_W
,
CRYPT32_PROTECTDATA_PROV
,
CRYPT_VERIFYCONTEXT
))
...
...
dlls/crypt32/regstore.c
View file @
4120fb99
...
...
@@ -47,22 +47,15 @@ typedef struct _WINE_REGSTOREINFO
static
void
CRYPT_HashToStr
(
const
BYTE
*
hash
,
LPWSTR
asciiHash
)
{
static
const
WCHAR
fmt
[]
=
{
'%'
,
'0'
,
'2'
,
'X'
,
0
};
DWORD
i
;
assert
(
hash
);
assert
(
asciiHash
);
for
(
i
=
0
;
i
<
20
;
i
++
)
wsprintfW
(
asciiHash
+
i
*
2
,
fmt
,
hash
[
i
]);
wsprintfW
(
asciiHash
+
i
*
2
,
L"%02X"
,
hash
[
i
]);
}
static
const
WCHAR
CertsW
[]
=
{
'C'
,
'e'
,
'r'
,
't'
,
'i'
,
'f'
,
'i'
,
'c'
,
'a'
,
't'
,
'e'
,
's'
,
0
};
static
const
WCHAR
CRLsW
[]
=
{
'C'
,
'R'
,
'L'
,
's'
,
0
};
static
const
WCHAR
CTLsW
[]
=
{
'C'
,
'T'
,
'L'
,
's'
,
0
};
static
const
WCHAR
BlobW
[]
=
{
'B'
,
'l'
,
'o'
,
'b'
,
0
};
static
void
CRYPT_RegReadSerializedFromReg
(
HKEY
key
,
DWORD
contextType
,
HCERTSTORE
store
)
{
...
...
@@ -85,12 +78,12 @@ static void CRYPT_RegReadSerializedFromReg(HKEY key, DWORD contextType,
LPBYTE
buf
=
NULL
;
size
=
0
;
rc
=
RegQueryValueExW
(
subKey
,
BlobW
,
NULL
,
NULL
,
NULL
,
&
size
);
rc
=
RegQueryValueExW
(
subKey
,
L"Blob"
,
NULL
,
NULL
,
NULL
,
&
size
);
if
(
!
rc
)
buf
=
CryptMemAlloc
(
size
);
if
(
buf
)
{
rc
=
RegQueryValueExW
(
subKey
,
BlobW
,
NULL
,
NULL
,
buf
,
rc
=
RegQueryValueExW
(
subKey
,
L"Blob"
,
NULL
,
NULL
,
buf
,
&
size
);
if
(
!
rc
)
{
...
...
@@ -158,7 +151,7 @@ static void CRYPT_RegReadSerializedFromReg(HKEY key, DWORD contextType,
static
void
CRYPT_RegReadFromReg
(
HKEY
key
,
HCERTSTORE
store
)
{
static
const
WCHAR
*
const
subKeys
[]
=
{
CertsW
,
CRLsW
,
CTLsW
};
static
const
WCHAR
*
const
subKeys
[]
=
{
L"Certificates"
,
L"CRLs"
,
L"CTLs"
};
static
const
DWORD
contextFlags
[]
=
{
CERT_STORE_CERTIFICATE_CONTEXT_FLAG
,
CERT_STORE_CRL_CONTEXT_FLAG
,
CERT_STORE_CTL_CONTEXT_FLAG
};
DWORD
i
;
...
...
@@ -192,7 +185,7 @@ static BOOL CRYPT_WriteSerializedToReg(HKEY key, DWORD flags, const BYTE *hash,
&
subKey
,
NULL
);
if
(
!
rc
)
{
rc
=
RegSetValueExW
(
subKey
,
BlobW
,
0
,
REG_BINARY
,
buf
,
len
);
rc
=
RegSetValueExW
(
subKey
,
L"Blob"
,
0
,
REG_BINARY
,
buf
,
len
);
RegCloseKey
(
subKey
);
}
if
(
!
rc
)
...
...
@@ -247,7 +240,7 @@ BOOL CRYPT_SerializeContextsToReg(HKEY key, DWORD flags,
static
BOOL
CRYPT_RegWriteToReg
(
WINE_REGSTOREINFO
*
store
)
{
static
const
WCHAR
*
const
subKeys
[]
=
{
CertsW
,
CRLsW
,
CTLsW
};
static
const
WCHAR
*
const
subKeys
[]
=
{
L"Certificates"
,
L"CRLs"
,
L"CTLs"
};
const
WINE_CONTEXT_INTERFACE
*
const
interfaces
[]
=
{
pCertInterface
,
pCRLInterface
,
pCTLInterface
};
struct
list
*
listToDelete
[]
=
{
&
store
->
certsToDelete
,
&
store
->
crlsToDelete
,
...
...
@@ -518,12 +511,12 @@ WINECRYPT_CERTSTORE *CRYPT_RegOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags,
if
(
dwFlags
&
CERT_STORE_DELETE_FLAG
)
{
DWORD
rc
=
RegDeleteTreeW
((
HKEY
)
pvPara
,
CertsW
);
DWORD
rc
=
RegDeleteTreeW
((
HKEY
)
pvPara
,
L"Certificates"
);
if
(
rc
==
ERROR_SUCCESS
||
rc
==
ERROR_NO_MORE_ITEMS
)
rc
=
RegDeleteTreeW
((
HKEY
)
pvPara
,
CRLsW
);
rc
=
RegDeleteTreeW
((
HKEY
)
pvPara
,
L"CRLs"
);
if
(
rc
==
ERROR_SUCCESS
||
rc
==
ERROR_NO_MORE_ITEMS
)
rc
=
RegDeleteTreeW
((
HKEY
)
pvPara
,
CTLsW
);
rc
=
RegDeleteTreeW
((
HKEY
)
pvPara
,
L"CTLs"
);
if
(
rc
==
ERROR_NO_MORE_ITEMS
)
rc
=
ERROR_SUCCESS
;
SetLastError
(
rc
);
...
...
dlls/crypt32/rootstore.c
View file @
4120fb99
...
...
@@ -653,13 +653,6 @@ static HCERTSTORE create_root_store(void)
return
memStore
;
}
static
const
WCHAR
certs_root_pathW
[]
=
{
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'M'
,
'i'
,
'c'
,
'r'
,
'o'
,
's'
,
'o'
,
'f'
,
't'
,
'\\'
,
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
'C'
,
'e'
,
'r'
,
't'
,
'i'
,
'f'
,
'i'
,
'c'
,
'a'
,
't'
,
'e'
,
's'
,
'\\'
,
'R'
,
'o'
,
'o'
,
't'
,
'\\'
,
'C'
,
'e'
,
'r'
,
't'
,
'i'
,
'f'
,
'i'
,
'c'
,
'a'
,
't'
,
'e'
,
's'
,
0
};
static
const
WCHAR
semaphoreW
[]
=
{
'c'
,
'r'
,
'y'
,
'p'
,
't'
,
'3'
,
'2'
,
'_'
,
'r'
,
'o'
,
'o'
,
't'
,
'_'
,
's'
,
'e'
,
'm'
,
'a'
,
'p'
,
'h'
,
'o'
,
'r'
,
'e'
,
0
};
void
CRYPT_ImportSystemRootCertsToReg
(
void
)
{
HCERTSTORE
store
=
NULL
;
...
...
@@ -672,7 +665,7 @@ void CRYPT_ImportSystemRootCertsToReg(void)
if
(
root_certs_imported
)
return
;
hsem
=
CreateSemaphoreW
(
NULL
,
0
,
1
,
semaphoreW
);
hsem
=
CreateSemaphoreW
(
NULL
,
0
,
1
,
L"crypt32_root_semaphore"
);
if
(
!
hsem
)
{
ERR
(
"Failed to create semaphore
\n
"
);
...
...
@@ -685,7 +678,7 @@ void CRYPT_ImportSystemRootCertsToReg(void)
{
if
((
store
=
create_root_store
()))
{
rc
=
RegCreateKeyExW
(
HKEY_LOCAL_MACHINE
,
certs_root_pathW
,
0
,
NULL
,
0
,
rc
=
RegCreateKeyExW
(
HKEY_LOCAL_MACHINE
,
L"Software
\\
Microsoft
\\
SystemCertificates
\\
Root
\\
Certificates"
,
0
,
NULL
,
0
,
KEY_ALL_ACCESS
,
NULL
,
&
key
,
0
);
if
(
!
rc
)
{
...
...
dlls/crypt32/sip.c
View file @
4120fb99
...
...
@@ -35,32 +35,6 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
crypt
);
static
const
WCHAR
szOID
[]
=
{
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'M'
,
'i'
,
'c'
,
'r'
,
'o'
,
's'
,
'o'
,
'f'
,
't'
,
'\\'
,
'C'
,
'r'
,
'y'
,
'p'
,
't'
,
'o'
,
'g'
,
'r'
,
'a'
,
'p'
,
'h'
,
'y'
,
'\\'
,
'O'
,
'I'
,
'D'
,
'\\'
,
'E'
,
'n'
,
'c'
,
'o'
,
'd'
,
'i'
,
'n'
,
'g'
,
'T'
,
'y'
,
'p'
,
'e'
,
' '
,
'0'
,
'\\'
,
'C'
,
'r'
,
'y'
,
'p'
,
't'
,
'S'
,
'I'
,
'P'
,
'D'
,
'l'
,
'l'
,
0
};
static
const
WCHAR
szPutSigned
[]
=
{
'P'
,
'u'
,
't'
,
'S'
,
'i'
,
'g'
,
'n'
,
'e'
,
'd'
,
'D'
,
'a'
,
't'
,
'a'
,
'M'
,
's'
,
'g'
,
'\\'
,
0
};
static
const
WCHAR
szGetSigned
[]
=
{
'G'
,
'e'
,
't'
,
'S'
,
'i'
,
'g'
,
'n'
,
'e'
,
'd'
,
'D'
,
'a'
,
't'
,
'a'
,
'M'
,
's'
,
'g'
,
'\\'
,
0
};
static
const
WCHAR
szRemoveSigned
[]
=
{
'R'
,
'e'
,
'm'
,
'o'
,
'v'
,
'e'
,
'S'
,
'i'
,
'g'
,
'n'
,
'e'
,
'd'
,
'D'
,
'a'
,
't'
,
'a'
,
'M'
,
's'
,
'g'
,
'\\'
,
0
};
static
const
WCHAR
szCreate
[]
=
{
'C'
,
'r'
,
'e'
,
'a'
,
't'
,
'e'
,
'I'
,
'n'
,
'd'
,
'i'
,
'r'
,
'e'
,
'c'
,
't'
,
'D'
,
'a'
,
't'
,
'a'
,
'\\'
,
0
};
static
const
WCHAR
szVerify
[]
=
{
'V'
,
'e'
,
'r'
,
'i'
,
'f'
,
'y'
,
'I'
,
'n'
,
'd'
,
'i'
,
'r'
,
'e'
,
'c'
,
't'
,
'D'
,
'a'
,
't'
,
'a'
,
'\\'
,
0
};
static
const
WCHAR
szIsMyFile
[]
=
{
'I'
,
's'
,
'M'
,
'y'
,
'F'
,
'i'
,
'l'
,
'e'
,
'T'
,
'y'
,
'p'
,
'e'
,
'\\'
,
0
};
static
const
WCHAR
szIsMyFile2
[]
=
{
'I'
,
's'
,
'M'
,
'y'
,
'F'
,
'i'
,
'l'
,
'e'
,
'T'
,
'y'
,
'p'
,
'e'
,
'2'
,
'\\'
,
0
};
static
const
WCHAR
szDllName
[]
=
{
'D'
,
'l'
,
'l'
,
0
};
static
const
WCHAR
szFuncName
[]
=
{
'F'
,
'u'
,
'n'
,
'c'
,
'N'
,
'a'
,
'm'
,
'e'
,
0
};
/* convert a guid to a wide character string */
static
void
CRYPT_guid2wstr
(
const
GUID
*
guid
,
LPWSTR
wstr
)
{
...
...
@@ -84,7 +58,7 @@ static LONG CRYPT_SIPDeleteFunction( const GUID *guid, LPCWSTR szKey )
LONG
r
=
ERROR_SUCCESS
;
/* max length of szFullKey depends on our code only, so we won't overrun */
lstrcpyW
(
szFullKey
,
szOID
);
lstrcpyW
(
szFullKey
,
L"Software
\\
Microsoft
\\
Cryptography
\\
OID
\\
EncodingType 0
\\
CryptSIPDll"
);
lstrcatW
(
szFullKey
,
szKey
);
CRYPT_guid2wstr
(
guid
,
&
szFullKey
[
lstrlenW
(
szFullKey
)
]
);
...
...
@@ -127,13 +101,13 @@ BOOL WINAPI CryptSIPRemoveProvider(GUID *pgProv)
r = CRYPT_SIPDeleteFunction( pgProv, key); \
if (r != ERROR_SUCCESS) remove_error = r
CRYPT_SIPREMOVEPROV
(
szPutSigned
);
CRYPT_SIPREMOVEPROV
(
szGetSigned
);
CRYPT_SIPREMOVEPROV
(
szRemoveSigned
);
CRYPT_SIPREMOVEPROV
(
szCreate
);
CRYPT_SIPREMOVEPROV
(
szVerify
);
CRYPT_SIPREMOVEPROV
(
szIsMyFile
);
CRYPT_SIPREMOVEPROV
(
szIsMyFile2
);
CRYPT_SIPREMOVEPROV
(
L"PutSignedDataMsg
\\
"
);
CRYPT_SIPREMOVEPROV
(
L"GetSignedDataMsg
\\
"
);
CRYPT_SIPREMOVEPROV
(
L"RemoveSignedDataMsg
\\
"
);
CRYPT_SIPREMOVEPROV
(
L"CreateIndirectData
\\
"
);
CRYPT_SIPREMOVEPROV
(
L"VerifyIndirectData
\\
"
);
CRYPT_SIPREMOVEPROV
(
L"IsMyFileType
\\
"
);
CRYPT_SIPREMOVEPROV
(
L"IsMyFileType2
\\
"
);
#undef CRYPT_SIPREMOVEPROV
...
...
@@ -163,7 +137,7 @@ static LONG CRYPT_SIPWriteFunction( const GUID *guid, LPCWSTR szKey,
return
ERROR_SUCCESS
;
/* max length of szFullKey depends on our code only, so we won't overrun */
lstrcpyW
(
szFullKey
,
szOID
);
lstrcpyW
(
szFullKey
,
L"Software
\\
Microsoft
\\
Cryptography
\\
OID
\\
EncodingType 0
\\
CryptSIPDll"
);
lstrcatW
(
szFullKey
,
szKey
);
CRYPT_guid2wstr
(
guid
,
&
szFullKey
[
lstrlenW
(
szFullKey
)
]
);
...
...
@@ -173,10 +147,10 @@ static LONG CRYPT_SIPWriteFunction( const GUID *guid, LPCWSTR szKey,
if
(
r
!=
ERROR_SUCCESS
)
goto
error_close_key
;
/* write the values */
r
=
RegSetValueExW
(
hKey
,
szFuncName
,
0
,
REG_SZ
,
(
const
BYTE
*
)
szFunction
,
r
=
RegSetValueExW
(
hKey
,
L"FuncName"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
szFunction
,
(
lstrlenW
(
szFunction
)
+
1
)
*
sizeof
(
WCHAR
)
);
if
(
r
!=
ERROR_SUCCESS
)
goto
error_close_key
;
r
=
RegSetValueExW
(
hKey
,
szDllName
,
0
,
REG_SZ
,
(
const
BYTE
*
)
szDll
,
r
=
RegSetValueExW
(
hKey
,
L"Dll"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
szDll
,
(
lstrlenW
(
szDll
)
+
1
)
*
sizeof
(
WCHAR
)
);
error_close_key:
...
...
@@ -234,13 +208,13 @@ BOOL WINAPI CryptSIPAddProvider(SIP_ADD_NEWPROVIDER *psNewProv)
psNewProv->pwszDLLFileName, psNewProv->field); \
if (r != ERROR_SUCCESS) goto end_function
CRYPT_SIPADDPROV
(
szPutSigned
,
pwszPutFuncName
);
CRYPT_SIPADDPROV
(
szGetSigned
,
pwszGetFuncName
);
CRYPT_SIPADDPROV
(
szRemoveSigned
,
pwszRemoveFuncName
);
CRYPT_SIPADDPROV
(
szCreate
,
pwszCreateFuncName
);
CRYPT_SIPADDPROV
(
szVerify
,
pwszVerifyFuncName
);
CRYPT_SIPADDPROV
(
szIsMyFile
,
pwszIsFunctionName
);
CRYPT_SIPADDPROV
(
szIsMyFile2
,
pwszIsFunctionNameFmt2
);
CRYPT_SIPADDPROV
(
L"PutSignedDataMsg
\\
"
,
pwszPutFuncName
);
CRYPT_SIPADDPROV
(
L"GetSignedDataMsg
\\
"
,
pwszGetFuncName
);
CRYPT_SIPADDPROV
(
L"RemoveSignedDataMsg
\\
"
,
pwszRemoveFuncName
);
CRYPT_SIPADDPROV
(
L"CreateIndirectData
\\
"
,
pwszCreateFuncName
);
CRYPT_SIPADDPROV
(
L"VerifyIndirectData
\\
"
,
pwszVerifyFuncName
);
CRYPT_SIPADDPROV
(
L"IsMyFileType
\\
"
,
pwszIsFunctionName
);
CRYPT_SIPADDPROV
(
L"IsMyFileType2
\\
"
,
pwszIsFunctionNameFmt2
);
#undef CRYPT_SIPADDPROV
...
...
@@ -266,7 +240,7 @@ static void *CRYPT_LoadSIPFuncFromKey(HKEY key, HMODULE *pLib)
/* Read the DLL entry */
size
=
sizeof
(
dllName
);
r
=
RegQueryValueExW
(
key
,
szDllName
,
NULL
,
NULL
,
(
LPBYTE
)
dllName
,
&
size
);
r
=
RegQueryValueExW
(
key
,
L"Dll"
,
NULL
,
NULL
,
(
LPBYTE
)
dllName
,
&
size
);
if
(
r
)
goto
end
;
/* Read the Function entry */
...
...
@@ -320,7 +294,6 @@ BOOL WINAPI CryptSIPRetrieveSubjectGuid
static
const
WORD
dosHdr
=
IMAGE_DOS_SIGNATURE
;
static
const
BYTE
cabHdr
[]
=
{
'M'
,
'S'
,
'C'
,
'F'
};
BYTE
hdr
[
SIP_MAX_MAGIC_NUMBER
];
WCHAR
szFullKey
[
0x100
];
LONG
r
=
ERROR_SUCCESS
;
HKEY
key
;
...
...
@@ -431,10 +404,7 @@ BOOL WINAPI CryptSIPRetrieveSubjectGuid
}
/* Check for supported functions using CryptSIPDllIsMyFileType */
/* max length of szFullKey depends on our code only, so we won't overrun */
lstrcpyW
(
szFullKey
,
szOID
);
lstrcatW
(
szFullKey
,
szIsMyFile
);
r
=
RegOpenKeyExW
(
HKEY_LOCAL_MACHINE
,
szFullKey
,
0
,
KEY_READ
,
&
key
);
r
=
RegOpenKeyExW
(
HKEY_LOCAL_MACHINE
,
L"Software
\\
Microsoft
\\
Cryptography
\\
OID
\\
EncodingType 0
\\
CryptSIPDllIsMyFileType
\\
"
,
0
,
KEY_READ
,
&
key
);
if
(
r
==
ERROR_SUCCESS
)
{
DWORD
index
=
0
,
size
;
...
...
@@ -470,9 +440,7 @@ BOOL WINAPI CryptSIPRetrieveSubjectGuid
/* Check for supported functions using CryptSIPDllIsMyFileType2 */
if
(
!
bRet
)
{
lstrcpyW
(
szFullKey
,
szOID
);
lstrcatW
(
szFullKey
,
szIsMyFile2
);
r
=
RegOpenKeyExW
(
HKEY_LOCAL_MACHINE
,
szFullKey
,
0
,
KEY_READ
,
&
key
);
r
=
RegOpenKeyExW
(
HKEY_LOCAL_MACHINE
,
L"Software
\\
Microsoft
\\
Cryptography
\\
OID
\\
EncodingType 0
\\
CryptSIPDllIsMyFileType2
\\
"
,
0
,
KEY_READ
,
&
key
);
if
(
r
==
ERROR_SUCCESS
)
{
DWORD
index
=
0
,
size
;
...
...
@@ -526,7 +494,7 @@ static LONG CRYPT_OpenSIPFunctionKey(const GUID *guid, LPCWSTR function,
{
WCHAR
szFullKey
[
0x100
];
lstrcpyW
(
szFullKey
,
szOID
);
lstrcpyW
(
szFullKey
,
L"Software
\\
Microsoft
\\
Cryptography
\\
OID
\\
EncodingType 0
\\
CryptSIPDll"
);
lstrcatW
(
szFullKey
,
function
);
CRYPT_guid2wstr
(
guid
,
&
szFullKey
[
lstrlenW
(
szFullKey
)]);
return
RegOpenKeyExW
(
HKEY_LOCAL_MACHINE
,
szFullKey
,
0
,
KEY_READ
,
key
);
...
...
@@ -628,25 +596,25 @@ static BOOL CRYPT_LoadSIP(const GUID *pgSubject)
SIP_DISPATCH_INFO
sip
=
{
0
};
HMODULE
lib
=
NULL
,
temp
=
NULL
;
sip
.
pfGet
=
CRYPT_LoadSIPFunc
(
pgSubject
,
szGetSigned
,
&
lib
);
sip
.
pfGet
=
CRYPT_LoadSIPFunc
(
pgSubject
,
L"GetSignedDataMsg
\\
"
,
&
lib
);
if
(
!
sip
.
pfGet
)
goto
error
;
sip
.
pfPut
=
CRYPT_LoadSIPFunc
(
pgSubject
,
szPutSigned
,
&
temp
);
sip
.
pfPut
=
CRYPT_LoadSIPFunc
(
pgSubject
,
L"PutSignedDataMsg
\\
"
,
&
temp
);
if
(
!
sip
.
pfPut
||
temp
!=
lib
)
goto
error
;
FreeLibrary
(
temp
);
temp
=
NULL
;
sip
.
pfCreate
=
CRYPT_LoadSIPFunc
(
pgSubject
,
szCreate
,
&
temp
);
sip
.
pfCreate
=
CRYPT_LoadSIPFunc
(
pgSubject
,
L"CreateIndirectData
\\
"
,
&
temp
);
if
(
!
sip
.
pfCreate
||
temp
!=
lib
)
goto
error
;
FreeLibrary
(
temp
);
temp
=
NULL
;
sip
.
pfVerify
=
CRYPT_LoadSIPFunc
(
pgSubject
,
szVerify
,
&
temp
);
sip
.
pfVerify
=
CRYPT_LoadSIPFunc
(
pgSubject
,
L"VerifyIndirectData
\\
"
,
&
temp
);
if
(
!
sip
.
pfVerify
||
temp
!=
lib
)
goto
error
;
FreeLibrary
(
temp
);
temp
=
NULL
;
sip
.
pfRemove
=
CRYPT_LoadSIPFunc
(
pgSubject
,
szRemoveSigned
,
&
temp
);
sip
.
pfRemove
=
CRYPT_LoadSIPFunc
(
pgSubject
,
L"RemoveSignedDataMsg
\\
"
,
&
temp
);
if
(
!
sip
.
pfRemove
||
temp
!=
lib
)
goto
error
;
FreeLibrary
(
temp
);
...
...
dlls/crypt32/store.c
View file @
4120fb99
...
...
@@ -402,12 +402,9 @@ static WINECRYPT_CERTSTORE *CRYPT_MemOpenStore(HCRYPTPROV hCryptProv,
return
(
WINECRYPT_CERTSTORE
*
)
store
;
}
static
const
WCHAR
rootW
[]
=
{
'R'
,
'o'
,
'o'
,
't'
,
0
};
static
WINECRYPT_CERTSTORE
*
CRYPT_SysRegOpenStoreW
(
HCRYPTPROV
hCryptProv
,
DWORD
dwFlags
,
const
void
*
pvPara
)
{
static
const
WCHAR
fmt
[]
=
{
'%'
,
's'
,
'\\'
,
'%'
,
's'
,
0
};
LPCWSTR
storeName
=
pvPara
;
LPWSTR
storePath
;
WINECRYPT_CERTSTORE
*
store
=
NULL
;
...
...
@@ -429,7 +426,7 @@ static WINECRYPT_CERTSTORE *CRYPT_SysRegOpenStoreW(HCRYPTPROV hCryptProv,
root
=
HKEY_LOCAL_MACHINE
;
base
=
CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH
;
/* If the HKLM\Root certs are requested, expressing system certs into the registry */
if
(
!
lstrcmpiW
(
storeName
,
rootW
))
if
(
!
lstrcmpiW
(
storeName
,
L"Root"
))
CRYPT_ImportSystemRootCertsToReg
();
break
;
case
CERT_SYSTEM_STORE_CURRENT_USER
:
...
...
@@ -482,7 +479,7 @@ static WINECRYPT_CERTSTORE *CRYPT_SysRegOpenStoreW(HCRYPTPROV hCryptProv,
REGSAM
sam
=
dwFlags
&
CERT_STORE_READONLY_FLAG
?
KEY_READ
:
KEY_ALL_ACCESS
;
wsprintfW
(
storePath
,
fmt
,
base
,
storeName
);
wsprintfW
(
storePath
,
L"%s
\\
%s"
,
base
,
storeName
);
if
(
dwFlags
&
CERT_STORE_OPEN_EXISTING_FLAG
)
rc
=
RegOpenKeyExW
(
root
,
storePath
,
0
,
sam
,
&
key
);
else
...
...
@@ -1352,7 +1349,7 @@ BOOL WINAPI CertEnumSystemStore(DWORD dwFlags, void *pvSystemStoreLocationPara,
*/
if
(
ret
&&
(
dwFlags
&
CERT_SYSTEM_STORE_LOCATION_MASK
)
==
CERT_SYSTEM_STORE_LOCAL_MACHINE
)
ret
=
pfnEnum
(
rootW
,
dwFlags
,
&
info
,
NULL
,
pvArg
);
ret
=
pfnEnum
(
L"Root"
,
dwFlags
,
&
info
,
NULL
,
pvArg
);
return
ret
;
}
...
...
dlls/crypt32/str.c
View file @
4120fb99
...
...
@@ -570,18 +570,13 @@ static DWORD CRYPT_AddPrefixW(LPCWSTR prefix, LPWSTR psz, DWORD csz)
return
chars
;
}
static
const
WCHAR
indent
[]
=
{
' '
,
' '
,
' '
,
' '
,
' '
,
0
}
;
static
const
WCHAR
indent
[]
=
L" "
;
DWORD
cert_name_to_str_with_indent
(
DWORD
dwCertEncodingType
,
DWORD
indentLevel
,
const
CERT_NAME_BLOB
*
pName
,
DWORD
dwStrType
,
LPWSTR
psz
,
DWORD
csz
)
{
static
const
DWORD
unsupportedFlags
=
CERT_NAME_STR_NO_QUOTING_FLAG
|
CERT_NAME_STR_ENABLE_T61_UNICODE_FLAG
;
static
const
WCHAR
commaSep
[]
=
{
','
,
' '
,
0
};
static
const
WCHAR
semiSep
[]
=
{
';'
,
' '
,
0
};
static
const
WCHAR
crlfSep
[]
=
{
'\r'
,
'\n'
,
0
};
static
const
WCHAR
plusSep
[]
=
{
' '
,
'+'
,
' '
,
0
};
static
const
WCHAR
spaceSep
[]
=
{
' '
,
0
};
DWORD
ret
=
0
,
bytes
=
0
;
BOOL
bRet
;
CERT_NAME_INFO
*
info
;
...
...
@@ -601,16 +596,16 @@ DWORD cert_name_to_str_with_indent(DWORD dwCertEncodingType, DWORD indentLevel,
if
(
reverse
&&
info
->
cRDN
>
1
)
rdn
+=
(
info
->
cRDN
-
1
);
if
(
dwStrType
&
CERT_NAME_STR_SEMICOLON_FLAG
)
sep
=
semiSep
;
sep
=
L"; "
;
else
if
(
dwStrType
&
CERT_NAME_STR_CRLF_FLAG
)
sep
=
crlfSep
;
sep
=
L"
\r\n
"
;
else
sep
=
commaSep
;
sep
=
L", "
;
sepLen
=
lstrlenW
(
sep
);
if
(
dwStrType
&
CERT_NAME_STR_NO_PLUS_FLAG
)
rdnSep
=
spaceSep
;
rdnSep
=
L" "
;
else
rdnSep
=
plusSep
;
rdnSep
=
L" + "
;
rdnSepLen
=
lstrlenW
(
rdnSep
);
for
(
i
=
0
;
(
!
psz
||
ret
<
csz
)
&&
i
<
info
->
cRDN
;
i
++
)
{
...
...
@@ -1069,25 +1064,20 @@ BOOL WINAPI CertStrToNameW(DWORD dwCertEncodingType, LPCWSTR pszX500,
}
else
{
static
const
WCHAR
commaSep
[]
=
{
','
,
0
};
static
const
WCHAR
semiSep
[]
=
{
';'
,
0
};
static
const
WCHAR
crlfSep
[]
=
{
'\r'
,
'\n'
,
0
};
static
const
WCHAR
allSepsWithoutPlus
[]
=
{
','
,
';'
,
'\r'
,
'\n'
,
0
};
static
const
WCHAR
allSeps
[]
=
{
'+'
,
','
,
';'
,
'\r'
,
'\n'
,
0
};
LPCWSTR
sep
;
WCHAR
sep_used
;
str
++
;
if
(
dwStrType
&
CERT_NAME_STR_COMMA_FLAG
)
sep
=
commaSep
;
sep
=
L","
;
else
if
(
dwStrType
&
CERT_NAME_STR_SEMICOLON_FLAG
)
sep
=
semiSep
;
sep
=
L";"
;
else
if
(
dwStrType
&
CERT_NAME_STR_CRLF_FLAG
)
sep
=
crlfSep
;
sep
=
L"
\r\n
"
;
else
if
(
dwStrType
&
CERT_NAME_STR_NO_PLUS_FLAG
)
sep
=
allSepsWithoutPlus
;
sep
=
L",;
\r\n
"
;
else
sep
=
allSeps
;
sep
=
L"+,;
\r\n
"
;
ret
=
CRYPT_GetNextValueW
(
str
,
dwStrType
,
sep
,
&
sep_used
,
&
token
,
ppszError
);
if
(
ret
)
...
...
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