diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/libbb.h | 26 | ||||
-rw-r--r-- | include/platform.h | 15 |
2 files changed, 38 insertions, 3 deletions
diff --git a/include/libbb.h b/include/libbb.h index 9f0c85b03..0ede812a9 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -464,9 +464,29 @@ extern void vfork_daemon_rexec(int nochdir, int noclose, | |||
464 | extern int get_terminal_width_height(int fd, int *width, int *height); | 464 | extern int get_terminal_width_height(int fd, int *width, int *height); |
465 | extern unsigned long get_ug_id(const char *s, long (*__bb_getxxnam)(const char *)); | 465 | extern unsigned long get_ug_id(const char *s, long (*__bb_getxxnam)(const char *)); |
466 | 466 | ||
467 | #define HASH_SHA1 1 | 467 | typedef struct _sha1_ctx_t_ { |
468 | #define HASH_MD5 2 | 468 | uint32_t count[2]; |
469 | extern int hash_fd(int fd, const size_t size, const uint8_t hash_algo, uint8_t *hashval); | 469 | uint32_t hash[5]; |
470 | uint32_t wbuf[16]; | ||
471 | } sha1_ctx_t; | ||
472 | |||
473 | void sha1_begin(sha1_ctx_t *ctx); | ||
474 | void sha1_hash(const void *data, size_t length, sha1_ctx_t *ctx); | ||
475 | void *sha1_end(void *resbuf, sha1_ctx_t *ctx); | ||
476 | |||
477 | typedef struct _md5_ctx_t_ { | ||
478 | uint32_t A; | ||
479 | uint32_t B; | ||
480 | uint32_t C; | ||
481 | uint32_t D; | ||
482 | uint32_t total[2]; | ||
483 | uint32_t buflen; | ||
484 | char buffer[128]; | ||
485 | } md5_ctx_t; | ||
486 | |||
487 | void md5_begin(md5_ctx_t *ctx); | ||
488 | void md5_hash(const void *data, size_t length, md5_ctx_t *ctx); | ||
489 | void *md5_end(void *resbuf, md5_ctx_t *ctx); | ||
470 | 490 | ||
471 | /* busybox.h will include dmalloc later for us, else include it here. */ | 491 | /* busybox.h will include dmalloc later for us, else include it here. */ |
472 | #if !defined _BB_INTERNAL_H_ && defined DMALLOC | 492 | #if !defined _BB_INTERNAL_H_ && defined DMALLOC |
diff --git a/include/platform.h b/include/platform.h index 68c7abbc6..b19621af1 100644 --- a/include/platform.h +++ b/include/platform.h | |||
@@ -78,4 +78,19 @@ | |||
78 | # endif | 78 | # endif |
79 | #endif | 79 | #endif |
80 | 80 | ||
81 | /* ---- Endian Detection ------------------------------------ */ | ||
82 | #ifndef __APPLE__ | ||
83 | #include <byteswap.h> | ||
84 | #include <endian.h> | ||
85 | #endif | ||
86 | |||
87 | #ifdef __BIG_ENDIAN__ | ||
88 | #define BB_BIG_ENDIAN 1 | ||
89 | #elif __BYTE_ORDER == __BIG_ENDIAN | ||
90 | #define BB_BIG_ENDIAN 1 | ||
91 | #else | ||
92 | #define BB_BIG_ENDIAN 0 | ||
93 | #endif | ||
94 | |||
95 | |||
81 | #endif /* platform.h */ | 96 | #endif /* platform.h */ |