diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/applets.h | 2 | ||||
-rw-r--r-- | include/libbb.h | 19 | ||||
-rw-r--r-- | include/usage.h | 53 |
3 files changed, 59 insertions, 15 deletions
diff --git a/include/applets.h b/include/applets.h index 0e4cbd5a3..286f71d1e 100644 --- a/include/applets.h +++ b/include/applets.h @@ -334,6 +334,8 @@ USE_FEATURE_SH_IS_ASH(APPLET_ODDNAME(sh, ash, _BB_DIR_BIN, _BB_SUID_NEVER, sh)) USE_FEATURE_SH_IS_HUSH(APPLET_ODDNAME(sh, hush, _BB_DIR_BIN, _BB_SUID_NEVER, sh)) USE_FEATURE_SH_IS_MSH(APPLET_ODDNAME(sh, msh, _BB_DIR_BIN, _BB_SUID_NEVER, sh)) USE_SHA1SUM(APPLET_ODDNAME(sha1sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, sha1sum)) +USE_SHA256SUM(APPLET_ODDNAME(sha256sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, sha256sum)) +USE_SHA512SUM(APPLET_ODDNAME(sha512sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, sha512sum)) USE_SHOWKEY(APPLET(showkey, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) USE_SLATTACH(APPLET(slattach, _BB_DIR_SBIN, _BB_SUID_NEVER)) USE_SLEEP(APPLET_NOFORK(sleep, sleep, _BB_DIR_BIN, _BB_SUID_NEVER, sleep)) diff --git a/include/libbb.h b/include/libbb.h index b0f6eaee2..839a0de49 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -1310,7 +1310,24 @@ typedef struct sha1_ctx_t { void sha1_begin(sha1_ctx_t *ctx) FAST_FUNC; void sha1_hash(const void *data, size_t length, sha1_ctx_t *ctx) FAST_FUNC; void *sha1_end(void *resbuf, sha1_ctx_t *ctx) FAST_FUNC; - +typedef struct sha256_ctx_t { + uint32_t H[8]; + uint32_t total[2]; /* rename to "count"? */ + uint32_t buflen; + char buffer[128]; /* NB: always correctly aligned for uint32_t */ +} sha256_ctx_t; +void sha256_begin(sha256_ctx_t *ctx) FAST_FUNC; +void sha256_hash(const void *buffer, size_t len, sha256_ctx_t *ctx) FAST_FUNC; +void* sha256_end(void *resbuf, sha256_ctx_t *ctx) FAST_FUNC; +typedef struct sha512_ctx_t { + uint64_t H[8]; + uint64_t total[2]; + uint64_t buflen; + char buffer[256]; /* NB: always correctly aligned for uint64_t */ +} sha512_ctx_t; +void sha512_begin(sha512_ctx_t *ctx) FAST_FUNC; +void sha512_hash(const void *buffer, size_t len, sha512_ctx_t *ctx) FAST_FUNC; +void* sha512_end(void *resbuf, sha512_ctx_t *ctx) FAST_FUNC; typedef struct md5_ctx_t { uint32_t A; uint32_t B; diff --git a/include/usage.h b/include/usage.h index fcd488ea7..75b44a25b 100644 --- a/include/usage.h +++ b/include/usage.h @@ -2404,9 +2404,10 @@ "Print" USE_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " MD5 checksums" \ USE_FEATURE_MD5_SHA1_SUM_CHECK( "\n" \ "\nOptions:" \ - "\n -c Check MD5 sums against given list" \ + "\n -c Check sums against given list" \ "\n -s Don't output anything, status code shows success" \ - "\n -w Warn about improperly formatted MD5 checksum lines") \ + "\n -w Warn about improperly formatted checksum lines" \ + ) #define md5sum_example_usage \ "$ md5sum < busybox\n" \ @@ -2418,6 +2419,42 @@ "busybox: OK\n" \ "^D\n" +#define sha1sum_trivial_usage \ + "[OPTION] [FILEs...]" \ + USE_FEATURE_MD5_SHA1_SUM_CHECK("\n or: sha1sum [OPTION] -c [FILE]") +#define sha1sum_full_usage "\n\n" \ + "Print" USE_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA1 checksums." \ + USE_FEATURE_MD5_SHA1_SUM_CHECK( "\n" \ + "\nOptions:" \ + "\n -c Check sums against given list" \ + "\n -s Don't output anything, status code shows success" \ + "\n -w Warn about improperly formatted checksum lines" \ + ) + +#define sha256sum_trivial_usage \ + "[OPTION] [FILEs...]" \ + USE_FEATURE_MD5_SHA1_SUM_CHECK("\n or: sha256sum [OPTION] -c [FILE]") +#define sha256sum_full_usage "\n\n" \ + "Print" USE_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA1 checksums." \ + USE_FEATURE_MD5_SHA1_SUM_CHECK( "\n" \ + "\nOptions:" \ + "\n -c Check sums against given list" \ + "\n -s Don't output anything, status code shows success" \ + "\n -w Warn about improperly formatted checksum lines" \ + ) + +#define sha512sum_trivial_usage \ + "[OPTION] [FILEs...]" \ + USE_FEATURE_MD5_SHA1_SUM_CHECK("\n or: sha512sum [OPTION] -c [FILE]") +#define sha512sum_full_usage "\n\n" \ + "Print" USE_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA1 checksums." \ + USE_FEATURE_MD5_SHA1_SUM_CHECK( "\n" \ + "\nOptions:" \ + "\n -c Check sums against given list" \ + "\n -s Don't output anything, status code shows success" \ + "\n -w Warn about improperly formatted checksum lines" \ + ) + #define mdev_trivial_usage \ "[-s]" #define mdev_full_usage "\n\n" \ @@ -3659,18 +3696,6 @@ "\n -f file Read from file instead of /var/log/wtmp" \ ) -#define sha1sum_trivial_usage \ - "[OPTION] [FILEs...]" \ - USE_FEATURE_MD5_SHA1_SUM_CHECK("\n or: sha1sum [OPTION] -c [FILE]") -#define sha1sum_full_usage "\n\n" \ - "Print" USE_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA1 checksums." \ - USE_FEATURE_MD5_SHA1_SUM_CHECK( "\n" \ - "\nOptions:" \ - "\n -c Check SHA1 sums against given list" \ - "\n -s Don't output anything, status code shows success" \ - "\n -w Warn about improperly formatted SHA1 checksum lines" \ - ) - #define showkey_trivial_usage \ "[-a | -k | -s]" #define showkey_full_usage "\n\n" \ |