Przeglądaj źródła

Add wrapper around axtls' sha1 code

tags/v0.9.3
Michael Brown 17 lat temu
rodzic
commit
c1aa1d0764
2 zmienionych plików z 34 dodań i 0 usunięć
  1. 26
    0
      src/crypto/axtls_sha1.c
  2. 8
    0
      src/include/gpxe/sha1.h

+ 26
- 0
src/crypto/axtls_sha1.c Wyświetl plik

@@ -0,0 +1,26 @@
1
+#include "crypto/axtls/crypto.h"
2
+#include <gpxe/crypto.h>
3
+#include <gpxe/sha1.h>
4
+
5
+static void sha1_init ( void *ctx ) {
6
+	SHA1Init ( ctx );
7
+}
8
+
9
+static void sha1_update ( void *ctx, const void *data, void *dst __unused,
10
+			  size_t len ) {
11
+	SHA1Update ( ctx, data, len );
12
+}
13
+
14
+static void sha1_final ( void *ctx, void *out ) {
15
+	SHA1Final ( ctx, out );
16
+}
17
+
18
+struct crypto_algorithm sha1_algorithm = {
19
+	.name		= "sha1",
20
+	.ctxsize	= sizeof ( SHA1_CTX ),
21
+	.blocksize	= 64,
22
+	.digestsize	= SHA1_SIZE,
23
+	.init		= sha1_init,
24
+	.encode		= sha1_update,
25
+	.final		= sha1_final,
26
+};

+ 8
- 0
src/include/gpxe/sha1.h Wyświetl plik

@@ -0,0 +1,8 @@
1
+#ifndef _GPXE_SHA1_H
2
+#define _GPXE_SHA1_H
3
+
4
+struct crypto_algorithm;
5
+
6
+extern struct crypto_algorithm sha1_algorithm;
7
+
8
+#endif /* _GPXE_SHA1_H */

Ładowanie…
Anuluj
Zapisz