Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
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
Aleksandr Isakov
wine-fonts
Commits
d8da3e83
Commit
d8da3e83
authored
Aug 08, 2008
by
Juan Lang
Committed by
Alexandre Julliard
Aug 19, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Implement CryptHashToBeSigned.
parent
b18919be
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
7 deletions
+38
-7
cert.c
dlls/crypt32/cert.c
+38
-2
cert.c
dlls/crypt32/tests/cert.c
+0
-5
No files found.
dlls/crypt32/cert.c
View file @
d8da3e83
...
...
@@ -1534,9 +1534,45 @@ BOOL WINAPI CryptHashToBeSigned(HCRYPTPROV_LEGACY hCryptProv,
DWORD
dwCertEncodingType
,
const
BYTE
*
pbEncoded
,
DWORD
cbEncoded
,
BYTE
*
pbComputedHash
,
DWORD
*
pcbComputedHash
)
{
FIXME
(
"(%08lx, %08x, %p, %d, %p, %d): stub
\n
"
,
hCryptProv
,
dwCertEncodingType
,
BOOL
ret
;
CERT_SIGNED_CONTENT_INFO
*
info
;
DWORD
size
;
TRACE
(
"(%08lx, %08x, %p, %d, %p, %d)
\n
"
,
hCryptProv
,
dwCertEncodingType
,
pbEncoded
,
cbEncoded
,
pbComputedHash
,
*
pcbComputedHash
);
return
FALSE
;
ret
=
CryptDecodeObjectEx
(
dwCertEncodingType
,
X509_CERT
,
pbEncoded
,
cbEncoded
,
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
(
void
*
)
&
info
,
&
size
);
if
(
ret
)
{
PCCRYPT_OID_INFO
oidInfo
;
HCRYPTHASH
hHash
;
if
(
!
hCryptProv
)
hCryptProv
=
CRYPT_GetDefaultProvider
();
oidInfo
=
CryptFindOIDInfo
(
CRYPT_OID_INFO_OID_KEY
,
info
->
SignatureAlgorithm
.
pszObjId
,
0
);
if
(
!
oidInfo
)
{
SetLastError
(
NTE_BAD_ALGID
);
ret
=
FALSE
;
}
else
{
ret
=
CryptCreateHash
(
hCryptProv
,
oidInfo
->
u
.
Algid
,
0
,
0
,
&
hHash
);
if
(
ret
)
{
ret
=
CryptHashData
(
hHash
,
info
->
ToBeSigned
.
pbData
,
info
->
ToBeSigned
.
cbData
,
0
);
if
(
ret
)
ret
=
CryptGetHashParam
(
hHash
,
HP_HASHVAL
,
pbComputedHash
,
pcbComputedHash
,
0
);
CryptDestroyHash
(
hHash
);
}
}
LocalFree
(
info
);
}
return
ret
;
}
BOOL
WINAPI
CryptSignCertificate
(
HCRYPTPROV_OR_NCRYPT_KEY_HANDLE
hCryptProv
,
...
...
dlls/crypt32/tests/cert.c
View file @
d8da3e83
...
...
@@ -2575,33 +2575,28 @@ static void testHashToBeSigned(void)
"expected ERROR_FILE_NOT_FOUND, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
CryptHashToBeSigned
(
0
,
X509_ASN_ENCODING
,
NULL
,
0
,
NULL
,
&
size
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_ASN1_EOD
,
"expected CRYPT_E_ASN1_EOD, got %08x
\n
"
,
GetLastError
());
/* Can't sign anything: has to be asn.1 encoded, at least */
SetLastError
(
0xdeadbeef
);
ret
=
CryptHashToBeSigned
(
0
,
X509_ASN_ENCODING
,
int1
,
sizeof
(
int1
),
NULL
,
&
size
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_ASN1_BADTAG
,
"expected CRYPT_E_ASN1_BADTAG, got %08x
\n
"
,
GetLastError
());
/* Can't be empty, either */
SetLastError
(
0xdeadbeef
);
ret
=
CryptHashToBeSigned
(
0
,
X509_ASN_ENCODING
,
emptyCert
,
sizeof
(
emptyCert
),
NULL
,
&
size
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_ASN1_CORRUPT
,
"expected CRYPT_E_ASN1_CORRUPT, got %08x
\n
"
,
GetLastError
());
/* Signing a cert works */
ret
=
CryptHashToBeSigned
(
0
,
X509_ASN_ENCODING
,
md5SignedEmptyCert
,
sizeof
(
md5SignedEmptyCert
),
NULL
,
&
size
);
todo_wine
{
ok
(
ret
,
"CryptHashToBeSigned failed: %08x
\n
"
,
GetLastError
());
ok
(
size
==
sizeof
(
md5SignedEmptyCertHash
),
"unexpected size %d
\n
"
,
size
);
ret
=
CryptHashToBeSigned
(
0
,
X509_ASN_ENCODING
,
md5SignedEmptyCert
,
sizeof
(
md5SignedEmptyCert
),
hash
,
&
size
);
ok
(
!
memcmp
(
hash
,
md5SignedEmptyCertHash
,
size
),
"unexpected value
\n
"
);
}
}
static
void
testCompareCert
(
void
)
...
...
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