Browse Source

Generalisation of a message digest algorithm

tags/v0.9.3
Michael Brown 18 years ago
parent
commit
1ddfce2308
1 changed files with 44 additions and 0 deletions
  1. 44
    0
      src/include/gpxe/crypto.h

+ 44
- 0
src/include/gpxe/crypto.h View File

@@ -0,0 +1,44 @@
1
+#ifndef _GPXE_CRYPTO_H
2
+#define _GPXE_CRYPTO_H
3
+
4
+/** @file
5
+ *
6
+ * Cryptographic API
7
+ *
8
+ */
9
+
10
+#include <stdint.h>
11
+
12
+/**
13
+ * A message-digest algorithm
14
+ *
15
+ */
16
+struct digest_algorithm {
17
+	/** Size of a context for this algorithm */
18
+	size_t context_len;
19
+	/** Size of a message digest for this algorithm */
20
+	size_t digest_len;
21
+	/**
22
+	 * Initialise digest algorithm
23
+	 *
24
+	 * @v context		Context for digest operations
25
+	 */
26
+	void ( * init ) ( void *context );
27
+	/**
28
+	 * Calculate digest over data buffer
29
+	 *
30
+	 * @v context		Context for digest operations
31
+	 * @v data		Data buffer
32
+	 * @v len		Length of data buffer
33
+	 */
34
+	void ( * update ) ( void *context, const void *data, size_t len );
35
+	/**
36
+	 * Finish calculating digest
37
+	 *
38
+	 * @v context		Context for digest operations
39
+	 * @v digest		Buffer for message digest
40
+	 */
41
+	void ( * finish ) ( void *context, void *digest );
42
+};
43
+
44
+#endif /* _GPXE_CRYPTO_H */

Loading…
Cancel
Save