| OLD | NEW |
| 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 /* $Id: drbg.c,v 1.11 2012/06/28 17:55:05 rrelyea%redhat.com Exp $ */ | 4 /* $Id: drbg.c,v 1.12 2012/12/12 19:22:39 wtc%google.com Exp $ */ |
| 5 | 5 |
| 6 #ifdef FREEBL_NO_DEPEND | 6 #ifdef FREEBL_NO_DEPEND |
| 7 #include "stubs.h" | 7 #include "stubs.h" |
| 8 #endif | 8 #endif |
| 9 | 9 |
| 10 #include "prerror.h" | 10 #include "prerror.h" |
| 11 #include "secerr.h" | 11 #include "secerr.h" |
| 12 | 12 |
| 13 #include "prtypes.h" | 13 #include "prtypes.h" |
| 14 #include "prinit.h" | 14 #include "prinit.h" |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 * additional seed data before the generator is used. A good way to | 463 * additional seed data before the generator is used. A good way to |
| 464 * provide the generator with additional entropy is to call | 464 * provide the generator with additional entropy is to call |
| 465 * RNG_SystemInfoForRNG(). Note that C_Initialize() does exactly that. | 465 * RNG_SystemInfoForRNG(). Note that C_Initialize() does exactly that. |
| 466 */ | 466 */ |
| 467 SECStatus | 467 SECStatus |
| 468 RNG_RNGInit(void) | 468 RNG_RNGInit(void) |
| 469 { | 469 { |
| 470 /* Allow only one call to initialize the context */ | 470 /* Allow only one call to initialize the context */ |
| 471 PR_CallOnce(&coRNGInit, rng_init); | 471 PR_CallOnce(&coRNGInit, rng_init); |
| 472 /* Make sure there is a context */ | 472 /* Make sure there is a context */ |
| 473 return (globalrng != NULL) ? PR_SUCCESS : PR_FAILURE; | 473 return (globalrng != NULL) ? SECSuccess : SECFailure; |
| 474 } | 474 } |
| 475 | 475 |
| 476 /* | 476 /* |
| 477 ** Update the global random number generator with more seeding | 477 ** Update the global random number generator with more seeding |
| 478 ** material. | 478 ** material. |
| 479 */ | 479 */ |
| 480 SECStatus | 480 SECStatus |
| 481 RNG_RandomUpdate(const void *data, size_t bytes) | 481 RNG_RandomUpdate(const void *data, size_t bytes) |
| 482 { | 482 { |
| 483 SECStatus rv; | 483 SECStatus rv; |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 906 if (rng_status == SECSuccess) { | 906 if (rng_status == SECSuccess) { |
| 907 PORT_SetError(SEC_ERROR_LIBRARY_FAILURE); | 907 PORT_SetError(SEC_ERROR_LIBRARY_FAILURE); |
| 908 return SECFailure; | 908 return SECFailure; |
| 909 } | 909 } |
| 910 if (PORT_GetError() != SEC_ERROR_LIBRARY_FAILURE) { | 910 if (PORT_GetError() != SEC_ERROR_LIBRARY_FAILURE) { |
| 911 return rng_status; | 911 return rng_status; |
| 912 } | 912 } |
| 913 | 913 |
| 914 return SECSuccess; | 914 return SECSuccess; |
| 915 } | 915 } |
| OLD | NEW |