summaryrefslogtreecommitdiffstats
path: root/base/rand_util_posix.cc
Commit message (Collapse)AuthorAgeFilesLines
* Switch to standard integer types in base/.avi2015-12-261-2/+4
| | | | | | | | | | BUG=138542 TBR=mark@chromium.org NOPRESUBMIT=true Review URL: https://codereview.chromium.org/1538743002 Cr-Commit-Position: refs/heads/master@{#366910}
* Move file_util to base/files/ directory.brettw@chromium.org2014-08-131-1/+1
| | | | | | | | | | | This updates the includes in base but leaves a forwarding header for the rest of the project for now. R=yzshen@chromium.org Review URL: https://codereview.chromium.org/468253002 Cr-Commit-Position: refs/heads/master@{#289360} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289360 0039d316-1c4b-4281-b951-d872f2087c98
* Improve base::RandBytes() performance by 1.75x-2.10x on POSIX.dalecurtis@chromium.org2014-01-231-11/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | No real changes, just avoids doling out Uint64 sized chunks by using the underlying method to hand out correctly sized blocks. Windows is the only platform which doesn't have a byte stream based generator, so I've moved the generic RandBytes() method there and added native methods for other platforms which reuse each platforms internal generator. Performance measured by the new benchmark test over 5 runs, each representing 10 generations of 1mb of random data: Linux x64: Original: 1199625.4 Modified: 686480.2 Improvement: 1.75x On OSX (10.9.1): Original: 1532669.8 Modified: 734808.0 Improvement: 2.10x BUG=none TEST=new benchmark unittest. Review URL: https://codereview.chromium.org/140773006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@246486 0039d316-1c4b-4281-b951-d872f2087c98
* Move Posix file utils to the base namespace.brettw@chromium.org2013-11-271-3/+2
| | | | | | | | | BUG= R=rvargas@chromium.org Review URL: https://codereview.chromium.org/89523002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237642 0039d316-1c4b-4281-b951-d872f2087c98
* Base: Make Rand util global instance a leaky LazyInstancervargas@chromium.org2012-12-211-1/+1
| | | | | | | | | BUG=166996 TEST=none Review URL: https://chromiumcodereview.appspot.com/11647029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@174329 0039d316-1c4b-4281-b951-d872f2087c98
* Added crypto random-number generatormniknami@chromium.org2012-08-021-0/+1
| | | | | | | | | | | Added a cryptographic random-number generator to crypto/. Modified sync to use this function instead. May also be used by Cloud Print in the future. Review URL: https://chromiumcodereview.appspot.com/10698177 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149689 0039d316-1c4b-4281-b951-d872f2087c98
* Cleanup: Remove the C version of GetUrandomFD()mseaborn@chromium.org2012-05-301-4/+3
| | | | | | | | | | | | | | | | | | | I originally added this in a #includable-from-C header so that it could be #included from NaCl-side code. However, having NaCl #include Chromium headers is not a clean interface, and this has since been replaced by runtime dependency injection. We move the function to a C++ header and put it into a namespace. Also fix the error return value for UrandomFD() so that it can't be confused with stdin. BUG=http://code.google.com/p/nativeclient/issues/detail?id=2655 TEST=build Review URL: https://chromiumcodereview.appspot.com/10446043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139537 0039d316-1c4b-4281-b951-d872f2087c98
* Allow linker initialization of lazy instancejoth@chromium.org2011-11-151-2/+2
| | | | | | | | | | | | | | Using the initializer list construct = {0} allows the object to be linker initialized. Modify the LazyInstance class design to make it a pod aggregate type that can be linker initialized this way. Also combines the instance and state members, in line with the Singleton<> class design. Introduces a new LAZY_INSTANCE_INITIALIZER macro specifically for using to init all lazy instances + modify all existing callsites to use it. (Old code would no longer compile) BUG=94925 TEST=existing tests pass. http://build.chromium.org/f/chromium/perf/linux-release/sizes/report.html?history=150&header=chrome-si&graph=chrome-si&rev=-1 should step downward. TBR=jam@chromium.org,rvargas@chromium.org,darin@chromium.org,ben@chromium.org,apatrick@chromium.org,akalin@chromium.org Review URL: http://codereview.chromium.org/8491043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110076 0039d316-1c4b-4281-b951-d872f2087c98
* Replace most LOG/CHECK statements with DLOG/DCHECK statements in base.brettw@chromium.org2011-10-261-1/+1
| | | | | | | | | | | [ Reland of 107042 http://codereview.chromium.org/8368009 ] I tried hard not to change CHECKs that had side effects. I kept fatal checks that seemed security or debugging-info (in crash reports) sensitive, and ones that seems particularly well-conceived. Review URL: http://codereview.chromium.org/8341026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107434 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 107042 - Replace most LOG/CHECK statements with DLOG/DCHECK ↵brettw@chromium.org2011-10-251-1/+1
| | | | | | | | | | | | | | statements in base. I tried hard not to change CHECKs that had side effects. I kept fatal checks that seemed security or debugging-info (in crash reports) sensitive, and ones that seems particularly well-conceived. Review URL: http://codereview.chromium.org/8368009 TBR=brettw@chromium.org Review URL: http://codereview.chromium.org/8351025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107051 0039d316-1c4b-4281-b951-d872f2087c98
* Replace most LOG/CHECK statements with DLOG/DCHECK statements in base.brettw@chromium.org2011-10-251-1/+1
| | | | | | | | | I tried hard not to change CHECKs that had side effects. I kept fatal checks that seemed security or debugging-info (in crash reports) sensitive, and ones that seems particularly well-conceived. Review URL: http://codereview.chromium.org/8368009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107042 0039d316-1c4b-4281-b951-d872f2087c98
* Moving GUID generation from base to chrome/browser/guid*dhollowa@chromium.org2010-10-141-17/+0
| | | | | | | | | | | Moves GUID generation into chrome/browser/guid*. GUID generation is used only within chrome/browser. So am moving it there. BUG=58813 TEST=GUIDTest.GUIDGeneratesAllZeroes, GUIDTest.GUIDGeneratesCorrectly, GUIDTest.GUIDCorrectlyFormatted, MetricsServiceTest.ClientIdCorrectlyFormatted Review URL: http://codereview.chromium.org/3800003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62639 0039d316-1c4b-4281-b951-d872f2087c98
* Factoring GUID generation from metrics to basedhollowa@chromium.org2010-10-131-0/+17
| | | | | | | | | | | Factors GUID generation into base/rand_util. The Autofill feature is in need of this utility so am factoring GUID generation out of metrics and moving to the commons. BUG=58813 TEST=RandUtilTest.GUIDGeneratesAllZeroes, RandUtilTest.GUIDGeneratesCorrectly, RandUtilTest.GUIDCorrectlyFormatted, MetricsServiceTest.ClientIdCorrectlyFormatted Review URL: http://codereview.chromium.org/3800001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62480 0039d316-1c4b-4281-b951-d872f2087c98
* Add support for running the NaCl plugin in the Linux SUID sandboxagl@chromium.org2010-03-041-0/+5
| | | | | | | | | | | | | | | | | | | | | * Add a function for getting the pre-opened FD for /dev/urandom. This needs to be a C function because it will be used by nacl_secure_random.c. * Add an IPC message for creating shared memory segments, since /dev/shm is not available inside the sandbox. The corresponding NaCl change is http://codereview.chromium.org/669056 BUG=36676 TEST=nacl_ui_tests in conjunction with NaCl changes http://codereview.chromium.org/669055 Patch by Mark Seaborn. Signed-off-by: Adam Langley git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40647 0039d316-1c4b-4281-b951-d872f2087c98
* Reland r40289: "Add support for CHECK_* macros.""willchan@chromium.org2010-03-021-1/+1
| | | | | | | | Make sure DEFINE_CHECK_OP_IMPL isn't omitted for official builds. Review URL: http://codereview.chromium.org/661325 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40327 0039d316-1c4b-4281-b951-d872f2087c98
* Revert r40289: "Add support for CHECK_* macros."willchan@chromium.org2010-03-011-1/+1
| | | | | | | | Broke official build compilation (only worked on debug/release builds). Review URL: http://codereview.chromium.org/661298 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40296 0039d316-1c4b-4281-b951-d872f2087c98
* Add support for CHECK_* macros.willchan@chromium.org2010-03-011-1/+1
| | | | | | | | Convert a few places to make sure it works. Review URL: http://codereview.chromium.org/660221 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40289 0039d316-1c4b-4281-b951-d872f2087c98
* Cache the file descriptor for /dev/urandom to avoid needing to reopen it for ↵deanm@chromium.org2009-06-261-3/+30
| | | | | | | | | | | | | | every call. Patch by Mike Mammarella. BUG=none TEST=none Review URL: http://codereview.chromium.org/144010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19352 0039d316-1c4b-4281-b951-d872f2087c98
* Protect RandUint64 against EINTR.phajdan.jr@chromium.org2009-04-231-3/+5
| | | | | | Review URL: http://codereview.chromium.org/77022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14297 0039d316-1c4b-4281-b951-d872f2087c98
* RandUInt -> RandUint to match the style of other Uint functions.deanm@chromium.org2008-11-141-1/+1
| | | | | | Review URL: http://codereview.chromium.org/10767 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5517 0039d316-1c4b-4281-b951-d872f2087c98
* Refactoring for portability:mark@chromium.org2008-09-291-0/+27
- Move chrome/common/env_util to base/sys_info - Move chrome/common/rand_util to base/rand_util (new), simplify its public interface, and fix its implementation Patch by Paweł Hajdan, Jr. <phajdan.jr@gmail.com> http://codereview.chromium.org/4079 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2697 0039d316-1c4b-4281-b951-d872f2087c98