crypto: ansi_cprng - Fix off by one error in non-block size request
crypto: ansi_cprng - Fix off by one error in non-block size request

Stephan Mueller reported to me recently a error in random number generation in
the ansi cprng. If several small requests are made that are less than the
instances block size, the remainder for loop code doesn't increment
rand_data_valid in the last iteration, meaning that the last bytes in the
rand_data buffer gets reused on the subsequent smaller-than-a-block request for
random data.

The fix is pretty easy, just re-code the for loop to make sure that
rand_data_valid gets incremented appropriately

Signed-off-by: Neil Horman <3316dc2d77df57653443c0391a5296176d6ca9c3@tuxdriver.com>
Reported-by: Stephan Mueller <71cb0b1af31326d68c5408ce7140ce4c3faccee0@atsec.com>
CC: Stephan Mueller <71cb0b1af31326d68c5408ce7140ce4c3faccee0@atsec.com>
CC: Petr Matousek <d1ac682bce3c8307a4378440a11ce4c6d399629c@redhat.com>
CC: Herbert Xu <ef65de1c7be0aa837fe7b25ba9a7739905af6a55@gondor.apana.org.au>
CC: "David S. Miller" <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>
Signed-off-by: Herbert Xu <ef65de1c7be0aa837fe7b25ba9a7739905af6a55@gondor.apana.org.au>

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs