diff options
author | Lauri Kasanen | 2013-01-14 05:20:50 +0100 |
---|---|---|
committer | Denys Vlasenko | 2013-01-14 05:20:50 +0100 |
commit | b8173b603f57dcf918a67f1ec00763ab5f4e1cf8 (patch) | |
tree | 726549290ba408cf68561c4c1c2d591a80ded319 /include | |
parent | b7841cf7b919b16d1bd4619154bf7cb4c22b4ccd (diff) | |
download | busybox-b8173b603f57dcf918a67f1ec00763ab5f4e1cf8.zip busybox-b8173b603f57dcf918a67f1ec00763ab5f4e1cf8.tar.gz |
sha3sum: new applet
function old new delta
KeccakF - 496 +496
KeccakF_RoundConstants - 192 +192
sha3_hash - 171 +171
sha3_end - 40 +40
hash_file 274 299 +25
KeccakF_RotationConstants - 25 +25
KeccakF_PiLane - 25 +25
packed_usage 29213 29232 +19
sha3_begin - 18 +18
KeccakF_Mod5 - 10 +10
applet_names 2445 2453 +8
applet_main 1420 1424 +4
applet_nameofs 710 712 +2
------------------------------------------------------------------------------
(add/remove: 8/0 grow/shrink: 9/7 up/down: 1049/-54) Total: ~995 bytes
Signed-off-by: Lauri Kasanen <curaga@operamail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/applets.src.h | 1 | ||||
-rw-r--r-- | include/libbb.h | 7 | ||||
-rw-r--r-- | include/platform.h | 5 |
3 files changed, 12 insertions, 1 deletions
diff --git a/include/applets.src.h b/include/applets.src.h index 597b1c9..29ab167 100644 --- a/include/applets.src.h +++ b/include/applets.src.h @@ -328,6 +328,7 @@ IF_SETSEBOOL(APPLET(setsebool, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_SETSID(APPLET(setsid, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_SETUIDGID(APPLET_ODDNAME(setuidgid, chpst, BB_DIR_USR_BIN, BB_SUID_DROP, setuidgid)) IF_SHA1SUM(APPLET_NOEXEC(sha1sum, md5_sha1_sum, BB_DIR_USR_BIN, BB_SUID_DROP, sha1sum)) +IF_SHA3SUM(APPLET_NOEXEC(sha3sum, md5_sha1_sum, BB_DIR_USR_BIN, BB_SUID_DROP, sha3sum)) IF_SHA256SUM(APPLET_NOEXEC(sha256sum, md5_sha1_sum, BB_DIR_USR_BIN, BB_SUID_DROP, sha256sum)) IF_SHA512SUM(APPLET_NOEXEC(sha512sum, md5_sha1_sum, BB_DIR_USR_BIN, BB_SUID_DROP, sha512sum)) IF_SHOWKEY(APPLET(showkey, BB_DIR_USR_BIN, BB_SUID_DROP)) diff --git a/include/libbb.h b/include/libbb.h index 2059567..6ac7d2c 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -1636,6 +1636,10 @@ typedef struct sha512_ctx_t { uint64_t hash[8]; uint8_t wbuffer[128]; /* always correctly aligned for uint64_t */ } sha512_ctx_t; +typedef struct sha3_ctx_t { + uint64_t state[25]; + unsigned bytes_queued; +} sha3_ctx_t; void md5_begin(md5_ctx_t *ctx) FAST_FUNC; void md5_hash(md5_ctx_t *ctx, const void *data, size_t length) FAST_FUNC; void md5_end(md5_ctx_t *ctx, void *resbuf) FAST_FUNC; @@ -1648,6 +1652,9 @@ void sha256_begin(sha256_ctx_t *ctx) FAST_FUNC; void sha512_begin(sha512_ctx_t *ctx) FAST_FUNC; void sha512_hash(sha512_ctx_t *ctx, const void *buffer, size_t len) FAST_FUNC; void sha512_end(sha512_ctx_t *ctx, void *resbuf) FAST_FUNC; +void sha3_begin(sha3_ctx_t *ctx) FAST_FUNC; +void sha3_hash(sha3_ctx_t *ctx, const void *buffer, size_t len) FAST_FUNC; +void sha3_end(sha3_ctx_t *ctx, uint8_t *resbuf) FAST_FUNC; extern uint32_t *global_crc32_table; uint32_t *crc32_filltable(uint32_t *tbl256, int endian) FAST_FUNC; diff --git a/include/platform.h b/include/platform.h index 4025561..1282306 100644 --- a/include/platform.h +++ b/include/platform.h @@ -205,6 +205,7 @@ #include <stdint.h> typedef int bb__aliased_int FIX_ALIASING; +typedef long bb__aliased_long FIX_ALIASING; typedef uint16_t bb__aliased_uint16_t FIX_ALIASING; typedef uint32_t bb__aliased_uint32_t FIX_ALIASING; @@ -212,7 +213,8 @@ typedef uint32_t bb__aliased_uint32_t FIX_ALIASING; * a lvalue. This makes it more likely to not swap them by mistake */ #if defined(i386) || defined(__x86_64__) || defined(__powerpc__) -# define move_from_unaligned_int(v, intp) ((v) = *(bb__aliased_int*)(intp)) +# define move_from_unaligned_int(v, intp) ((v) = *(bb__aliased_int*)(intp)) +# define move_from_unaligned_long(v, longp) ((v) = *(bb__aliased_long*)(longp)) # define move_from_unaligned16(v, u16p) ((v) = *(bb__aliased_uint16_t*)(u16p)) # define move_from_unaligned32(v, u32p) ((v) = *(bb__aliased_uint32_t*)(u32p)) # define move_to_unaligned16(u16p, v) (*(bb__aliased_uint16_t*)(u16p) = (v)) @@ -221,6 +223,7 @@ typedef uint32_t bb__aliased_uint32_t FIX_ALIASING; #else /* performs reasonably well (gcc usually inlines memcpy here) */ # define move_from_unaligned_int(v, intp) (memcpy(&(v), (intp), sizeof(int))) +# define move_from_unaligned_long(v, longp) (memcpy(&(v), (longp), sizeof(long))) # define move_from_unaligned16(v, u16p) (memcpy(&(v), (u16p), 2)) # define move_from_unaligned32(v, u32p) (memcpy(&(v), (u32p), 4)) # define move_to_unaligned16(u16p, v) do { \ |