diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-11-10 13:32:50 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-11-10 13:32:50 +0000 |
commit | 56dceb9b7722193ef53fb1afb981f1289eecb0b0 (patch) | |
tree | 105363bf752df3c53e3d1165c8668af1983d5742 /include | |
parent | c028ec280a71c45ba71bb4712db1968391a440cc (diff) | |
download | busybox-w32-56dceb9b7722193ef53fb1afb981f1289eecb0b0.tar.gz busybox-w32-56dceb9b7722193ef53fb1afb981f1289eecb0b0.tar.bz2 busybox-w32-56dceb9b7722193ef53fb1afb981f1289eecb0b0.zip |
sha256,sha512: new applets. +4.9kb
we will require sha256/512 code for new $5$ and $6$ style
password hashes anyway, they are showing up already
in people's /etc/passwd...
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)) | |||
334 | USE_FEATURE_SH_IS_HUSH(APPLET_ODDNAME(sh, hush, _BB_DIR_BIN, _BB_SUID_NEVER, sh)) | 334 | USE_FEATURE_SH_IS_HUSH(APPLET_ODDNAME(sh, hush, _BB_DIR_BIN, _BB_SUID_NEVER, sh)) |
335 | USE_FEATURE_SH_IS_MSH(APPLET_ODDNAME(sh, msh, _BB_DIR_BIN, _BB_SUID_NEVER, sh)) | 335 | USE_FEATURE_SH_IS_MSH(APPLET_ODDNAME(sh, msh, _BB_DIR_BIN, _BB_SUID_NEVER, sh)) |
336 | USE_SHA1SUM(APPLET_ODDNAME(sha1sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, sha1sum)) | 336 | USE_SHA1SUM(APPLET_ODDNAME(sha1sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, sha1sum)) |
337 | USE_SHA256SUM(APPLET_ODDNAME(sha256sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, sha256sum)) | ||
338 | USE_SHA512SUM(APPLET_ODDNAME(sha512sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, sha512sum)) | ||
337 | USE_SHOWKEY(APPLET(showkey, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 339 | USE_SHOWKEY(APPLET(showkey, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
338 | USE_SLATTACH(APPLET(slattach, _BB_DIR_SBIN, _BB_SUID_NEVER)) | 340 | USE_SLATTACH(APPLET(slattach, _BB_DIR_SBIN, _BB_SUID_NEVER)) |
339 | USE_SLEEP(APPLET_NOFORK(sleep, sleep, _BB_DIR_BIN, _BB_SUID_NEVER, sleep)) | 341 | 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 { | |||
1310 | void sha1_begin(sha1_ctx_t *ctx) FAST_FUNC; | 1310 | void sha1_begin(sha1_ctx_t *ctx) FAST_FUNC; |
1311 | void sha1_hash(const void *data, size_t length, sha1_ctx_t *ctx) FAST_FUNC; | 1311 | void sha1_hash(const void *data, size_t length, sha1_ctx_t *ctx) FAST_FUNC; |
1312 | void *sha1_end(void *resbuf, sha1_ctx_t *ctx) FAST_FUNC; | 1312 | void *sha1_end(void *resbuf, sha1_ctx_t *ctx) FAST_FUNC; |
1313 | 1313 | typedef struct sha256_ctx_t { | |
1314 | uint32_t H[8]; | ||
1315 | uint32_t total[2]; /* rename to "count"? */ | ||
1316 | uint32_t buflen; | ||
1317 | char buffer[128]; /* NB: always correctly aligned for uint32_t */ | ||
1318 | } sha256_ctx_t; | ||
1319 | void sha256_begin(sha256_ctx_t *ctx) FAST_FUNC; | ||
1320 | void sha256_hash(const void *buffer, size_t len, sha256_ctx_t *ctx) FAST_FUNC; | ||
1321 | void* sha256_end(void *resbuf, sha256_ctx_t *ctx) FAST_FUNC; | ||
1322 | typedef struct sha512_ctx_t { | ||
1323 | uint64_t H[8]; | ||
1324 | uint64_t total[2]; | ||
1325 | uint64_t buflen; | ||
1326 | char buffer[256]; /* NB: always correctly aligned for uint64_t */ | ||
1327 | } sha512_ctx_t; | ||
1328 | void sha512_begin(sha512_ctx_t *ctx) FAST_FUNC; | ||
1329 | void sha512_hash(const void *buffer, size_t len, sha512_ctx_t *ctx) FAST_FUNC; | ||
1330 | void* sha512_end(void *resbuf, sha512_ctx_t *ctx) FAST_FUNC; | ||
1314 | typedef struct md5_ctx_t { | 1331 | typedef struct md5_ctx_t { |
1315 | uint32_t A; | 1332 | uint32_t A; |
1316 | uint32_t B; | 1333 | 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 @@ | |||
2404 | "Print" USE_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " MD5 checksums" \ | 2404 | "Print" USE_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " MD5 checksums" \ |
2405 | USE_FEATURE_MD5_SHA1_SUM_CHECK( "\n" \ | 2405 | USE_FEATURE_MD5_SHA1_SUM_CHECK( "\n" \ |
2406 | "\nOptions:" \ | 2406 | "\nOptions:" \ |
2407 | "\n -c Check MD5 sums against given list" \ | 2407 | "\n -c Check sums against given list" \ |
2408 | "\n -s Don't output anything, status code shows success" \ | 2408 | "\n -s Don't output anything, status code shows success" \ |
2409 | "\n -w Warn about improperly formatted MD5 checksum lines") \ | 2409 | "\n -w Warn about improperly formatted checksum lines" \ |
2410 | ) | ||
2410 | 2411 | ||
2411 | #define md5sum_example_usage \ | 2412 | #define md5sum_example_usage \ |
2412 | "$ md5sum < busybox\n" \ | 2413 | "$ md5sum < busybox\n" \ |
@@ -2418,6 +2419,42 @@ | |||
2418 | "busybox: OK\n" \ | 2419 | "busybox: OK\n" \ |
2419 | "^D\n" | 2420 | "^D\n" |
2420 | 2421 | ||
2422 | #define sha1sum_trivial_usage \ | ||
2423 | "[OPTION] [FILEs...]" \ | ||
2424 | USE_FEATURE_MD5_SHA1_SUM_CHECK("\n or: sha1sum [OPTION] -c [FILE]") | ||
2425 | #define sha1sum_full_usage "\n\n" \ | ||
2426 | "Print" USE_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA1 checksums." \ | ||
2427 | USE_FEATURE_MD5_SHA1_SUM_CHECK( "\n" \ | ||
2428 | "\nOptions:" \ | ||
2429 | "\n -c Check sums against given list" \ | ||
2430 | "\n -s Don't output anything, status code shows success" \ | ||
2431 | "\n -w Warn about improperly formatted checksum lines" \ | ||
2432 | ) | ||
2433 | |||
2434 | #define sha256sum_trivial_usage \ | ||
2435 | "[OPTION] [FILEs...]" \ | ||
2436 | USE_FEATURE_MD5_SHA1_SUM_CHECK("\n or: sha256sum [OPTION] -c [FILE]") | ||
2437 | #define sha256sum_full_usage "\n\n" \ | ||
2438 | "Print" USE_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA1 checksums." \ | ||
2439 | USE_FEATURE_MD5_SHA1_SUM_CHECK( "\n" \ | ||
2440 | "\nOptions:" \ | ||
2441 | "\n -c Check sums against given list" \ | ||
2442 | "\n -s Don't output anything, status code shows success" \ | ||
2443 | "\n -w Warn about improperly formatted checksum lines" \ | ||
2444 | ) | ||
2445 | |||
2446 | #define sha512sum_trivial_usage \ | ||
2447 | "[OPTION] [FILEs...]" \ | ||
2448 | USE_FEATURE_MD5_SHA1_SUM_CHECK("\n or: sha512sum [OPTION] -c [FILE]") | ||
2449 | #define sha512sum_full_usage "\n\n" \ | ||
2450 | "Print" USE_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA1 checksums." \ | ||
2451 | USE_FEATURE_MD5_SHA1_SUM_CHECK( "\n" \ | ||
2452 | "\nOptions:" \ | ||
2453 | "\n -c Check sums against given list" \ | ||
2454 | "\n -s Don't output anything, status code shows success" \ | ||
2455 | "\n -w Warn about improperly formatted checksum lines" \ | ||
2456 | ) | ||
2457 | |||
2421 | #define mdev_trivial_usage \ | 2458 | #define mdev_trivial_usage \ |
2422 | "[-s]" | 2459 | "[-s]" |
2423 | #define mdev_full_usage "\n\n" \ | 2460 | #define mdev_full_usage "\n\n" \ |
@@ -3659,18 +3696,6 @@ | |||
3659 | "\n -f file Read from file instead of /var/log/wtmp" \ | 3696 | "\n -f file Read from file instead of /var/log/wtmp" \ |
3660 | ) | 3697 | ) |
3661 | 3698 | ||
3662 | #define sha1sum_trivial_usage \ | ||
3663 | "[OPTION] [FILEs...]" \ | ||
3664 | USE_FEATURE_MD5_SHA1_SUM_CHECK("\n or: sha1sum [OPTION] -c [FILE]") | ||
3665 | #define sha1sum_full_usage "\n\n" \ | ||
3666 | "Print" USE_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA1 checksums." \ | ||
3667 | USE_FEATURE_MD5_SHA1_SUM_CHECK( "\n" \ | ||
3668 | "\nOptions:" \ | ||
3669 | "\n -c Check SHA1 sums against given list" \ | ||
3670 | "\n -s Don't output anything, status code shows success" \ | ||
3671 | "\n -w Warn about improperly formatted SHA1 checksum lines" \ | ||
3672 | ) | ||
3673 | |||
3674 | #define showkey_trivial_usage \ | 3699 | #define showkey_trivial_usage \ |
3675 | "[-a | -k | -s]" | 3700 | "[-a | -k | -s]" |
3676 | #define showkey_full_usage "\n\n" \ | 3701 | #define showkey_full_usage "\n\n" \ |