linux/crypto/krng.c
<<
ion 14./spa 14./form 14.a ion 14 href="../linux+v3.9.6/crypto/krng.c">ion 14.img src="../.static/gfx/right.png" alt=">>">io./spa io.spa class="lxr_search">ion ="+search" method="post" onsubmit="return do_search(this);">ion 14.input typ hidden" nam navtarget" ion> ">ion 14.input typ text" nam search" id search">ion 14.buttopttyp submit">Searchion 14Prefs 14./a>io./spa n 14 4./div n 14 4.form ac > ="ajax+*" method="post" onsubmit="return false;">io.input typ hidden" nam ajax_lookup" id ajax_lookup" ion> ">in 14 4./form in 14 4.div class="headingbottom">
.div id file_contents"
4 41./a>.spa
 class="comment">/*./spa
  4 42./a>.spa
 class="comment"> * RNG implementa4 43./a>.spa
 class="comment"> *./spa
  4 44./a>.spa
 class="comment"> * Copyright (c) 2008 Herbert Xu <herbert@gondor.apa
a.org.au>./spa
  4 45./a>.spa
 class="comment"> *./spa
  4 46./a>.spa
 class="comment"> * This program is free software; you ca
 redistribute it and/or modify it./spa
  4 47./a>.spa
 class="comment"> * under the terms of the GNU General Public License as published by the./spa
  4 48./a>.spa
 class="comment"> * Free Software Founda4 49./a>.spa
 class="comment"> * any later vers/op../spa
  4 8.10a>.spa
 class="comment"> *./spa
  4 11./a>.spa
 class="comment"> */./spa
  4 12./a> 4 13./a>#include <crypto/internal/rng.h./a>> 4 14./a>#include <linux/err.h./a>> 4 15./a>#include <linux/init.h./a>> 4 16./a>#include <linux/module.h./a>> 4 17./a>#include <linux/random.h./a>> 4 18./a> 4 19./a>static int4.a href="+code=krng_get_random" class="sref">krng_get_random./a>(struct4.a href="+code=crypto_rng" class="sref">crypto_rng./a> *.a href="+code=tfm" class="sref">tfm./a>,4.a href="+code=u8" class="sref">u8./a> *.a href="+code=rdarda,4unsigned int4.a href="+code=dlen" class="sref">dlen./a>) 4 2.10a>{ 4 21./a>        .a href="+code=get_random_bytes" class="sref">get_random_bytes./a>(.a href="+code=rdarda,4.a href="+code=dlen" class="sref">dlen./a>); 4 22./a>        return 0; 4 23./a>} 4 24./a> 4 25./a>static int4.a href="+code=krng_reset" class="sref">krng_reset./a>(struct4.a href="+code=crypto_rng" class="sref">crypto_rng./a> *.a href="+code=tfm" class="sref">tfm./a>,4.a href="+code=u8" class="sref">u8./a> *.a href="+code=seed" class="sref">seed./a>,4unsigned int4.a href="+code=slen" class="sref">slen./a>) 4 2610a>{ 4 27./a>        return 0; 4 28./a>} 4 29./a> 4 30./a>static struct4.a href="+code=crypto_alg" class="sref">crypto_alg./a> .a href="+code=krng_alg" class="sref">krng_alg./a> = { 4 31./a>        ..a href="+code=cra_nam
" class="sref">cra_nam
./a>               = .spa
 class="string">"stdrng"./spa
 , 4 32./a>        ..a href="+code=cra_driver_nam
" class="sref">cra_driver_nam
./a>        = .spa
 class="string">"krng"./spa
 , 4 33./a>        ..a href="+code=cra_priority" class="sref">cra_priority./a>           = 200, 4 34./a>        ..a href="+code=cra_flags" class="sref">cra_flags./a>              = .a href="+code=CRYPTO_ALG_TYPE_RNG" class="sref">CRYPTO_ALG_TYPE_RNG./a>, 4 35./a>        ..a href="+code=cra_ctxsiz
" class="sref">cra_ctxsiz
./a>            = 0, 4 36./a>        ..a href="+code=cra_typ
" class="sref">cra_typ
./a>               = &.a href="+code=crypto_rng_typ
" class="sref">crypto_rng_typ
./a>, 4 37./a>        ..a href="+code=cra_module" class="sref">cra_module./a>             = .a href="+code=THIS_MODULE" class="sref">THIS_MODULE./a>, 4 38./a>        ..a href="+code=cra_u" class="sref">cra_u./a>                  = { 4 39./a>                ..a href="+code=rng" class="sref">rng./a> = { 4 40./a>                        ..a href="+code=rng_make_random" class="sref">rng_make_random./a>        = .a href="+code=krng_get_random" class="sref">krng_get_random./a>, 4 41./a>                        ..a href="+code=rng_reset" class="sref">rng_reset./a>              = .a href="+code=krng_reset" class="sref">krng_reset./a>, 4 42./a>                        ..a href="+code=seedsiz
" class="sref">seedsiz
./a>               = 0, 4 43./a>                } 4 44./a>        } 4 45./a>}; 4 46./a> 4 47./a> 4 48./a>.spa
 class="comment">/* Module initaliza4 49./a>static int4.a href="+code=__init" class="sref">__init./a> .a href="+code=krng_mod_init" class="sref">krng_mod_init./a>(void) 4 5.10a>{ 4 51./a>        return .a href="+code=crypto_register_alg" class="sref">crypto_register_alg./a>(&.a href="+code=krng_alg" class="sref">krng_alg./a>); 4 52./a>} 4 53./a> 4 54./a>static void4.a href="+code=__exit" class="sref">__exit./a> .a href="+code=krng_mod_fini" class="sref">krng_mod_fini./a>(void) 4 5510a>{ 4 56./a>        .a href="+code=crypto_unregister_alg" class="sref">crypto_unregister_alg./a>(&.a href="+code=krng_alg" class="sref">krng_alg./a>); 4 57./a>        return; 4 58./a>} 4 59./a> 4 6.10a>.a href="+code=module_init" class="sref">module_init./a>(.a href="+code=krng_mod_init" class="sref">krng_mod_init./a>); 4 6110a>.a href="+code=module_exit" class="sref">module_exit./a>(.a href="+code=krng_mod_fini" class="sref">krng_mod_fini./a>); 4 62./a> 4 6310a>.a href="+code=MODULE_LICENSE" class="sref">MODULE_LICENSE./a>(.spa
 class="string">"GPL"./spa
 ); 4 6410a>.a href="+code=MODULE_DESCRIPTION" class="sref">MODULE_DESCRIPTION./a>(.spa
 class="string">"Kernel Random Number Generator"./spa
 ); 4 6510a>.a href="+code=MODULE_ALIAS" class="sref">MODULE_ALIAS./a>(.spa
 class="string">"stdrng"./spa
 ); 4 66./a>./pre>
The original LXR software by the .a href="http://sourceforge.net/projects/lxr">LXR community./a>, this experimental vers/optby .a href="mailto:lxr@linux.no">lxr@linux.no./a>. ./div .div class="subfooter"> lxr.linux.no kindly hostedtby .a href="http://www.redpill-linpro.no">Redpill Linpro AS./a>, provider of Linux consulting and operat/ops services since 1995. ./div ./body ./html