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

Side by Side Diff: nss/lib/freebl/cts.c

Issue 1504923011: Update NSS to 3.21 RTM and NSPR to 4.11 RTM (Closed) Base URL: http://src.chromium.org/svn/trunk/deps/third_party/nss
Patch Set: Created 5 years 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
OLDNEW
1 /* This Source Code Form is subject to the terms of the Mozilla Public 1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 4
5 #ifdef FREEBL_NO_DEPEND 5 #ifdef FREEBL_NO_DEPEND
6 #include "stubs.h" 6 #include "stubs.h"
7 #endif 7 #endif
8 #include "blapit.h" 8 #include "blapit.h"
9 #include "blapii.h" 9 #include "blapii.h"
10 #include "cts.h" 10 #include "cts.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 const unsigned char *inbuf, unsigned int inlen, 178 const unsigned char *inbuf, unsigned int inlen,
179 unsigned int blocksize) 179 unsigned int blocksize)
180 { 180 {
181 unsigned char *Pn; 181 unsigned char *Pn;
182 unsigned char Cn_2[MAX_BLOCK_SIZE]; /* block Cn-2 */ 182 unsigned char Cn_2[MAX_BLOCK_SIZE]; /* block Cn-2 */
183 unsigned char Cn_1[MAX_BLOCK_SIZE]; /* block Cn-1 */ 183 unsigned char Cn_1[MAX_BLOCK_SIZE]; /* block Cn-1 */
184 unsigned char Cn[MAX_BLOCK_SIZE]; /* block Cn */ 184 unsigned char Cn[MAX_BLOCK_SIZE]; /* block Cn */
185 unsigned char lastBlock[MAX_BLOCK_SIZE]; 185 unsigned char lastBlock[MAX_BLOCK_SIZE];
186 const unsigned char *tmp; 186 const unsigned char *tmp;
187 unsigned int tmpLen; 187 unsigned int tmpLen;
188 int fullblocks, pad; 188 unsigned int fullblocks, pad;
189 unsigned int i; 189 unsigned int i;
190 SECStatus rv; 190 SECStatus rv;
191 191
192 if (inlen < blocksize) { 192 if (inlen < blocksize) {
193 PORT_SetError(SEC_ERROR_INPUT_LEN); 193 PORT_SetError(SEC_ERROR_INPUT_LEN);
194 return SECFailure; 194 return SECFailure;
195 } 195 }
196 196
197 if (maxout < inlen) { 197 if (maxout < inlen) {
198 *outlen = inlen; 198 *outlen = inlen;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 * only the side effect of setting the internal IV */ 292 * only the side effect of setting the internal IV */
293 (void) (*cts->cipher)(cts->context, lastBlock, &tmpLen, blocksize, Cn, 293 (void) (*cts->cipher)(cts->context, lastBlock, &tmpLen, blocksize, Cn,
294 blocksize, blocksize); 294 blocksize, blocksize);
295 /* clear last block. At this point last block contains Pn xor Cn_1 xor 295 /* clear last block. At this point last block contains Pn xor Cn_1 xor
296 * Cn_2, both of with an attacker would know, so we need to clear this 296 * Cn_2, both of with an attacker would know, so we need to clear this
297 * buffer out */ 297 * buffer out */
298 PORT_Memset(lastBlock, 0, blocksize); 298 PORT_Memset(lastBlock, 0, blocksize);
299 /* Cn, Cn_1, and Cn_2 have encrypted data, so no need to clear them */ 299 /* Cn, Cn_1, and Cn_2 have encrypted data, so no need to clear them */
300 return SECSuccess; 300 return SECSuccess;
301 } 301 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698