Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1890)

Unified Diff: net/third_party/nss/ssl/sslplatf.c

Issue 13843023: Use CERT_GetCertKeyType to get KeyType for ssl3_PlatformSignHashes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« net/third_party/nss/ssl/ssl3con.c ('K') | « net/third_party/nss/ssl/sslimpl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/third_party/nss/ssl/sslplatf.c
diff --git a/net/third_party/nss/ssl/sslplatf.c b/net/third_party/nss/ssl/sslplatf.c
index 208956f8912a4664dec112bf1b5b98c57844cc2f..ca568a723c4f734840c5522aa75134fff146b780 100644
--- a/net/third_party/nss/ssl/sslplatf.c
+++ b/net/third_party/nss/ssl/sslplatf.c
@@ -111,14 +111,12 @@ ssl_FreePlatformKey(PlatformKey key)
SECStatus
ssl3_PlatformSignHashes(SSL3Hashes *hash, PlatformKey key, SECItem *buf,
- PRBool isTLS)
+ PRBool isTLS, KeyType keyType)
{
SECStatus rv = SECFailure;
PRBool doDerEncode = PR_FALSE;
SECItem hashItem;
- HCRYPTKEY hKey = 0;
DWORD argLen = 0;
- ALG_ID keyAlg = 0;
DWORD signatureLen = 0;
ALG_ID hashAlg = 0;
HCRYPTHASH hHash = 0;
@@ -126,31 +124,16 @@ ssl3_PlatformSignHashes(SSL3Hashes *hash, PlatformKey key, SECItem *buf,
unsigned int i = 0;
buf->data = NULL;
- if (!CryptGetUserKey(key->hCryptProv, key->dwKeySpec, &hKey)) {
- if (GetLastError() == NTE_NO_KEY) {
- PORT_SetError(SEC_ERROR_NO_KEY);
- } else {
- PORT_SetError(SEC_ERROR_INVALID_KEY);
- }
- goto done;
- }
-
- argLen = sizeof(keyAlg);
- if (!CryptGetKeyParam(hKey, KP_ALGID, (BYTE*)&keyAlg, &argLen, 0)) {
- PORT_SetError(SEC_ERROR_INVALID_KEY);
- goto done;
- }
- switch (keyAlg) {
- case CALG_RSA_KEYX:
- case CALG_RSA_SIGN:
+ switch (keyType) {
+ case rsaKey:
hashAlg = CALG_SSL3_SHAMD5;
hashItem.data = hash->md5;
hashItem.len = sizeof(SSL3Hashes);
break;
- case CALG_DSS_SIGN:
- case CALG_ECDSA:
- if (keyAlg == CALG_ECDSA) {
+ case dsaKey:
+ case ecKey:
+ if (keyType == ecKey) {
doDerEncode = PR_TRUE;
} else {
doDerEncode = isTLS;
@@ -223,8 +206,6 @@ ssl3_PlatformSignHashes(SSL3Hashes *hash, PlatformKey key, SECItem *buf,
done:
if (hHash)
CryptDestroyHash(hHash);
- if (hKey)
- CryptDestroyKey(hKey);
if (rv != SECSuccess && buf->data) {
PORT_Free(buf->data);
buf->data = NULL;
@@ -243,7 +224,7 @@ ssl_FreePlatformKey(PlatformKey key)
SECStatus
ssl3_PlatformSignHashes(SSL3Hashes *hash, PlatformKey key, SECItem *buf,
- PRBool isTLS)
+ PRBool isTLS, KeyType keyType)
{
SECStatus rv = SECFailure;
PRBool doDerEncode = PR_FALSE;
@@ -389,7 +370,7 @@ ssl_FreePlatformKey(PlatformKey key)
SECStatus
ssl3_PlatformSignHashes(SSL3Hashes *hash, PlatformKey key, SECItem *buf,
- PRBool isTLS)
+ PRBool isTLS, KeyType keyType)
{
PORT_SetError(PR_NOT_IMPLEMENTED_ERROR);
return SECFailure;
« net/third_party/nss/ssl/ssl3con.c ('K') | « net/third_party/nss/ssl/sslimpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698