Denys Vlasenko
49ecee098d
tls: add 2nd cipher_id, TLS_RSA_WITH_AES_128_CBC_SHA, so far it doesn't work
...
Good news that TLS_RSA_WITH_AES_256_CBC_SHA256 still works with new code ;)
This change adds inevitable extension to have different sized hashes and AES key sizes.
In libbb, md5_end() and shaX_end() are extended to return result size instead of void -
this helps *a lot* in tls (the cost is ~5 bytes per _end() function).
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-24 16:00:54 +01:00
Denys Vlasenko
b8935d00b0
sha512: use larger constant table only if sha512 is in fact selected
...
function old new delta
sha_K 640 256 -384
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-15 20:16:27 +01:00
Denys Vlasenko
71a090f187
sha3: fix to conform to final SHA3 padding standard, add -a BITS option
...
function old new delta
hash_file 331 396 +65
md5_sha1_sum_main 485 538 +53
packed_usage 30423 30464 +41
sha3_begin 17 31 +14
sha3_hash 101 110 +9
sha3_end 41 49 +8
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-29 14:05:25 +02:00
Denys Vlasenko
305958dbd4
md5sum: code shrink
...
For CONFIG_MD5_SMALL=1:
function old new delta
md5_process_block64 925 881 -44
For CONFIG_MD5_SMALL=0:
function old new delta
md5_process_block64 1603 1586 -17
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-07 19:17:01 +02:00
Denys Vlasenko
09a0e2223f
sha3: tweak comments and indentation
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-30 16:26:09 +02:00
Denys Vlasenko
4ff933c0e7
sha3: code shrink (and speedup for SHA3_SMALL=0)
...
function old new delta
sha3_process_block72 1454 1359 -95
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-30 14:18:57 +02:00
Denys Vlasenko
2a563ea49a
sha3: add 32-bit optimized bit-sliced implementation
...
It is an interesting trick, but so far I only managed to make it work
correctly, not to make it faster and/or smaller.
The code is ifdefed out for now.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-25 17:24:13 +02:00
Denys Vlasenko
1f5e81f8f8
md5/sha512: a better fix for strict aliasing warnings
...
The locations *are* well-aligned for direct stores
on any architecture.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-06-27 01:03:19 +02:00
Mike Frysinger
f6205c6ab7
md5/sha512: fix strict aliasing warnings
...
If the target can tolerate these issues, then gcc is smart enough
to generate the same code (x86_64 produces the same code). If the
target can't, then it needs the memcpy anyways.
libbb/hash_md5_sha.c: In function 'common64_end':
libbb/hash_md5_sha.c:87:4: warning:
dereferencing type-punned pointer will break strict-aliasing rules
*(uint64_t *) (&ctx->wbuffer[64 - 8]) = t;
libbb/hash_md5_sha.c: In function 'sha512_end':
libbb/hash_md5_sha.c:886:4: warning:
dereferencing type-punned pointer will break strict-aliasing rules
*(uint64_t *) (&ctx->wbuffer[128 - 8]) = t;
libbb/hash_md5_sha.c:889:4: warning:
dereferencing type-punned pointer will break strict-aliasing rules
*(uint64_t *) (&ctx->wbuffer[128 - 16]) = t;
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-06-19 11:49:15 -04:00
Denys Vlasenko
2cfcc9e9d7
sha3: code shrink
...
function old new delta
sha3_hash 155 101 -54
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-20 00:38:09 +01:00
Denys Vlasenko
e4f0f26bad
sha3: s/sha3_process_block76/sha3_process_block72/
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-16 12:23:23 +01:00
Denys Vlasenko
5368fe541c
sha3: rename KeccakF->sha3_process_block76.
...
This brings the naming more in line with other hashes.
Pulled most statics and constants into it.
Also noticed that two byte arrays are 1 element too big.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-16 02:20:31 +01:00
Denys Vlasenko
970aa6b5bd
sha3: cache ctx->bytes_queued
...
function old new delta
sha3_hash 171 155 -16
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-15 22:19:24 +01:00
Denys Vlasenko
8fb3ab528e
sha3: remove two "small code" codepaths: I can't reproduce code size win on them anymore
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-15 22:07:48 +01:00
Denys Vlasenko
8e7312e12f
sha3: tweak choice of a fast code path for 64-bit
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-15 21:50:41 +01:00
Denys Vlasenko
5b7f50f372
sha3: cosmetic tweaks to various names, comments. No logic changes.
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-15 19:52:30 +01:00
Denys Vlasenko
ac4100e103
sha3: code shrink
...
function old new delta
KeccakF 1053 1078 +25
KeccakF_RoundConstants 192 48 -144
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-15 16:27:39 +01:00
Denys Vlasenko
a55df27936
sha3: code shrink
...
function old new delta
KeccakF 1064 1053 -11
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-15 15:22:30 +01:00
Denys Vlasenko
07a54e21dd
sha3: another speedup for SHA3_SMALL=0 case
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-15 14:47:05 +01:00
Denys Vlasenko
30a8652fbf
sha3: make size/speed optimization decision configurable
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-15 01:12:26 +01:00
Lauri Kasanen
b8173b603f
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>
2013-01-14 05:20:50 +01:00
Denys Vlasenko
522041ee7b
regularize options which control size/speed trade
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-10 13:25:57 +02:00
Denys Vlasenko
fb132e4737
whitespace cleanup
...
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-29 11:46:52 +02:00
Denys Vlasenko
03a5fe378e
sha1: small tweak for clearer code, no logic changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-24 20:51:28 +02:00
Denys Vlasenko
f4c93ab304
sha1: use Rob's code, it's smaller and faster
...
function old new delta
static.rconsts - 16 +16
sha1_process_block64 460 298 -162
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 16/-162) Total: -146 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-24 19:27:30 +02:00
Denys Vlasenko
7ab94ca351
md5: remove outdated comment
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-19 02:33:39 +02:00
Denys Vlasenko
302ad1450e
libbb/hash_md5_sha: use common ctx and code for md5 and sha1/256
...
function old new delta
sha256_process_block64 421 433 +12
md5_crypt 578 587 +9
md5_begin 43 50 +7
md5_hash 99 97 -2
sha1_end 85 82 -3
md5_end 36 31 -5
common64_end 93 86 -7
sha1_hash 97 - -97
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-19 02:16:12 +02:00
Denys Vlasenko
c48a5c607d
hash_md5_sha: use common finalization routine for MD5 and sha1/256. -15 bytes
...
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-18 14:48:30 +02:00
Denys Vlasenko
b5aa1d95a1
libbb/hash_sha.c -> libbb/hash_md5_sha.c
...
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-18 13:47:47 +02:00