OLD | NEW |
1 /* | 1 /* |
2 * Platform specific crypto wrappers | 2 * Platform specific crypto wrappers |
3 * | 3 * |
4 * ***** BEGIN LICENSE BLOCK ***** | 4 * ***** BEGIN LICENSE BLOCK ***** |
5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
6 * | 6 * |
7 * The contents of this file are subject to the Mozilla Public License Version | 7 * The contents of this file are subject to the Mozilla Public License Version |
8 * 1.1 (the "License"); you may not use this file except in compliance with | 8 * 1.1 (the "License"); you may not use this file except in compliance with |
9 * the License. You may obtain a copy of the License at | 9 * the License. You may obtain a copy of the License at |
10 * http://www.mozilla.org/MPL/ | 10 * http://www.mozilla.org/MPL/ |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 goto done; | 256 goto done; |
257 } | 257 } |
258 if (hashLen != hashItem.len) { | 258 if (hashLen != hashItem.len) { |
259 PORT_SetError(SSL_ERROR_SIGN_HASHES_FAILURE); | 259 PORT_SetError(SSL_ERROR_SIGN_HASHES_FAILURE); |
260 goto done; | 260 goto done; |
261 } | 261 } |
262 if (!CryptSetHashParam(hHash, HP_HASHVAL, (BYTE*)hashItem.data, 0)) { | 262 if (!CryptSetHashParam(hHash, HP_HASHVAL, (BYTE*)hashItem.data, 0)) { |
263 PORT_SetError(SSL_ERROR_SIGN_HASHES_FAILURE); | 263 PORT_SetError(SSL_ERROR_SIGN_HASHES_FAILURE); |
264 goto done; | 264 goto done; |
265 } | 265 } |
266 if (!CryptSignHash(hHash, key->dwKeySpec, NULL, CRYPT_NOHASHOID, | 266 if (!CryptSignHash(hHash, key->dwKeySpec, NULL, 0, |
267 NULL, &signatureLen) || signatureLen == 0) { | 267 NULL, &signatureLen) || signatureLen == 0) { |
268 PORT_SetError(SSL_ERROR_SIGN_HASHES_FAILURE); | 268 PORT_SetError(SSL_ERROR_SIGN_HASHES_FAILURE); |
269 goto done; | 269 goto done; |
270 } | 270 } |
271 buf->data = (unsigned char *)PORT_Alloc(signatureLen); | 271 buf->data = (unsigned char *)PORT_Alloc(signatureLen); |
272 if (!buf->data) | 272 if (!buf->data) |
273 goto done; /* error code was set. */ | 273 goto done; /* error code was set. */ |
274 | 274 |
275 if (!CryptSignHash(hHash, key->dwKeySpec, NULL, CRYPT_NOHASHOID, | 275 if (!CryptSignHash(hHash, key->dwKeySpec, NULL, 0, |
276 (BYTE*)buf->data, &signatureLen)) { | 276 (BYTE*)buf->data, &signatureLen)) { |
277 PORT_SetError(SSL_ERROR_SIGN_HASHES_FAILURE); | 277 PORT_SetError(SSL_ERROR_SIGN_HASHES_FAILURE); |
278 goto done; | 278 goto done; |
279 } | 279 } |
280 buf->len = signatureLen; | 280 buf->len = signatureLen; |
281 | 281 |
282 /* CryptoAPI signs in little-endian, so reverse */ | 282 /* CryptoAPI signs in little-endian, so reverse */ |
283 for (i = 0; i < buf->len / 2; ++i) { | 283 for (i = 0; i < buf->len / 2; ++i) { |
284 unsigned char tmp = buf->data[i]; | 284 unsigned char tmp = buf->data[i]; |
285 buf->data[i] = buf->data[buf->len - 1 - i]; | 285 buf->data[i] = buf->data[buf->len - 1 - i]; |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 SECStatus | 562 SECStatus |
563 ssl3_PlatformSignHashes(SSL3Hashes *hash, PlatformKey key, SECItem *buf, | 563 ssl3_PlatformSignHashes(SSL3Hashes *hash, PlatformKey key, SECItem *buf, |
564 PRBool isTLS) | 564 PRBool isTLS) |
565 { | 565 { |
566 PORT_SetError(PR_NOT_IMPLEMENTED_ERROR); | 566 PORT_SetError(PR_NOT_IMPLEMENTED_ERROR); |
567 return SECFailure; | 567 return SECFailure; |
568 } | 568 } |
569 #endif | 569 #endif |
570 | 570 |
571 #endif /* NSS_PLATFORM_CLIENT_AUTH */ | 571 #endif /* NSS_PLATFORM_CLIENT_AUTH */ |
OLD | NEW |