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

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

Issue 1017413002: Uprev NSS to 3.18 RTM (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/nss.git@nspr_uprev
Patch Set: Rebased Created 5 years, 8 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
« no previous file with comments | « nss/lib/cryptohi/secsign.c ('k') | nss/lib/freebl/ec.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 /* 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 if (rv != SECSuccess) { 232 if (rv != SECSuccess) {
233 return SECFailure; 233 return SECFailure;
234 } 234 }
235 *outlen = fullblocks; /* AES low level doesn't set outlen */ 235 *outlen = fullblocks; /* AES low level doesn't set outlen */
236 inbuf += fullblocks; 236 inbuf += fullblocks;
237 inlen -= fullblocks; 237 inlen -= fullblocks;
238 if (inlen == 0) { 238 if (inlen == 0) {
239 return SECSuccess; 239 return SECSuccess;
240 } 240 }
241 outbuf += fullblocks; 241 outbuf += fullblocks;
242 maxout -= fullblocks;
243 242
244 /* recover the stolen text */ 243 /* recover the stolen text */
245 PORT_Memset(lastBlock, 0, blocksize); 244 PORT_Memset(lastBlock, 0, blocksize);
246 PORT_Memcpy(lastBlock, inbuf, inlen); 245 PORT_Memcpy(lastBlock, inbuf, inlen);
247 PORT_Memcpy(Cn_1, inbuf, inlen); 246 PORT_Memcpy(Cn_1, inbuf, inlen);
248 Pn = outbuf-blocksize; 247 Pn = outbuf-blocksize;
249 /* inbuf points to Cn-1* in the input buffer */ 248 /* inbuf points to Cn-1* in the input buffer */
250 /* NOTE: below there are 2 sections marked "make up for the out of order 249 /* NOTE: below there are 2 sections marked "make up for the out of order
251 * cbc decryption". You may ask, what is going on here. 250 * cbc decryption". You may ask, what is going on here.
252 * Short answer: CBC automatically xors the plain text with the previous 251 * Short answer: CBC automatically xors the plain text with the previous
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 * only the side effect of setting the internal IV */ 292 * only the side effect of setting the internal IV */
294 (void) (*cts->cipher)(cts->context, lastBlock, &tmpLen, blocksize, Cn, 293 (void) (*cts->cipher)(cts->context, lastBlock, &tmpLen, blocksize, Cn,
295 blocksize, blocksize); 294 blocksize, blocksize);
296 /* 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
297 * 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
298 * buffer out */ 297 * buffer out */
299 PORT_Memset(lastBlock, 0, blocksize); 298 PORT_Memset(lastBlock, 0, blocksize);
300 /* 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 */
301 return SECSuccess; 300 return SECSuccess;
302 } 301 }
OLDNEW
« no previous file with comments | « nss/lib/cryptohi/secsign.c ('k') | nss/lib/freebl/ec.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698