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

Side by Side Diff: nss/lib/util/dersubr.c

Issue 13898013: Update NSS to NSS_3_15_BETA2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/nss/
Patch Set: Update NSS versions and tag in README.chromium Created 7 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 | 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 #include "secder.h" 5 #include "secder.h"
6 #include <limits.h> 6 #include <limits.h>
7 #include "secerr.h" 7 #include "secerr.h"
8 8
9 int 9 int
10 DER_LengthLength(PRUint32 len) 10 DER_LengthLength(PRUint32 len)
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 PORT_Memcpy(it->data, bb + (sizeof(bb) - len), len); 169 PORT_Memcpy(it->data, bb + (sizeof(bb) - len), len);
170 170
171 return SECSuccess; 171 return SECSuccess;
172 } 172 }
173 173
174 /* 174 /*
175 ** Convert a der encoded *signed* integer into a machine integral value. 175 ** Convert a der encoded *signed* integer into a machine integral value.
176 ** If an underflow/overflow occurs, sets error code and returns min/max. 176 ** If an underflow/overflow occurs, sets error code and returns min/max.
177 */ 177 */
178 long 178 long
179 DER_GetInteger(SECItem *it) 179 DER_GetInteger(const SECItem *it)
180 { 180 {
181 long ival = 0; 181 long ival = 0;
182 unsigned len = it->len; 182 unsigned len = it->len;
183 unsigned char *cp = it->data; 183 unsigned char *cp = it->data;
184 unsigned long overflow = 0x1ffUL << (((sizeof(ival) - 1) * 8) - 1); 184 unsigned long overflow = 0x1ffUL << (((sizeof(ival) - 1) * 8) - 1);
185 unsigned long ofloinit; 185 unsigned long ofloinit;
186 186
187 PORT_Assert(len); 187 PORT_Assert(len);
188 if (!len) { 188 if (!len) {
189 PORT_SetError(SEC_ERROR_INPUT_LEN); 189 PORT_SetError(SEC_ERROR_INPUT_LEN);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 if (ival & overflow) { 237 if (ival & overflow) {
238 PORT_SetError(SEC_ERROR_BAD_DER); 238 PORT_SetError(SEC_ERROR_BAD_DER);
239 return ULONG_MAX; 239 return ULONG_MAX;
240 } 240 }
241 ival = ival << 8; 241 ival = ival << 8;
242 ival |= *cp++; 242 ival |= *cp++;
243 --len; 243 --len;
244 } 244 }
245 return ival; 245 return ival;
246 } 246 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698