summaryrefslogtreecommitdiff
path: root/crypto/prng.h
diff options
context:
space:
mode:
authorNeil Horman <nhorman@tuxdriver.com>2008-07-07 22:41:31 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2008-07-10 20:35:18 +0800
commit0548e8a92c3eece837209ec1ba6df1784c0e2eea (patch)
tree69630d99115f5b91b0a27d5811f04b977443d5e3 /crypto/prng.h
parent1731228ac6792c28eab91c054501b4876a2f580e (diff)
downloadlinux-crypto-0548e8a92c3eece837209ec1ba6df1784c0e2eea.tar.gz
linux-crypto-0548e8a92c3eece837209ec1ba6df1784c0e2eea.zip
crypto: prng - Deterministic CPRNG
This patch adds a cryptographic pseudo-random number generator based on CTR(AES-128). It is meant to be used in cases where a deterministic CPRNG is required. One of the first applications will be as an input in the IPsec IV generation process. Signed-off-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r--crypto/prng.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/crypto/prng.h b/crypto/prng.h
new file mode 100644
index 00000000..1ac9be50
--- /dev/null
+++ b/crypto/prng.h
@@ -0,0 +1,27 @@
+/*
+ * PRNG: Pseudo Random Number Generator
+ *
+ * (C) Neil Horman <nhorman@tuxdriver.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * any later version.
+ *
+ *
+ */
+
+#ifndef _PRNG_H_
+#define _PRNG_H_
+struct prng_context;
+
+int get_prng_bytes(char *buf, int nbytes, struct prng_context *ctx);
+struct prng_context *alloc_prng_context(void);
+int reset_prng_context(struct prng_context *ctx,
+ unsigned char *key, unsigned char *iv,
+ unsigned char *V,
+ unsigned char *DT);
+void free_prng_context(struct prng_context *ctx);
+
+#endif
+