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

Side by Side Diff: mozilla/security/nss/lib/freebl/desblapi.c

Issue 12197027: Merge NSS_3_14_2_RTM. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/nss/
Patch Set: Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « mozilla/security/nss/lib/freebl/arcfour.c ('k') | mozilla/security/nss/lib/freebl/drbg.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * desblapi.c 2 * desblapi.c
3 * 3 *
4 * core source file for DES-150 library 4 * core source file for DES-150 library
5 * Implement DES Modes of Operation and Triple-DES. 5 * Implement DES Modes of Operation and Triple-DES.
6 * Adapt DES-150 to blapi API. 6 * Adapt DES-150 to blapi API.
7 * 7 *
8 * This Source Code Form is subject to the terms of the Mozilla Public 8 * This Source Code Form is subject to the terms of the Mozilla Public
9 * License, v. 2.0. If a copy of the MPL was not distributed with this 9 * License, v. 2.0. If a copy of the MPL was not distributed with this
10 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 10 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 if (freeit) 236 if (freeit)
237 PORT_Free(cx); 237 PORT_Free(cx);
238 } 238 }
239 } 239 }
240 240
241 SECStatus 241 SECStatus
242 DES_Encrypt(DESContext *cx, BYTE *out, unsigned int *outLen, 242 DES_Encrypt(DESContext *cx, BYTE *out, unsigned int *outLen,
243 unsigned int maxOutLen, const BYTE *in, unsigned int inLen) 243 unsigned int maxOutLen, const BYTE *in, unsigned int inLen)
244 { 244 {
245 245
246 if (inLen < 0 || (inLen % 8) != 0 || maxOutLen < inLen || !cx || 246 if ((inLen % 8) != 0 || maxOutLen < inLen || !cx ||
247 cx->direction != DES_ENCRYPT) { 247 cx->direction != DES_ENCRYPT) {
248 PORT_SetError(SEC_ERROR_INVALID_ARGS); 248 PORT_SetError(SEC_ERROR_INVALID_ARGS);
249 return SECFailure; 249 return SECFailure;
250 } 250 }
251 251
252 cx->worker(cx, out, in, inLen); 252 cx->worker(cx, out, in, inLen);
253 if (outLen) 253 if (outLen)
254 *outLen = inLen; 254 *outLen = inLen;
255 return SECSuccess; 255 return SECSuccess;
256 } 256 }
257 257
258 SECStatus 258 SECStatus
259 DES_Decrypt(DESContext *cx, BYTE *out, unsigned int *outLen, 259 DES_Decrypt(DESContext *cx, BYTE *out, unsigned int *outLen,
260 unsigned int maxOutLen, const BYTE *in, unsigned int inLen) 260 unsigned int maxOutLen, const BYTE *in, unsigned int inLen)
261 { 261 {
262 262
263 if (inLen < 0 || (inLen % 8) != 0 || maxOutLen < inLen || !cx || 263 if ((inLen % 8) != 0 || maxOutLen < inLen || !cx ||
264 cx->direction != DES_DECRYPT) { 264 cx->direction != DES_DECRYPT) {
265 PORT_SetError(SEC_ERROR_INVALID_ARGS); 265 PORT_SetError(SEC_ERROR_INVALID_ARGS);
266 return SECFailure; 266 return SECFailure;
267 } 267 }
268 268
269 cx->worker(cx, out, in, inLen); 269 cx->worker(cx, out, in, inLen);
270 if (outLen) 270 if (outLen)
271 *outLen = inLen; 271 *outLen = inLen;
272 return SECSuccess; 272 return SECSuccess;
273 } 273 }
OLDNEW
« no previous file with comments | « mozilla/security/nss/lib/freebl/arcfour.c ('k') | mozilla/security/nss/lib/freebl/drbg.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698