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

Side by Side Diff: nss/lib/softoken/padbuf.c

Issue 16132005: Allow NSS to be built with NO_NSPR_10_SUPPORT. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/nss/
Patch Set: Created 7 years, 6 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 | « nss/lib/softoken/lowpbe.c ('k') | nss/lib/softoken/pkcs11c.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 #include "blapit.h" 4 #include "blapit.h"
5 #include "secport.h" 5 #include "secport.h"
6 #include "secerr.h" 6 #include "secerr.h"
7 7
8 /* 8 /*
9 * Prepare a buffer for any padded CBC encryption algorithm, growing to the 9 * Prepare a buffer for any padded CBC encryption algorithm, growing to the
10 * appropriate boundary and filling with the appropriate padding. 10 * appropriate boundary and filling with the appropriate padding.
11 * blockSize must be a power of 2. 11 * blockSize must be a power of 2.
12 * 12 *
13 * NOTE: If arena is non-NULL, we re-allocate from there, otherwise 13 * NOTE: If arena is non-NULL, we re-allocate from there, otherwise
14 * we assume (and use) XP memory (re)allocation. 14 * we assume (and use) XP memory (re)allocation.
15 */ 15 */
16 unsigned char * 16 unsigned char *
17 CBC_PadBuffer(PRArenaPool *arena, unsigned char *inbuf, unsigned int inlen, 17 CBC_PadBuffer(PLArenaPool *arena, unsigned char *inbuf, unsigned int inlen,
18 unsigned int *outlen, int blockSize) 18 unsigned int *outlen, int blockSize)
19 { 19 {
20 unsigned char *outbuf; 20 unsigned char *outbuf;
21 unsigned int des_len; 21 unsigned int des_len;
22 unsigned int i; 22 unsigned int i;
23 unsigned char des_pad_len; 23 unsigned char des_pad_len;
24 24
25 /* 25 /*
26 * We need from 1 to blockSize bytes -- we *always* grow. 26 * We need from 1 to blockSize bytes -- we *always* grow.
27 * The extra bytes contain the value of the length of the padding: 27 * The extra bytes contain the value of the length of the padding:
(...skipping 12 matching lines...) Expand all
40 return NULL; 40 return NULL;
41 } 41 }
42 42
43 des_pad_len = des_len - inlen; 43 des_pad_len = des_len - inlen;
44 for (i = inlen; i < des_len; i++) 44 for (i = inlen; i < des_len; i++)
45 outbuf[i] = des_pad_len; 45 outbuf[i] = des_pad_len;
46 46
47 *outlen = des_len; 47 *outlen = des_len;
48 return outbuf; 48 return outbuf;
49 } 49 }
OLDNEW
« no previous file with comments | « nss/lib/softoken/lowpbe.c ('k') | nss/lib/softoken/pkcs11c.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698