Skip to contentSkip to conversation

add SHA256 support

PATCH New Jean-Christophe PLAGNIOL-VILLARD 2 participants 2 messages Jun 7, 2008 – Jul 5, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add SHA256 support

---
 include/sha256.h     |   16 +++
 lib_generic/Makefile |    1 +
 lib_generic/sha256.c |  262 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 279 insertions(+), 0 deletions(-)
 create mode 100755 include/sha256.h
 create mode 100644 lib_generic/sha256.c
include/sha256.h new file +16 -0
new file mode 100755
index 0000000..e38ea89
@@ -0,0 +1,16 @@
+#ifndef _SHA256_H
+#define _SHA256_H
+
+#define SHA256_SUM_LEN	32
+
+typedef struct {
+	uint32_t total[2];
+	uint32_t state[8];
+	uint8_t buffer[64];
+} sha256_context;
+
+void sha256_starts(sha256_context * ctx);
+void sha256_update(sha256_context * ctx, uint8_t * input, uint32_t length);
+void sha256_finish(sha256_context * ctx, uint8_t digest[SHA256_SUM_LEN]);
+
+#endif /* _SHA256_H */
lib_generic/Makefile +1 -0
index dca3a6c..4f6ce73 100644
@@ -38,6 +38,7 @@ COBJS-y += lmb.o
 COBJS-y += ldiv.o
 COBJS-$(CONFIG_MD5) += md5.o
 COBJS-y += sha1.o
+COBJS-$(CONFIG_SHA256) += sha256.o
 COBJS-y += string.o
 COBJS-y += vsprintf.o
 COBJS-y += zlib.o
lib_generic/sha256.c new file +262 -0

262 lines not on this page · raw message

Signature · 1 line
1.5.5.1
#1 lore raw

PATCH 1/1 add SHA256 support

Quoted 9 lines · In message <[email protected]> you wrote:
---
 include/sha256.h     |   16 +++
 lib_generic/Makefile |    1 +
 lib_generic/sha256.c |  262 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 279 insertions(+), 0 deletions(-)
 create mode 100755 include/sha256.h
 create mode 100644 lib_generic/sha256.c

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Wenn das dann in die Hose geht, nehme ich es auf meine Kappe.
                                         -- Rudi V?ller, 15. Nov 2003