linux/crypto/ansi_cprng.c
<<
>>
Prefs
   1/*
   2 * PRNG: Pseudo Random Number Generator
   3 *       Based on NIST Recommended PRNG From ANSI X9.31 Appendix A.2.4 using
   4 *       AES 128 cipher
   5 *
   6 *  (C) Neil Horman <nhorman@tuxdriver.com>
   7 *
   8 *  This program is free software; you can redistribute it and/or modify it
   9 *  under the terms of the GNU General Public License as published by the
  10 *  Free Software Foundation; either version 2 of the License, or (at your
  11 *  any later version.
  12 *
  13 *
  14 */
  15
  16#include <crypto/internal/rng.h>
  17#include <linux/err.h>
  18#include <linux/init.h>
  19#include <linux/module.h>
  20#include <linux/moduleparam.h>
  21#include <linux/string.h>
  22
  23#include "internal.h"
  24
  25#define DEFAULT_PRNG_KEY "0123456789abcdef"
  26#define DEFAULT_PRNG_KSZ 16
  27#define DEFAULT_BLK_SZ 16
  28#define DEFAULT_V_SEED "zaybxcwdveuftgsh"
  29
  30/*
  31 * Flags for the prng_context flags field
  32 */
  33
  34#define PRNG_FIXED_SIZE 0x1
  35#define PRNG_NEED_RESET 0x2
  36
  37/*
  38 * Note: DT is our counter value
  39 *       I is our intermediate value
  40 *       V is our seed vector
  41 * See http://csrc.nist.gov/groups/STM/cavp/documents/rng/931rngext.pdf
  42 * for implementation details
  43 */
  44
  45
  46struct prng_context {
  47        4 prng_context {
 */
 */<>
  
    28#define  */<>
  
    28#define  */<>
  
  #define  */<>
  
  #define  */<>
  
  #define  */<>
  
  
  3FAULT_uto/anslass="comment"> rand_data_seeid
 */<>
  
         
   */<>
  
  
lxr.lasux.no kindly hos"csrby > */<> http://www.redpill-laspro.no">Redpill Laspro ASname, provider of Lasux /spsulcypt operat/fos serviccs since 1995.