Re: Performance of /dev/urandom and /dev/random
On Thu, Sep 27, 2012 at 5:09 PM, Mihir Pandya mihir.m.pan...@gmail.com wrote: Hey guys, I'm interested to know why generating cryptographically secure random numbers takes so long, particularly in my case. I have two Java classes that are generating a million random numbers. One is generating random numbers regularly while the other is using SecureRandom to generate the numbers. The SecureRandom method is taking almost double the time and I realised that it's because the method reads from /dev/urandom (not sure which) and obtains its random numbers from the entropy pool there. I wanted to know where I can read about the exact mechanism used to generate the cryptographically secure random numbers through SecureRandom and if there is any way to make it faster. -- Mihir Pandya From 'man urandom' When read, the /dev/random device will only return random bytes within the estimated number of bits of noise in the entropy pool. /dev/random should be suitable for uses that need very high quality randomness such as one-time pad or key generation. When the entropy pool is empty, reads from /dev/random will block until additional envi‐ ronmental noise is gathered. A read from the /dev/urandom device will not block waiting for more entropy. As a result, if there is not sufficient entropy in the entropy pool, the returned values are theoretically vulnerable to a cryptographic attack on the algorithms used by the driver. Knowledge of how to do this is not available in the current unclassified litera‐ ture, but it is theoretically possible that such an attack may exist. If this is a concern in your application, use /dev/random instead. Now I *believe* the entropy pool is filled by IO events - network activity, disk access, keyboard pounding, etc... I'm sure there is more documentation somewhere online as to the specifics. Hope that helps, Danny G ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Need help: How to set .RECIPEPREFIX variable to whitespaces
On Wed, Jul 13, 2011 at 1:52 AM, amit mehta gmate.a...@gmail.com wrote: Hi, How to set .RECIPEPREFIX variable to whitespace(say 4 whitespces) , so that make uses this particular set of characters to identify the recipe for a particular target. In my $HOME/.vimrc file, for code indentation purpose, I've put the following entries to replace tabs with 4 whitespaces: snip from my $HOME/.vimrc file replace tabs with spaces set expandtab set shiftwidth=4 set tabstop=4 snip from my $HOME/.vimrc file but the above will cause problem in case you write your own makefile for a kernel module, because now the tab stroke will be replaced by 4 whitespaces which 'make' will not understand. Quoting from 'make' manual, Please note: you need to put a tab character at the beginning of every recipe line! Seems .RECIPEPREFIX will come for resuce, but as of now I don't know how to use it to fix my problem. Regards, Amit -- Life is elsewhere. Cross Frontiers. Fly away. - Salman Rushdie ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies I have my vimrc file setup to use different tabs/spacing depending on the filetype. 8-width tab in C, 4-space indent in Python, etc... Here's a snippet from my vimrc: C - function! LANG_C() setlocal noexpandtab setlocal shiftwidth=8 setlocal tabstop=8 setlocal softtabstop=8 setlocal formatoptions=tcroq endfunction autocmd FileType c call LANG_C() --- Python function! LANG_PYTHON() setlocal shiftwidth=4 setlocal tabstop=4 setlocal softtabstop=4 setlocal expandtab --- python indent keywords setlocal cinwords=if,elif,else,for,while,try,except,finally,def,class,with endfunction autocmd FileType python call LANG_PYTHON() --- Makefile -- function! LANG_MAKEFILE() setlocal noexpandtab makefiles only work with tab-indents setlocal shiftwidth=8 setlocal tabstop=8 setlocal softtabstop=8 endfunction autocmd FileType make call LANG_MAKEFILE() There may be other/better ways to do this, but it works well for me. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: knewbies project? - updating LDD3 source
On Tue, May 24, 2011 at 11:47 AM, Robert P. J. Day rpj...@crashcourse.ca wrote: On Tue, 24 May 2011, Jim Cromie wrote: over at http://code.google.com/p/ldd3/ it says: The famous Linux Device Drivers released the sample code. but the code does not reflect the latest kernel updates, some of code cannot even compile. This project is to make it compatible with the current kernel. http://lwn.net/Kernel/LDD3/ http://examples.oreilly.com/9780596005900/ the one caution i would give here is that quite a bit of code in LDD3 shouldn't be updated, anyway, since it reflects features that have been deprecated for quite some time. for instance, no one should be writing proc files anymore. also, ioctl()s are also discouraged for the most part. so i would be selective about what parts of LDD3 code *should* be updated as examples of good kernel programming. rday There is a repo on GitHub with the same purpose. I haven't checked it out personally, but it's probably worth a look. https://github.com/martinezjavier/ldd3 ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies