aboutsummaryrefslogtreecommitdiff
path: root/payloads/libpayload/include
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2008-04-03 23:01:23 +0000
committerUwe Hermann <uwe@hermann-uwe.de>2008-04-03 23:01:23 +0000
commit3995593b6861e62b6a97207d5d6e28385be229bf (patch)
treebef25d467abadca2966ea752158aa98b3d336fe1 /payloads/libpayload/include
parentc7582274068429db814b130ba83e6f123c961f80 (diff)
Add a SHA-1 implementation to libpayload.
Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Peter Stuge <peter@stuge.se> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3212 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'payloads/libpayload/include')
-rw-r--r--payloads/libpayload/include/libpayload.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/payloads/libpayload/include/libpayload.h b/payloads/libpayload/include/libpayload.h
index fb3403a005..5595ff6978 100644
--- a/payloads/libpayload/include/libpayload.h
+++ b/payloads/libpayload/include/libpayload.h
@@ -41,6 +41,14 @@
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
+#define LITTLE_ENDIAN 1234
+#define BIG_ENDIAN 4321
+#ifdef CONFIG_TARGET_I386
+#define BYTE_ORDER LITTLE_ENDIAN
+#else
+#define BYTE_ORDER BIG_ENDIAN
+#endif
+
/* Some NVRAM byte definitions */
#define NVRAM_RTC_SECONDS 0
#define NVRAM_RTC_MINUTES 2
@@ -117,6 +125,20 @@ int vsprintf(char *str, const char *fmt, va_list ap);
int printf(const char *fmt, ...);
int vprintf(const char *fmt, va_list ap);
+/* libc/sha1.c */
+#define SHA1_BLOCK_LENGTH 64
+#define SHA1_DIGEST_LENGTH 20
+typedef struct {
+ u32 state[5];
+ u64 count;
+ u8 buffer[SHA1_BLOCK_LENGTH];
+} SHA1_CTX;
+void SHA1Init(SHA1_CTX *context);
+void SHA1Transform(u32 state[5], const u8 buffer[SHA1_BLOCK_LENGTH]);
+void SHA1Update(SHA1_CTX *context, const u8 *data, size_t len);
+void SHA1Final(u8 digest[SHA1_DIGEST_LENGTH], SHA1_CTX *context);
+u8 *sha1(const u8 *data, size_t len, u8 *buf);
+
/* libc/string.c */
size_t strnlen(const char *str, size_t maxlen);
size_t strlen(const char *str);