summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorMichael Brown2012-02-19 15:31:41 +0100
committerMichael Brown2012-02-19 15:37:13 +0100
commiteec068253f8cfd2f0b5a95b19dd9d20630c43947 (patch)
tree4f919df04a8aff371c5e7ae047f12516b7b6c62b /src/include
parent[efi] Add iPXE download protocol (diff)
downloadipxe-eec068253f8cfd2f0b5a95b19dd9d20630c43947.tar.gz
ipxe-eec068253f8cfd2f0b5a95b19dd9d20630c43947.tar.xz
ipxe-eec068253f8cfd2f0b5a95b19dd9d20630c43947.zip
[rng] Add ANS X9.82 Approved Hash_df derivation function
ANS X9.82 specifies several Approved derivation functions for use in distributing entropy throughout a buffer. One such derivation function is Hash_df, which can be implemented using the existing iPXE SHA-1 functionality. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/ipxe/hash_df.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/include/ipxe/hash_df.h b/src/include/ipxe/hash_df.h
new file mode 100644
index 000000000..003e5ceff
--- /dev/null
+++ b/src/include/ipxe/hash_df.h
@@ -0,0 +1,30 @@
+#ifndef _IPXE_HASH_DF_H
+#define _IPXE_HASH_DF_H
+
+/** @file
+ *
+ * Hash-based derivation function (Hash_df)
+ *
+ */
+
+FILE_LICENCE ( GPL2_OR_LATER );
+
+#include <stdint.h>
+#include <ipxe/sha1.h>
+
+/** Use SHA-1 as the underlying hash algorithm
+ *
+ * Hash_df using SHA-1 is an Approved algorithm in ANS X9.82.
+ */
+#define hash_df_algorithm sha1_algorithm
+
+/** Underlying hash algorithm output length (in bytes) */
+#define HASH_DF_OUTLEN_BYTES SHA1_DIGEST_SIZE
+
+/** Underlying hash algorithm context size (in bytes) */
+#define HASH_DF_CTX_SIZE SHA1_CTX_SIZE
+
+extern void hash_df ( const void *input, size_t input_len, void *output,
+ size_t output_len );
+
+#endif /* _IPXE_HASH_DF_H */