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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 goto done; | 252 goto done; |
253 } | 253 } |
254 if (hashLen != hashItem.len) { | 254 if (hashLen != hashItem.len) { |
255 ssl_MapLowLevelError(SSL_ERROR_SIGN_HASHES_FAILURE); | 255 ssl_MapLowLevelError(SSL_ERROR_SIGN_HASHES_FAILURE); |
256 goto done; | 256 goto done; |
257 } | 257 } |
258 if (!CryptSetHashParam(hHash, HP_HASHVAL, (BYTE*)hashItem.data, 0)) { | 258 if (!CryptSetHashParam(hHash, HP_HASHVAL, (BYTE*)hashItem.data, 0)) { |
259 ssl_MapLowLevelError(SSL_ERROR_SIGN_HASHES_FAILURE); | 259 ssl_MapLowLevelError(SSL_ERROR_SIGN_HASHES_FAILURE); |
260 goto done; | 260 goto done; |
261 } | 261 } |
262 if (!CryptSignHash(hHash, key->dwKeySpec, NULL, CRYPT_NOHASHOID, | 262 if (!CryptSignHash(hHash, key->dwKeySpec, NULL, 0, |
263 NULL, &signatureLen) || signatureLen == 0) { | 263 NULL, &signatureLen) || signatureLen == 0) { |
264 ssl_MapLowLevelError(SSL_ERROR_SIGN_HASHES_FAILURE); | 264 ssl_MapLowLevelError(SSL_ERROR_SIGN_HASHES_FAILURE); |
265 goto done; | 265 goto done; |
266 } | 266 } |
267 buf->data = (unsigned char *)PORT_Alloc(signatureLen); | 267 buf->data = (unsigned char *)PORT_Alloc(signatureLen); |
268 if (!buf->data) | 268 if (!buf->data) |
269 goto done; /* error code was set. */ | 269 goto done; /* error code was set. */ |
270 | 270 |
271 if (!CryptSignHash(hHash, key->dwKeySpec, NULL, CRYPT_NOHASHOID, | 271 if (!CryptSignHash(hHash, key->dwKeySpec, NULL, 0, |
272 (BYTE*)buf->data, &signatureLen)) { | 272 (BYTE*)buf->data, &signatureLen)) { |
273 ssl_MapLowLevelError(SSL_ERROR_SIGN_HASHES_FAILURE); | 273 ssl_MapLowLevelError(SSL_ERROR_SIGN_HASHES_FAILURE); |
274 goto done; | 274 goto done; |
275 } | 275 } |
276 buf->len = signatureLen; | 276 buf->len = signatureLen; |
277 | 277 |
278 /* CryptoAPI signs in little-endian, so reverse */ | 278 /* CryptoAPI signs in little-endian, so reverse */ |
279 for (i = 0; i < buf->len / 2; ++i) { | 279 for (i = 0; i < buf->len / 2; ++i) { |
280 unsigned char tmp = buf->data[i]; | 280 unsigned char tmp = buf->data[i]; |
281 buf->data[i] = buf->data[buf->len - 1 - i]; | 281 buf->data[i] = buf->data[buf->len - 1 - i]; |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 SECStatus | 556 SECStatus |
557 ssl3_PlatformSignHashes(SSL3Hashes *hash, PlatformKey key, SECItem *buf, | 557 ssl3_PlatformSignHashes(SSL3Hashes *hash, PlatformKey key, SECItem *buf, |
558 PRBool isTLS) | 558 PRBool isTLS) |
559 { | 559 { |
560 PORT_SetError(PR_NOT_IMPLEMENTED_ERROR); | 560 PORT_SetError(PR_NOT_IMPLEMENTED_ERROR); |
561 return SECFailure; | 561 return SECFailure; |
562 } | 562 } |
563 #endif | 563 #endif |
564 | 564 |
565 #endif /* NSS_PLATFORM_CLIENT_AUTH */ | 565 #endif /* NSS_PLATFORM_CLIENT_AUTH */ |
OLD | NEW |