OLD | NEW |
1 /* | 1 /* |
2 * aeskeywrap.c - implement AES Key Wrap algorithm from RFC 3394 | 2 * aeskeywrap.c - implement AES Key Wrap algorithm from RFC 3394 |
3 * | 3 * |
4 * This Source Code Form is subject to the terms of the Mozilla Public | 4 * This Source Code Form is subject to the terms of the Mozilla Public |
5 * License, v. 2.0. If a copy of the MPL was not distributed with this | 5 * License, v. 2.0. If a copy of the MPL was not distributed with this |
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
7 | 7 |
8 #ifdef FREEBL_NO_DEPEND | 8 #ifdef FREEBL_NO_DEPEND |
9 #include "stubs.h" | 9 #include "stubs.h" |
10 #endif | 10 #endif |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 /* | 362 /* |
363 ** 3) Output the results. | 363 ** 3) Output the results. |
364 */ | 364 */ |
365 if (s == SECSuccess) { | 365 if (s == SECSuccess) { |
366 int bad = memcmp(&A, cx->iv, AES_KEY_WRAP_IV_BYTES); | 366 int bad = memcmp(&A, cx->iv, AES_KEY_WRAP_IV_BYTES); |
367 if (!bad) { | 367 if (!bad) { |
368 memcpy(output, &R[1], outLen); | 368 memcpy(output, &R[1], outLen); |
369 if (pOutputLen) | 369 if (pOutputLen) |
370 *pOutputLen = outLen; | 370 *pOutputLen = outLen; |
371 } else { | 371 } else { |
| 372 s = SECFailure; |
372 PORT_SetError(SEC_ERROR_BAD_DATA); | 373 PORT_SetError(SEC_ERROR_BAD_DATA); |
373 if (pOutputLen) | 374 if (pOutputLen) |
374 *pOutputLen = 0; | 375 *pOutputLen = 0; |
375 } | 376 } |
376 } else if (pOutputLen) { | 377 } else if (pOutputLen) { |
377 *pOutputLen = 0; | 378 *pOutputLen = 0; |
378 } | 379 } |
379 PORT_ZFree(R, inputLen); | 380 PORT_ZFree(R, inputLen); |
380 return s; | 381 return s; |
381 } | 382 } |
382 #undef A | 383 #undef A |
OLD | NEW |