OLD | NEW |
1 /* ***** BEGIN LICENSE BLOCK ***** | 1 /* ***** BEGIN LICENSE BLOCK ***** |
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
3 * | 3 * |
4 * The contents of this file are subject to the Mozilla Public License Version | 4 * The contents of this file are subject to the Mozilla Public License Version |
5 * 1.1 (the "License"); you may not use this file except in compliance with | 5 * 1.1 (the "License"); you may not use this file except in compliance with |
6 * the License. You may obtain a copy of the License at | 6 * the License. You may obtain a copy of the License at |
7 * http://www.mozilla.org/MPL/ | 7 * http://www.mozilla.org/MPL/ |
8 * | 8 * |
9 * Software distributed under the License is distributed on an "AS IS" basis, | 9 * Software distributed under the License is distributed on an "AS IS" basis, |
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
(...skipping 23 matching lines...) Expand all Loading... |
34 * | 34 * |
35 * ***** END LICENSE BLOCK ***** */ | 35 * ***** END LICENSE BLOCK ***** */ |
36 | 36 |
37 /* | 37 /* |
38 * secport.c - portability interfaces for security libraries | 38 * secport.c - portability interfaces for security libraries |
39 * | 39 * |
40 * This file abstracts out libc functionality that libsec depends on | 40 * This file abstracts out libc functionality that libsec depends on |
41 * | 41 * |
42 * NOTE - These are not public interfaces | 42 * NOTE - These are not public interfaces |
43 * | 43 * |
44 * $Id: secport.c,v 1.28 2010/01/22 02:34:30 wtc%google.com Exp $ | 44 * $Id: secport.c,v 1.29 2010/03/28 20:46:37 nelson%bolyard.com Exp $ |
45 */ | 45 */ |
46 | 46 |
47 #include "seccomon.h" | 47 #include "seccomon.h" |
48 #include "prmem.h" | 48 #include "prmem.h" |
49 #include "prerror.h" | 49 #include "prerror.h" |
50 #include "plarena.h" | 50 #include "plarena.h" |
51 #include "secerr.h" | 51 #include "secerr.h" |
52 #include "prmon.h" | 52 #include "prmon.h" |
53 #include "nssilock.h" | 53 #include "nssilock.h" |
54 #include "secport.h" | 54 #include "secport.h" |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 len = sizeof *pool; | 337 len = sizeof *pool; |
338 lock = pool->lock; | 338 lock = pool->lock; |
339 PZ_Lock(lock); | 339 PZ_Lock(lock); |
340 } | 340 } |
341 if (!checkedEnv) { | 341 if (!checkedEnv) { |
342 /* no need for thread protection here */ | 342 /* no need for thread protection here */ |
343 doFreeArenaPool = (PR_GetEnv("NSS_DISABLE_ARENA_FREE_LIST") == NULL); | 343 doFreeArenaPool = (PR_GetEnv("NSS_DISABLE_ARENA_FREE_LIST") == NULL); |
344 checkedEnv = PR_TRUE; | 344 checkedEnv = PR_TRUE; |
345 } | 345 } |
346 if (zero) { | 346 if (zero) { |
347 » PLArena *a; | 347 » PL_ClearArenaPool(arena, 0); |
348 » for (a = arena->first.next; a; a = a->next) { | |
349 » PR_ASSERT(a->base <= a->avail && a->avail <= a->limit); | |
350 » memset((void *)a->base, 0, a->avail - a->base); | |
351 » } | |
352 } | 348 } |
353 if (doFreeArenaPool) { | 349 if (doFreeArenaPool) { |
354 PL_FreeArenaPool(arena); | 350 PL_FreeArenaPool(arena); |
355 } else { | 351 } else { |
356 PL_FinishArenaPool(arena); | 352 PL_FinishArenaPool(arena); |
357 } | 353 } |
358 PORT_ZFree(arena, len); | 354 PORT_ZFree(arena, len); |
359 if (lock) { | 355 if (lock) { |
360 PZ_Unlock(lock); | 356 PZ_Unlock(lock); |
361 PZ_DestroyLock(lock); | 357 PZ_DestroyLock(lock); |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 const unsigned char *b = (const unsigned char*) ib; | 707 const unsigned char *b = (const unsigned char*) ib; |
712 size_t i; | 708 size_t i; |
713 unsigned char r = 0; | 709 unsigned char r = 0; |
714 | 710 |
715 for (i = 0; i < n; ++i) { | 711 for (i = 0; i < n; ++i) { |
716 r |= *a++ ^ *b++; | 712 r |= *a++ ^ *b++; |
717 } | 713 } |
718 | 714 |
719 return r; | 715 return r; |
720 } | 716 } |
OLD | NEW |